Rotary Encoder

Rotary encoders are sensors used in embedded systems to measure a rotating shaft's rotation, position, or angular movement. They convert a shaft's angular position or motion into digital or analog output signals, which microcontrollers or embedded systems can process. Rotary encoders are widely used in applications where precise control of position, direction, or speed is essential, such as robotics, motor control, industrial automation, and consumer electronics.

There are two main types of rotary encoders: incremental and absolute.

  1. Incremental Encoders: These generate pulses as the shaft rotates, allowing the system to detect the relative position and speed. However, they don't track the exact position and need a reference point for full positional awareness.
  2. Absolute Encoders: These encoders provide a unique position value for each rotation angle, enabling accurate position tracking without needing a reference point.

Most rotary encoders consist of an optical or magnetic disc attached to a shaft and a sensor that detects changes in the disc pattern as the shaft rotates. The output from a rotary encoder is often a series of pulses, which embedded systems use to determine speed, direction, and position by counting and interpreting these signals.

Incremental Encoders

Incremental Encoders

Incremental Encoder 1 Incremental Encoder 2

An incremental encoder is a rotary encoder that generates a series of pulses as the shaft rotates. It does not give an absolute position but provides information about the movement direction and speed by counting pulses. Incremental encoders are widely used in applications like motor control, where relative positioning or speed is essential.

Key Components of an Incremental Encoder

  • Disk: A rotating disk with alternating transparent and opaque sectors.
  • LED or Light Source: Illuminates the disk.
  • Photodetector: Detects light patterns through the disk and generates pulses.
  • Metal Ring with Contact Points: In some designs, a metal ring with tabs or protrusions makes contact with internal conductive segments to produce pulses mechanically.

Working Principle

As the shaft rotates, the photodetector senses light through the disk's alternating sectors, or in mechanical designs, the metal ring’s tabs make and break contact with the internal contact points. This pattern is converted into a square wave, creating pulses representing shaft movement.

  • Channels (A and B): Incremental encoders often have two output channels, A and B. These channels produce square waves with a 90° phase difference (quadrature output). This phase shift allows the determination of both speed and direction of rotation.
  • Index Pulse (Z): Some encoders include an index pulse (Z channel) that generates a single pulse per revolution, serving as a reference position.

Determining Direction

By reading both Channel A and Channel B, the direction of rotation can be determined:

  • Clockwise (CW): Channel A leads Channel B.
  • Counter-Clockwise (CCW): Channel B leads Channel A.

How to Detect the Rotation Speed of an Incremental Encoder

Detecting the rotation speed of an incremental encoder involves measuring the frequency or time between pulses generated by the encoder’s output channels (Channel A and/or Channel B). Here are common methods used to calculate rotation speed:

  1. Pulse Counting with a Fixed Time Interval
    • In this method, the system counts the number of pulses the encoder generates within a fixed time interval.
    • For example, suppose the encoder produces 100 pulses in one second, and each pulse represents a fixed angular movement. In that case, the speed can be calculated by multiplying the number of pulses by the angular movement per pulse.
    • This method works well for steady speeds but may not capture rapid speed changes accurately.

    Formula: \(Speed\, (in\, degrees/\sec ) = {{Number\, of\, Pulses \times Degree\, per\, Pulse} \over {Time\, Interval}}\)

  2. Time Measurement between Pulses
    • Another approach is to measure the time interval (in microseconds or milliseconds) between consecutive pulses on a single channel (e.g., Channel A).
    • This interval can be inversely proportional to the speed. The shorter the interval between pulses, the higher the speed.
    • This method is especially useful for detecting changes in speed in real time.

    Formula: \(Speed\, (in\, RPM) = {{60 \times Pulse\, per\, Revolution} \over {Time\, between\, Pulse}}\)

  3. Using Quadrature Signals for Higher Precision
    1. Since incremental encoders generate two channels (A and B) with a 90° phase difference, they can provide higher resolution when both channels are read. Each transition (rising and falling edges) can be treated as an individual pulse.
    2. By counting all transitions in both channels, you effectively quadruple the pulse count per revolution, which allows for more precise speed calculations.

© 2024 Air Supply Information Center (Air Supply BBS)