Wheel Watcher Sensor Version 2


Materials list

1) A geared dc motor and a way to control it Check out my previous post about the L298 Motor Driver
2) Hamamatsu Photoreflector 5587 I bought mine here
3) A microcontroller I used a PIC18F6722 dev board
4) A computer printer, paper, and some glue
5) Miscellaneous wires, resistors, capacitors, solder, and connectors (see wiring diagram)

Design details

Note that a lot of this text is copied from my previous attempt at a wheel watching system for my robots. Version 2 is an improvement in hardware and software over version 1. This project uses an LED/phototransistor package with amplification. I recommend this over version 1 as it's easier to build, smaller, and produces much better results. I've also updated the driver for the wheel watcher since version 1. This new driver should be backward compatible with version 1, but I have not tested this new software with my version 1 wheel watcher.

The wheel watcher is a system that measures the distance each wheel on a robot has traveled. While this system wont 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 dont 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.

Here is a description of the wheel watcher system. I started by soldering the circuit below with the Hamamatsu 5587 Photoreflector. This circuit detects 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 that circuit which outputs an alternating high/low signal as it passes over black and white strips to my microcontroller. 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: Wheel Watcher
Here are some pictures: Wheel watcher template, Wheel watcher board front, Wheel watcher board back, Wheel with template on it

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