Pages: [1]   Go Down
Author Topic: Super simple RPM monitor.  (Read 848 times)
0 Members and 1 Guest are viewing this topic.
Chicago
Offline Offline
Jr. Member
**
Karma: 1
Posts: 89
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Chicago
Offline Offline
Jr. Member
**
Karma: 1
Posts: 89
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Those are really expensive!
Logged

Phoenix, Arizona USA
Offline Offline
Faraday Member
**
Karma: 40
Posts: 5570
Where's the beer?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: June 18, 2011, 11:44:13 pm by cr0sh » Logged

I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

Portland, OR
Offline Offline
Full Member
***
Karma: 0
Posts: 101
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9541
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You might could make a wheel encoder using the below.

http://www.sparkfun.com/products/246
Logged

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

SW Scotland
Offline Offline
Edison Member
*
Karma: 17
Posts: 1383
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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. 
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 216
Posts: 13663
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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
Logged

Rob Tillaart

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

Chicago
Offline Offline
Jr. Member
**
Karma: 1
Posts: 89
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9541
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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=

Logged

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

Portland, OR
Offline Offline
Full Member
***
Karma: 0
Posts: 101
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: