Revision as of 17:07, 6 July 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 a +5V supply, with a 330 ohm resistor in series to limit the current through the LED to an appropriate value. Make sure and add the pull-up resistor if using the PC/104 stack. Different varieties of phototransistor, however, may perform better with other size pull-up resistors. 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.