3. Digital Quadrature Optical Encoder Circuit Board

(article continued from previous page)

Recall that the digital optical encoder emits light from red LEDs, the light reflects of a half-black/half-white rotating disc, and into a pair of phototransistors. The phototransistors output an analog voltage into a comparator circuit. The comparator checks the sensor voltage against an adjustable voltage produced by a potentiometer. If the sensor voltage is lower than the potentiometer, the comparator chip outputs low. Otherwise the comparator chip outputs high and also turns on an indicator LED.

Front and back circuit board layout for an optical encoder. (Not to scale)

Front and back circuit board layout for an optical encoder. (Not to scale).

The PCB is only about 1.3 inches squared. It was made with numerous surface mount components. However, it can just as easily be laid out of a solderless breadboard using through-hole technology.

Optical encoder circuit on a solderless breadboard.

Optical encoder circuit on a solderless breadboard.

I apologize that I don’t have a schematic for this circuit. However, you should be able to recreate this circuit by looking at the wiring on the solderless breadboard and the labeled part values.

Dual Encoder on a Robot

Here are two digital optical encoder boards installed on a tool transporter robot.

Wheels attached to gearmotors with non-geared output shaft containing encoder discs.

Wheels attached to gearmotors with non-geared output shaft containing encoder discs.

The wheel base is 16 inches, end-to-end. These motors didn’t come with encoders, but each motor has two output shafts (one goes to the gearhead and the other to the optical disc that I added).

A closer look at a pair of back-to-back encoder boards with red LED emitters.

A closer look at a pair of back-to-back encoder boards with red LED emitters.

You can see the potentiometers are bent away from the board so that the LED brightness and the sensor voltage trip point can be adjusted in vivo.

I wish I had used a couple of infrared LEDs and angled them a bit towards the target area where the phototransistors are looking. As currently configured, the encoder boards need to be a little far from the encoder disc to get an adequate reflection. Because of the gap, the entire setup needs to be covered by an opaque case to prevent ambient lighting from overwhelming the red LEDs.

The digital encoder technology works well. There aren’t any noise problems in the signals that reach the microcontroller board and the comparator relieves the microcontroller of processing burden. Additionally, the microcontroller has four analog-to-digital pins to use for other sensors that would otherwise have been monopolized by an analog encoder.