A device used on turning shafts to measure the rate of rotation. There are two types: absolute and incremental encoders.

An incremental encoder is a metal disc covered with many small slots. The slots are aligned with two LED-phototransistor paris in a staggered way, so that when a slot alignment sends one transistor low, the other one is always in the middle of its duty cycle. Thus, by triggering your count off of the leading edge of one signal, you can measure the other signal, and count up if the value is high, and down in the value is low.

An absolute encoder uses a number of LED-phototransistor pairs, in a radial line. A very funky-looking disc is used: it has one huge arc-shaped hole, closest to the center, then two arcs further out, four arcs at the next level, etc. In this way, you can get an absolute measure of the angle of your shaft, no matter where you start. It sounds cool, but the drawbacks are:

  1. The disc costs a lot more.
  2. It's usually only good for about 5 or 6 rows of this, meaning that it is not as precise as an incremental encoder, which can give thousands of cycles per revolution.
  3. You need many more leads on your chip for the LEDs.