An optical encoder converts physical motion into electrical signals by shining light through a patterned disc and measuring what gets through. It’s one of the most common ways machines track position, speed, and direction of rotation, found in everything from computer mice and inkjet printers to CNC machines and robotic arms. The core idea is simple: as something moves, it interrupts a beam of light in a predictable pattern, and electronics translate those light pulses into precise position data.
The Three Core Components
Every optical encoder has the same basic architecture: a light source, a patterned disc, and a light detector. The light source is typically an inexpensive infrared LED, though some encoders use colored LEDs with shorter wavelengths to reduce light scatter and improve precision. The disc, called a code wheel, has a series of tiny slits or transparent windows arranged in a ring around its circumference. As the disc rotates, these slits alternately pass and block the LED’s light beam.
On the other side of the disc sits a photosensor, usually a photodiode or phototransistor made from silicon or similar semiconductor material. When light passes through a slit, the sensor generates a small electrical current. When the opaque section between slits blocks the light, the current drops. The result is a clean on/off pulse train that directly corresponds to the disc’s rotation. Count the pulses, and you know how far the shaft has turned. Count how fast they arrive, and you know the speed.
Two Light Path Designs
Optical encoders use one of two arrangements to create their signal. In a transmissive design, the LED sits on one side of the code wheel and the detector sits on the other. Collimated light passes perpendicularly through alternating transparent windows and opaque bars, producing strong optical contrast. This is the more traditional and widely used layout.
Reflective encoders place the LED and detector on the same side of the disc. Instead of slits, the code wheel has alternating reflective and non-reflective patterns. Light bounces off the reflective sections and back to the detector, while non-reflective sections absorb or scatter it. Reflective designs can be more compact since all the electronics sit on one side, but they demand high-quality reflective surfaces and careful alignment to achieve the same signal clarity as transmissive encoders.
Incremental Encoders: Tracking Motion Step by Step
The most common type is the incremental encoder, which outputs a stream of pulses as the shaft turns. A basic version with a single sensor channel can tell you speed and distance but not direction. To solve that, most incremental encoders add a second channel.
The two channels, called Phase A and Phase B, use two separate code tracks (or two offset sensors reading the same track) positioned so their signals are shifted 90 degrees out of phase with each other. This arrangement is called quadrature encoding, and it’s what makes direction detection possible. When the shaft rotates clockwise, Phase A’s pulses lead Phase B’s pulses. Reverse the direction, and Phase B leads Phase A. A controller reading both channels can determine not only how far the shaft has moved but which way it’s going.
This 90-degree phase shift also multiplies the encoder’s effective resolution. A disc with 1,000 physical slits (rated at 1,000 pulses per revolution, or PPR) produces 1,000 rising and falling edges on each channel. Since the two channels are offset, a controller counting every edge transition gets four distinct states per slit, yielding 4,000 measurable positions per revolution from a 1,000 PPR disc.
The Index Channel
Many incremental encoders include a third output called the index channel (also labeled Z or Home). This channel produces a single pulse at exactly one point in the disc’s full rotation. Its purpose is to give the system a known reference position. After a power outage, for example, an incremental encoder has no idea where the shaft stopped because every set of slits looks identical. With an index channel, the system can rotate until it finds that single index pulse, re-establishing its exact location. This “homing” move is a standard startup routine in many CNC and robotic systems.
Absolute Encoders: Always Knowing Position
An absolute encoder takes a fundamentally different approach. Instead of one ring of identical slits, its code wheel has multiple concentric tracks, each with a unique pattern of opaque and transparent sections. Each track corresponds to one bit of a binary code, and each angular position on the disc produces a unique combination of light and dark across all the tracks. A separate photosensor reads each track simultaneously.
The result is that every position on the disc has its own binary “address.” The encoder always knows exactly where it is, even immediately after power is restored, with no homing move required. A 10-bit absolute encoder, for example, has 10 concentric tracks and can distinguish 1,024 unique positions per revolution.
One important design detail: most absolute encoders use a numbering system called Gray code rather than standard binary. In regular binary, moving from one position to the next can require several bits to change simultaneously (going from 7 to 8, for instance, flips four bits at once). If the disc is right on the boundary between two positions and some bits change a fraction of a second before others, the encoder could briefly read a wildly incorrect value. Gray code is designed so that only one bit changes between any two adjacent positions, which limits the worst-case error to a single step in either direction.
Resolution and Precision
An encoder’s resolution is determined by how many slits or patterns fit on the disc. For incremental encoders, this is expressed in PPR. Common industrial encoders range from a few hundred PPR for simple speed sensing up to thousands of PPR for precision motion control. A 2,000 PPR encoder has twice the angular resolution of a 1,000 PPR model, meaning it can detect movement half as small. With quadrature decoding multiplying that by four, a 2,000 PPR encoder yields 8,000 distinguishable positions per revolution, or one count every 0.045 degrees.
For absolute encoders, resolution is described in bits. Each additional bit doubles the number of unique positions: 8 bits gives 256 positions, 10 bits gives 1,024, and so on. Higher resolution requires finer patterns on the disc and more precise optics, which is why high-resolution optical encoders cost more and are physically larger than low-resolution models.
How the Signal Reaches Your Controller
The raw signal from the photosensor needs to be conditioned into a clean digital output before a controller can use it. Encoders typically offer one of three output types, and the choice affects wiring, speed, and noise tolerance.
- Open-collector outputs are the most common. The encoder can pull the signal line low but relies on an external resistor to pull it high. This makes them flexible since you can match the voltage to whatever system you’re connecting to. The tradeoff is that the pull-up resistor slows down signal transitions, which can limit performance at high speeds or high resolutions. Stronger pull-up resistors (lower resistance) speed things up but draw more current.
- Push-pull outputs use two transistors to actively drive the signal both high and low, producing faster, crisper transitions without external resistors. They also consume less power since there’s no resistor constantly dissipating energy, making them a better fit for battery-powered applications.
- Differential line driver outputs send each signal as a pair of complementary voltages. The receiving end compares the two lines to each other rather than referencing ground, which makes the signal highly resistant to electrical noise picked up along the cable. This is the preferred choice for cable runs longer than about a meter or in environments with significant electromagnetic interference.
Where Optical Encoders Struggle
Optical encoders depend on a clean light path, and that makes them vulnerable to contamination. Dust, dirt, grease, or moisture on the code wheel or sensor can scatter or block the light beam, causing missed pulses or false readings. In factory settings with oil mist, sawdust, or heavy vibration, optical encoders need sealed housings and regular maintenance to stay accurate. Rapid temperature swings can also affect performance by causing thermal expansion in the disc or shifting the alignment of optical components.
In harsh or dirty environments where resolution demands are moderate, magnetic encoders (which sense the position of magnetized poles rather than light pulses) are often a more durable alternative. They’re largely immune to dust, oil, moisture, and vibration. Optical encoders earn their place in cleaner settings where their superior resolution and precision justify the extra environmental sensitivity.

