1. Introduction to Encoders
An encoder is an electrical mechanical device that converts linear or rotary displacement into digital or pulse signals. The most popular type of encoder is the optical encoder, which consists of a rotating disk, a light source, and a photodetector (light sensor). The disk, which is mounted on the rotating shaft, has patterns of opaque and transparent sectors coded into the disk (see Figure 1). As the disk rotates, these patterns interrupt the light emitted onto the photodetector, generating a digital or pulse signal output.

Figure 1. Optical Encoder
Counter/Timer Boards
NI 6601
NI 6602
NI 6608
NI 6624
3. Technical Overview
There are two general types of encoders - absolute and incremental encoders.
Absolute Encoder: An absolute encoder generates a unique word pattern for every position of the shaft. The tracks of the absolute encoder disk, generally four to six, commonly are coded to generate binary code, binary-coded decimal (BCD), or gray code outputs. Absolute encoders are most commonly used in applications where the device will be inactive for long periods of time, there is risk of power down, or the starting position is unknown.
Incremental Encoders: An incremental encoder generates a pulse, as opposed to an entire digital word, for each incremental step. Although the incremental encoder does not output absolute position, it does provide more resolution at a lower price. For example, an incremental encoder with a single code track, referred to as a tachometer encoder, generates a pulse signal whose frequency indicates the velocity of displacement. However, the output of the single-channel encoder does not indicate direction. To determine direction, a two-channel, or quadrature, encoder uses two detectors and two code tracks.
The most common type of incremental encoder uses two output channels (A and B) to sense position. Using two code tracks with sectors positioned 90° out of phase (Figure 2), the two output channels of the quadrature encoder indicate both position and direction of rotation. If A leads B, for example, the disk is rotating in a clockwise direction. If B leads A, then the disk is rotating in a counter-clockwise direction. Therefore, by monitoring both the number of pulses and the relative phase of signals A and B, you can track both the position and direction of rotation.
In addition, some quadrature detectors include a third output channel, called a zero or reference signal, which supplies a single pulse per revolution. This single pulse can be used for precise determination of a reference position.

Figure 2. Quadrature Encoder Output Channels A and B
