Go Down

Topic: Super simple RPM monitor. (Read 914 times) previous topic - next topic

magruder13

I'm programming a speed controller for the drive train of my robot and I can adjust the speed of each motor so it drives straight when I want to go forward fast (its a skid steer). This is good because one side runs alot faster than the other and it drives to the left and it takes forever to guess at how much faster it is going and keep modifying it. Basically I just want a simple RPM monitor that I can hook up when I want to know how much faster one is going than the other. I know it can be done by taping a magnet to the wheel and a hall effect something or other.

magruder13

Those are really expensive!

cr0sh

#2
Jun 19, 2011, 06:42 am Last Edit: Jun 19, 2011, 06:44 am by cr0sh Reason: 1

Those are really expensive!


Basically, you just need a simple optical encoder.

If you don't care which way the wheel is spinning (this can be useful information BTW), then simply putting a white stripe on the wheel or the output shaft, and leaving the rest black or unpainted (provided it isn't reflective) will give you your RPM information. All you have to do then is point an LED at it (red or IR will work fine), as well as a phototransistor (you might need a baffle or something between the LED and phototransistor, so that only the reflection of the LED off the shaft/wheel from the white stripe triggers the phototransistor, and not anything else). The phototransistor can then trigger a digital input (ideally, one being monitored by a pin-change interrupt ISR).

This is what that SparkFun system is, except it is all nicely intergrated with a PCB and SMT components (plus it's doing quadrature encoding - which gives back directional information about the wheel/shaft - so there's double the components); you can probably build something similar for your own components and such for under $5.00 USD.
I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

growler

What does your drive train look like? Gears? Belts?

If you can move the encoder closer to the power source, so it watches one of the gears or something, you will get higher resolution on your speed data.

I've done this as cr0sh suggested but I've also done configurations where the led and phototransitor face each other and then painted the interrupting pattern on a gear. Since many plastics at the width of a gear are transparent to IR, this can work pretty well also.

zoomkat

You might could make a wheel encoder using the below.

http://www.sparkfun.com/products/246
Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   8)

jackrae

Glue some magnets to your drive wheels and fix a reed switch to the chassis.  As each magnet passes the reed a pulse is generated.  Cheap and simple.  One magnet will give one pulse per rev and 4 magnets will give 4 pulses etc

Then you simply feed the left and right pulses into a couple of dig-ins and compare the frequencies.  It matters not if the pulses are out of sync since it's frequency you're interested in, not phase difference.

Of course the higher the pulse rate the better the resolution, so if your motors are geared down you might be better looking at motor shaft speeds rather than drive wheels. 

robtillaart

Quote
If you don't care which way the wheel is spinning (this can be useful information BTW), then simply putting a white stripe on the wheel or the output shaft, and leaving the rest black or unpainted (provided it isn't reflective) will give you your RPM information. All you have to do then is point an LED at it (red or IR will work fine), as well as a phototransistor (you might need a baffle or something between the LED and phototransistor, so that only the reflection of the LED off the shaft/wheel from the white stripe triggers the phototransistor, and not anything else). The phototransistor can then trigger a digital input (ideally, one being monitored by a pin-change interrupt ISR).


BUilding forth on Crosh's idea: If you care which way the wheel is spinning you can make a number of stripes on the wheel of increasing thickness. This will give you some sort of Pulse Width Modulation. The PWM signal will look different either "increasing or decreasing " and one big jump. Other patterns can be created;  to detect direction a minimum/multiples of three different linethicknesses is needed.  Name them 1,2,3. In your code remember the last linethickness (e.g. line 1) then the next line will be either 2 or 3 (CW or CCW) now the new last thickness is known and the wheel goes on and on and on.

(code not tested)
Code: [Select]

#define NONE 0
#define CW 1
#define CCW 2
int direction (int new)  // new should be in { 1,2,3 }
{
   static int prev = 0;
   if (0 == prev)  // only first time
   {
    prev = new;
    return NONE;
  }
  int dir = (new - prev +3) % 3;
  prev = new;
  return dir;
}


my 2 cents,
Rob
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

magruder13

Thanks for all of the responses but I think you guys missed the purpose. I just want to know the RPM when I go to program the speed controler, then I will take it off of the robot. The reason I want it is so I don't have to guess at how fast it is moving and keep testing if it is working better and keep programming it.

I think that the putting white tape on the wheel would be okay, the wheel RPM should be around 450RPM.

zoomkat

You may want to use google to search this and the old forum for tachometer to see similar post. If your multimeter has a frequency meter, you might be able make a setup to measure the wheel rpm. In the past I've made a simple wheel rotation detector by putting a small strip of aluminum foil on the wheel, and placing two adjacent sensor wires where the strip would make an electrical connection between the wires as the wheel rotated.

http://www.google.com/search?q=tachometer+site%3Ahttp%3A%2F%2Farduino.cc%2Fforum%2Findex.php&hl=en&num=100&lr=&ft=i&cr=&safe=images&tbs=

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   8)

growler

So I'm confused now, you don't want this on the final product?

That's going to cause some problems as even if you do come up with a good function relating your input to the motor and the speed the motor produces, this function is likely to change as the battery voltage droops.  You might get things working well on a full charge and then things change once the batteries wear or vice versa.

To get solid speed control throughout the charge cycle of your battery you really need closed loop control on the wheels, requiring something like the encoders mentioned here.

Getting a skid steer, or differential drive, to go straight over long distances and at various battery levels "from scratch" is not a trivial problem in my experience. Yes there are solutions that you can buy but as you said, they are a little pricey compared to making it yourself.

Go Up