Building an optical encoder

This article describes a simple and inexpensive method of constructing
a robust optical encoder capable of producing quadrature encoded signals.

A non-functional mouse was disassembled, and three important parts were
salvaged - the plastic, slotted wheel, the IR transmitter, and the IR
receiver. These parts are shown in Figure 1. The transmitter is the two
pin device, and can be considered as a normal LED. The receiver has three
pins and consists of two common-collector transistors. The bases are
optically driven with the emitters connected to the output pins.

Figure 1 - Salvaged mouse parts

A conventional panel-mount potentiometer was used as the basis of the
mechanical housing. This is shown in Figure 2. This device eases the
mounting arrangements, since a threaded sleeve is already built in, and it
also provides a stable platform on which to attach a control knob. Trying
to mount the soft plastic wheel to a front panel, and then fit a knob to
the thin shaft would have otherwise been almost impossible.

Figure 2 - Potentiometer to be used as mechanical housing

The first step was to disassemble the potentiometer. This was
accomplished by bending up the four tabs holding the back case in
position, and removing the casing. A hole was drilled in the center of the
case to allow the encoder shaft to protrude. This is shown in Figure 3.

Figure 3 - Back case with center hole

Next, a hole was drilled in the center of the shaft, approximately
1.5mm in diameter and extending approximately 5mm into the shaft. It is
vitally important that this hole be exactly in the center of the shaft,
since any offset will result in errors when rotating the wheel. Also at
this stage, the plastic stop that prevents the potentiometer from rotating
fully was removed. These modifications are shown in Figure 4. When
building the prototype, the solder tabs and carbon track were left in
position until later. It would be much simpler to remove them at this
stage, before the back case is fitted.

Figure 4 - Shaft center hole and stopper removed.

The shaft on the plastic wheel was then cut to length, and tapered to
fit the hole drilled in the potentiometer shaft. See Figure 5. Turning the
shaft should result in a smooth circular flow of the wheel without any
wobbling or offset motion.

Figure 5 - Plastic wheel ready to fit

Once the plastic shaft fits without any problems, the potentiometer can
then be reassembled, and the wheel glued in place. This is shown in Figure
6. Please note, that this prototype shows the solder tabs still fitted,
but it is recommended that these tabs be removed before reassembling the
potentiometer.

Figure 6 - Encoder fitted to potentiometer

A small piece of double-sided circuit board was cut to size, with a
slot to accomodate the wheel. Both the transmitter and receiver were
soldered to this PCB so that the beam from the transmitter would be
interrupted by the teeth on the wheel as it rotated. This arrangement is
shown in Figure 7.

Figure 7 - Circuit board with transmitter and receiver

By using double-sided circuit board it was possible to mount the board
simply by soldering it directly to the back case of the potentiometer.
This is shown in Figure 8.

Figure 8 - Mounting the board to the potentiometer

Since double-sided copper board was used, a solder fillet was also run
on the top side of the board to assist with mechanical stability. See
Figure 9 for details. Also note that the solder tabs on the potentiometer
have been removed.

Figure 9 - Mounting the board to the potentiometer

The final step was to fit a small piece of circuit board to the end of
the plastic shaft to assist with linear stability and to provide greater
mechanical strength. This is shown in Figure 10.

Figure 10 - Shaft support soldered to main board

Since this device is just the encoder, additional parts are
required to produce usable quadrature encoded signals. A typical circuit
is shown below. This circuit is one I have used when building a direct
digital synthesizer. The synthesizer included a Lock button which
prevented the frequency from being changed inadvertently - hence the
enable switch on the transmitter LED.