Revision as of 11:19, 21 June 2006
An infrared slotted optical switch is a device similar to the photo-reflector except that the emitter is pointed directly into the phototransistor. The slotted optical switch can be used to build shaft encoders. Shaft encoders can give the robot feedback on how far its wheels have turned or on synchronizing two wheels' velocity. A shaft encoder usually consists of a slotted optical switch and a striped wheel with a palette of radically alternating holes or slots on it. The palette of stripes will alternately reflect or not reflect light to the phototransistor, yielding a pulse-train output. The robot can then tell how far its wheels have rotated by counting the pulses.
The wiring for the slotted optical switch is straightforward. The white dot on the optical switch corresponds to pin 2 in the pinout diagram and you can figure out the pins using the pinout diagram shown above. The emitter LED is powered by te Handy Board's +5V supply, with a 330 ohm resistor in series to limit the current through the LED to an appropriate value. In fact, there is a pull-up resistor of 4.7K ohm built in the Handy Board and it is not shown in the diagram. Different varieties of phototransistor, however, may perform better with a smaller resistor value than the on-board 47K resistor. If the sensitivity of the device is poor, you can try connecting the signal line to the power supply through another resistor to determine the best response.