Robots running on wheels need to know how long they did run. For this purpose wheels are equipped by encoders - sensors which register rotation angle changes.
Usually robot's wheels are rotated by a motor via some gear - a set of gear wheels decreasing rotation speed of motor in many times. The gear wheel rotating robot's wheel has already several times more rotation speed the wheel. The next gear wheel rotating this gear wheel has even more speed and so on. If drill holes in one of these gear wheels and situate optical sensors there - it's possible to register rotation angle changes with fine precision.

LED and optical receiver are taken from an old mouse with a ball inside instead of optical sensor. Actually optical receiver is a photo-transistor or a photo-diode which has resistance about hundreds Ohms and noticeable less when LED lights on it.

Step 1: Drill Holes in the Gear Wheel

Drill holes in the gear wheel. It may be 4, 6 or 8 depending of size of a gear wheel. Important to make them in equal distances between each other.

Step 2: Soldering LED and an Optical Receiver

Solder to wires LED (1) with its lens (2) against optical receiver (3). Light proof cover (5) with a window defends receiver from surrounding light.
This receiver has one pin (4) left free because it has one more receiver inside - it may be used to define the rotation direction. Not used this time.

Step 3: Attach LED and Receiver

Attach LED and receiver against each other in the way holes in the gear wheel let LED light to the receiver through holes and be interrupted when the gear wheel gets turned.

Step 4: Glue Attached LED and Receiver

Glue attached LED and receiver by thermal glue

Step 5: Another Design

Same construction with connector for encoder and motor
If you wanted the EXACT position of the wheel you could use a 'Grey Code Binary' disk. Only one bit changes at a time- available in 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024 etc. positions. <br> <br>If you are only interested in RELATIVE position of the wheel you can use a 'Sine - Cosine Detector' that tells you how many turns the wheel has made AND in which direction it has turned. This requires TWO photo cells.
These are good solutions - they are more complicated but get better result. <br><br>The way described in the instruction is a simple solution for many ordinary cases. It's often enough to get a relative position of an object (robot, car, manipulator's joint) counting encoder's &quot;ticks&quot;. It gives a total angle of wheel's rotation relative to the last known position. It also can give rotation speed. I used this to turn a robot on a required angle, to control its motion speed and to provide feedback for a PID regulation program.

About This Instructable




More by revrekad:Another cardboard robot-vacuum-cleaner controlled with Arduino How to create 3D model of mechanism 3D models of gears for 3D printing 
Add instructable to: