Rotary Encoder



A rotary encoder is an electromechanical switch used as an angular position sensor. Its output is usually a digital encoding of relative or absolute position, although there are some rotary encoders with sinusoidal outputs. Typically, the rotary encoder is coupled with a microprocessor and can be found in industrial applications (motor control) and various human-computer input devices (computer mouse).

Types of Rotary Encoder

Rotary encoders come in two main flavors: absolute or incremental.

Absolute rotary encoder

The absolute rotary encoder determines absolute angular position. Every position of the encoder is unique, thus the position will not be lost if the coupled microcontroller fails. Additionally, multi-turn absolute rotary encoders count for each full cycle as opposed to dividing a single rotation. The resolution of either type of absolute rotary encoder is determined by the number of bits at the output. For example, an 8-bit single-turn absolute rotary encoder will have 256 unique positions per revolution. To avoid race conditions at the interfacing digital logic, the output is typically implemented with Gray encoding.

Compared to incremental rotary encoders, absolute rotary encoders are more expensive and require a greater bandwidth of communication with the microcontroller. However, systems incorporating absolute rotary encoders do not require re-initialization should the position be lost due to a power failure.

Incremental rotary encoder

The incremental rotary encoder (also known as a relative rotary encoder) is used to measure the change in angular position. The bandwidth requirements are much lower when compared with absolute rotary encoders, since they are only used to determine direction and change in angle. This is accomplished with two digital outputs in quadrature. To determine the direction of rotation, the relative phase between the quadrature outputs needs to be determined. One particular method to do this is to check the value of the first quadrature output at every occurring edge of the second quadrature output. If the first signal is high when a rising edge is detected, then we know that the first signal is leading by a quarter period. Simlarly, motion in the opposite direction is detected when the first signal is low when a rising edge is detected on the second output.

Relative rotary encoders often have additional outputs, such as inverted quadrature outputs and a command pulse (a logical XOR of the quadrature outputs).

Other variations

The output waveforms generated mechanically, optically, or magnetically.

Mechanical encoding is performed by rotating an etched disk past a pair of contacts. Optical encoding is more robust than mechanical and replaces the contacts with LEDs and phototransistors. By eliminating the need for mechanical contact with the etched disk, much higher resolutions are achievable with optical encoding. Finally, magnetic encoding eliminates the need for an internally housed shaft and sensor, therefore they are not prone to wear and tear of the seals or bearings. Instead, the magnet(s) are attached directly to the shaft and are rotated past the magnetic sensor(s). Typically, the sensors rely on either the Hall effect or variable reluctance.

Rotary encoders can also come with detented position. These are typically found as dials on human-computer interfaces such as digital mixing consoles.


Rotary encoders are differentiated by their environmental sealing, axial and radial force ratings, maximum rotational speed, pulses per revolution, and output logic type (CMOS, TTL, etc.). Please see the device section below for specifications of typical rotary encoders.


For absolute encoders, the output is an n-bit Gray code. Relative encoders, at the very least require a pair of outputs in quadrature. Interfacing rotary encoders to a microcontroller is usually trivial and requires voltage-dividers and/or buffer circuits at most. When using a high resolution rotary encoder, it is important to ensure that the buffering circuitry and microcontroller interrupt inputs can resolve the pulses at the fastest speed required by the application.


Sources FRABA
Description Absolute magnetic and optical rotary encoders, magnetic encoder without battery backup.
Datasheet datasheet
Renishaw RM22
Sources Renishaw
Description Compact, high-speed rotary magnetic encoder.
Datasheet pdf
BEI Technologies Inc. HMT25
Sources BEI
Description Absolute, multi-turn optical encoder.
Datasheet pdf
AMCI DuraCoder
Sources AMCI
Description Incremental, optical encoder with field-programmable output resolution.
Datasheet pdf