Show Posts
Pages: [1] 2
1  Using Arduino / Sensors / Re: DC motor as tachometer - reading negative voltages on: February 12, 2014, 03:44:10 am
Ok. I'll try that.
Would this also work?
A and B are tacho outputs.


2  Using Arduino / Sensors / Re: DC motor as tachometer - reading negative voltages on: February 12, 2014, 02:38:42 am
Ok. I can do that.
So, how would I tell from the arduino which voltage was positive, and which neg?
3  Using Arduino / Sensors / Re: DC motor as tachometer - reading negative voltages on: February 11, 2014, 03:15:19 pm
Or do I make something like this:
Yes that is what I was describing. That will let you count pulses from your tacho. However if you want to get an average DC voltage to measure then you need a capacitor across that resistor.
If the voltage from the motor exceeds 5V peak, then you need that resistor to be a potential divider with the arduino fed from the center point ( analogue in ) with the arduino ground connected to the lower connection.

Ok, I can get this to work with only one direction of the motor, either positive or negative. If I want to to measure both negative velocity and positive velocity, I get very weird results on the voltmeter. From your post I figured I need two circuits like that one pictured, each for one direction of current, and then I would read potentiometer wiper outputs with arduino.

I can't find anything on google, but that might just mean I'm using wrong terminology.
4  Using Arduino / Sensors / Re: proximity controlled servo!! help please soo close! on: February 09, 2014, 01:27:45 pm
I would add this line to limit distance:

int val = digitalRead(distance);   
val = constrain (val, 300,500);
 val = map(val, 300, 500, 0, 179)
5  Using Arduino / Sensors / Re: DC motor as tachometer - reading negative voltages on: February 06, 2014, 05:25:18 pm
Great. I think I understand now.
Big thanks!
6  Using Arduino / Sensors / Re: DC motor as tachometer - reading negative voltages on: February 06, 2014, 03:20:16 pm
Sorry about that. I thought the code tags set a monospace font.

So, the diode goes parallel to the motor, and the pot goes parallel to the diode?

Or do I make something like this:

If so, do I need to limit the current from the motor? And which end, goes to arduino adc, which to arduino gnd?
7  Using Arduino / Sensors / Re: DC motor as tachometer - reading negative voltages on: February 06, 2014, 03:07:15 pm
One is to use two half-bridge rectifiers,
Just use a single rectifying diode because the negative half of the waveform is just the same as the positive one.

Does this look ok? I assume I would need two of these, just with reversed diodes.

A-------  +----------------+----------------- Arduino gnd
                   |                                  |
                \    /  Diode          ----   Pot
                   V                             |      |--------------  Arduino adc
                   |                               |__|
                   |                                  |
8  Using Arduino / Sensors / DC motor as tachometer - reading negative voltages on: February 06, 2014, 11:46:56 am
 I want to use small DC motor as a tachometer.  The output of the motor is about -5 to +5 V and 1 A, if I'm measuring that correctly. How do I connect the tachometer to the Arduino so that I can safely measure it's output voltage?

I've found two solutions, but I don't understand them. One is to use two half-bridge rectifiers, one to measure positive voltages, and one for negative. I've tried making that, but didn't succeed. How would this circuit look like? Where exactly do I connect tach outputs and where is is Arudino ground and adc?

Another solution is to use a voltage divider and 'add' the voltage to the tach output. I've found that the motor starts drawing current from the arduino if I connect it that way, so I suspect some diodes are needed, but I don't know how.

9  Using Arduino / Project Guidance / Arduino as a digital motor controller (DIY servo) on: January 22, 2014, 06:13:46 pm
I'm learning control theory.  I'm trying to find limits on how good a servo I can make just with a pot, a geared dc motor and an arduino. Well, some other hardware too, and a processing sketch for graphs and tuning.  It works, but I believe it could be better. I can make it quite accurate for step changes, but I can't make it move slowly.

I have velocity control as inner and position control as outer loop. The potentiometer is read at 100Hz (10 ms per loop). I don't see noticeable differences if I increase the update frequency to  200Hz.  

The pot measures angular position. Velocity is calculated from position change.

Here is some relevant code:
   starttime = micros ();
   ref = analogRead (1);
   pos = analogRead (0);

    err = ref - pos;
    vel = pos-lastpos;

    lastpos = pos;  

    Qo = Kp*err - Kv*vel;
    Qo = constrain (Qo, -255, 255);
    Output (Qo);

   if (starttime-micros() < period)   // period is 10 000 microseconds
         {  };

So, I would like to make it possible for the servo to move accurately and slowly if needed.
Would I benefit from a 16 bit adc? Do I need a faster velocity loop?

I'm using Arduino Mega. For the motor driver I use SN754410.
Motors are similar to these:
The pot that measures angular position is mounted on the motor output shaft. I've drilled it and added just a bit of super glue.
I tried voltages from 3 to 12V. Currently testing 9V.
10  Topics / Robotics / Re: PCT Robot arm, only control loops, no inverse kinematics on: November 09, 2012, 05:56:59 pm
Hi Glor

Current functions of the arm include only positioning on a certain point in 3D space. No object grabbing yet.
For object grabbing, there should be some kind of visual feedback - "object-arm distance control loop".

What i did is similar to this project on instructables:

Then, on top of that, there is another layer of control loops that coordinates lower levels, like in the link I posted in the first post.

11  Topics / Science and Measurement / Re: Leonardo Response Box (Reaction Time) on: November 01, 2012, 07:26:52 am
About 1 ms accuracy would be enough.

The arduino does not have to know when the stimulus is pressed.
Software measures the time from stimulus onset until key press on a keyboard, or on the response box (the arduino).

A better idea (more accurate) would be sincronize Arudino and PC clocks and then have the arduino record exact keypress and keyrealease time, and just send a char with a timestamp.

But then I would need a special driver for the device, and special software to use it.

I'd like to keep things simple and just make the arduino emulate a keyboard.
12  Topics / Science and Measurement / Re: Leonardo Response Box (Reaction Time) on: October 24, 2012, 05:27:58 pm
Oh, by the way, RT is usualy measured from stimulus onset (e.g. a picture on the screen) to key press.

Or, if the subject keeps one button pressed and reacts with another button, then there are two times - from stimulus onset to key1_release, and from key1_release to key2_press.
13  Topics / Science and Measurement / Leonardo Response Box (Reaction Time) on: October 24, 2012, 05:22:28 pm

Reaction time experiments are widely used in psychology. For serious use, it's important to have a very accurate measuring device. Standard keyboards are not made with timing accuracy in mind, so psychologists use special 'response boxes', such as this one:
It's very accurate, but it works only with special software, connects via serial port, needs drivers, and - it's pricey.

I'm guessing the new Leonardo could be made into a nice, accurate reaction time measuring device. The most user-friendly way would be to make leonardo emulate a keyboard, so it could be simply plugged in.
Also, some low-bounce buttons should be used.

So, does someone know lag-times for the leonardo - how much time does it take from pressing a button on the arduino to computer receiving the button-press signal? If it is long - could it be made shorter?
How about low-bounce button designs?

Thank you.
14  Topics / Robotics / PCT Robot arm, only control loops, no inverse kinematics on: October 16, 2012, 05:45:12 am

I've built a robot arm (using OWI 535, 4 deg. of freedom) that uses a hierarchy of control loops for positioning - there is no inverse kinematics.
There are three levels of control. The first level controls the speed of the motors using potentiometers as sensors.
The second levels loops control the angles of each joint. Loops on the third level coordinate second level loops in complex movements such as extending reach while maintaining hand pitch.

It's based on PCT (perceptual control theory) and a fascinating virtual model of a human arm ( after dl, look for Coordination Demo)

I'ts primary purpose is modeling the human nervous system, and since there is no inverse kinematics, just simple control loops, it might be useful elsewhere. The control loops are currently simulated on the computer. An arduino collects sensor data and sends it to the computer, and receives motor speed commands and sends them to motors. It might also be possible to do all the calculations on the arduino itself (but then I'd need more analog inputs). The software is written in C#.

So.. it's working. I'm planing a more complex arm.
I'd be happy to answer any questions.
15  Using Arduino / Interfacing w/ Software on the Computer / Re: Need faster serial transfer - Arduino and C# on: April 25, 2012, 03:54:28 pm

btw. Is there an 'edit post' in this forum?
a little correction:
while (AppStillIdle)
                  while (stopwatch.ElapsedMilliseconds < 5)
                  label31.Text = Angle[0].Position.ToString() + " " + Angle[1].Position.ToString() + " " +
                              Angle[2].Position.ToString() + " " + Angle[3].Position.ToString() + " " +
                  label1.Text = stopwatch.ElapsedMilliseconds.ToString("D3");
                  if (serialPort1.IsOpen)
                          label32.Text = serialPort1.BytesToRead.ToString();
Pages: [1] 2