Subsection 11.4.1 How the Photointerrupter Turns Rotation Into Pulses
The optical incremental sensor we saw at the end of Wednesday’s class has two parts. The first is the slotted wheel, which is fixed to the motor’s shaft and turns with it. The second is the photointerrupter, the U-shaped part wrapped around the rim of that wheel. There is an LED (light-emitting diode) on one side of the U and a phototransistor on the other. A phototransistor is a transistor that is switched by light falling on it rather than by a current we supply. The LED shines steadily across the gap between the two sides, and the rim of the wheel passes through that gap (Figure 11.4.2).
Every time a slot comes around, the light gets through to the phototransistor; every time a spoke, the solid part of the rim between two slots, comes around, the light is blocked. So the sensor’s output switches back and forth once for every slot that goes past, and a wheel that is turning steadily produces a steady square wave. The number of pulses tells us how far the shaft has turned, and the rate at which they arrive tells us how fast.
/fig-day12-sensor-body.jpg)
/fig-day12-encoder-wheels.jpg)
EE-SX672 printed on its side and the gap the wheel’s rim passes through; on the right two slotted wheels, which push onto the motor’s shaft. Yours are already assembled.The photointerrupter has three connections: power, ground, and an output. The output needs a pull-up resistor: about 10 kΩ between the output and 3.3 V, or the pin’s own internal one, which is the choice Lab 6 gives you. Why it is needed is what we work out in class, with the oscilloscope on that output.
