Wheel Watcher Sensor


Materials list

1) A geared dc motor and a way to control it – Check out my article about previous post about the L298 Motor Driver
2) A LED and phototransistor – I used this combine LED/phototransistor package
3) A LM339 comparator IC or equivalent. You can pick this up at Radio Shack or order on line
4) A 1K variable resistor
5) A microcontroller – I used a PIC18F6722 dev board
6) A computer printer, paper, and some glue
7) Miscellaneous wires, resistors, solder, and connectors

Design details

The wheel watcher is a system that measures the distance each wheel on a robot has traveled. While this system won’t be exactly accurate since the wheels can slip, it can be pretty darn accurate and should help immensely when trying to figure out where your robot is. My project assumes the microcontroller you are using can easily count how often your wheel turns so I don’t include any counter hardware. You could keep track of that by frequently polling an input pin, but since my microcontroller has external interrupts I used those in my software. Writing software that does a polling loop instead of using interrupts would be trivial. With one of these hooked up to each wheel you can even calculate how much you turned.

I’ve recently found a LED/phototransistor package that includes an amplifier. I’m hopeful that I can use component in a smaller and easier to construct package. I’ll be posting my findings with that in the future. Because of this change in focus I didn’t completely iron out the last few wrinkles in this plan. However, I decided since I did all the work to get this working I would post my findings as they stand. Everything here seems to work well, but it takes awhile to construct and requires two different voltages. The advantage of this wheel watcher over the one I’m going to work on in the future is this one uses very easy to obtain components and gives you a better appreciation of how this kind of system really works.

Here is a description of the wheel watcher system. First I started by wire wrapping (feel free to solder or protoboard) a circuit that uses an inferred LED and phototransistor to detect the difference between black and white. I then printed out my wheel watcher template which I glued on to my wheel. The idea here is that as the wheel spins I can count the number of changes from black to white. Then I connect up that circuit which outputs an alternating high/low signal as it passes over black and white strips. My software uses an external interrupt on my microcontroller to count how many turns the wheel has made. When I want to know how far the wheels have traveled I call a function which converts those turns into inches.

Here is the souce code: source code
Here is the circuit diagram: wheelWatcher
Here are some pictures: Wheel watcher template, Wheel watcher board front, Wheel watcher board back, Wheel with template on it, Microcontroller with wheel watcher board attached

Please email any questions/comments/errors to robots@glacialwanderer.com.