There are two easy ways to add encoders to your Ebot, one is to add photosensors right onto the servo itself; another is to add an external encoder of some sort. We'll describe several ways here.
Click for a description by Richard Vannoy of how to modify your hacked Cirrus CS-60 servos to add an optical encoder.
Ralph Irwin has come up with the circuitry necessary to process the signals from the photo detector and make them suitable for your processor. As with all such homebrew implementations, you may find it necessary to vary the resistor values to get acceptable results.
The usual plan here is to build a target
consisting of a series of light and dark areas which rotates with the
wheel. A photo detector is then installed to detect when the dark and
light areas pass by and send a series of pulses to your processor.
Lior Elazary has recently built an encoder like this for his robot Sparky. The following pictures show his installation and additional details on building the encoder and interfacing it to a Basic Stamp processor can be seen at his website www.liorelazary.com.
Another idea is to have a disc with holes located around the edge of the disk (located equidistant as is done with Lior's reflective design) which rotates with the wheel and shine a light through the holes and detect the light flashes on the other side.
As it is hard to get high precision using this method (Lior's encoder has 16 white bars per revolution), it can be useful to attach your encoder to a gear which rotates at a higher rpm than the wheel. Even just a single white and dark area which rotates at the motors basic speed (before gearing) may provide many more pulses per wheel revolution than an encoder directly on the wheel.
Other tricks include counting both when a pulse starts (the white area is reached) and when the pulse ends (the dark area is reached. This would double your resolution. Lior's software uses this method. However, you should make sure your photo detector is adjusted to give a pretty square wave (rather than short or long pulses) to get this to work well.
A sample program to show how Lior read his encoders using a Basic Stamp 2.
Rotary optical encoders are also available as either new or used parts. These can often be hooked directly to the wheels. If you are lucky, you will get quadrature encoded encoders which give you the ability to determine direction of rotation as well as distance.
two encoders on the right were found as surplus. The larger one on the
right can also be procured new from www.digikey.com
as their part number 600CS-ND (unfortunately, for $45.).
The larger one does provide 128 pulses per revolution which gives quite good accuracy. It is also quadrature encoded, hence can provide direction of rotation and even extend the precision up to 512 pulses per revolution if desired.
The smaller one was found at Gateway electronics in San Diego, www.gatewayelex.com for their address, who seems to have had them in stock for a year or so. It only provides 32 pulses per revolution, but it is also quadrature encoded and you could extend the precision up to 128 which is very good.
Two example pictures follow showing the encoders mounted on robots. In each case, the 1/4 inch shaft of the encoder easily mounted into the center axle hole of the wheel. For the Ebot version (picture on left), the wheel hole was just drilled out to 1/4 inch and the encoder shaft became a press fit.