Smart Car Controller  1.0
Library to manage a two wheeled robotic vehicle (DC Motors)
Motor Encoder

Photo Interruptor Encoder

The motor encoder can be any sensor that provides a known number of pulses per wheel revolution.

A simple encoder for this application is a photo interruptor. This is a device that has a LED shining through a rotating slotted wheel with a light detector on the other side. The slotted wheel turns with the wheel and the encoder is attached to the vehicle body. A commercialy available module with this device is shown below.

Encoders are easy to salvage from a variety of inoperable electronic equipment (printers, mice for example) and the circuit above can be used to build a near-zero cost DIY version. Note that the output of this circuit is pulled HIGH when there is no signal from the detector.

The output of the circuit needs to be connected to a pin that supports interrupts. On the Arduino Uno/Nano this is pin 2 or 3.