Contents

Incremental rotary encoder article cover

Incremental Rotary Encoder: Full Knowledge You Need To Know

In the wave of digitalization and automation, incremental rotary encoders play a pivotal role. This article will delve into the principles, types, and real-life application scenarios of incremental encoders to help you better understand this important technology.

Incremental rotary encoder

Table of Contents

What is an incremental rotary encoder?

Incremental rotary encoders are sensors that can convert the rotational speed, direction of movement, and displacement of rotating or linear moving objects into pulse signals that can be transmitted and stored.

Incremental rotary encoder working principle

The incremental encoder working  principle is to count the received signal of the optical or magnetic detection head according to the stripes or gaps on the disk, thereby measuring the distance and direction of rotation or displacement. When the encoder disk rotates, the optical detection head will generate pulse signals as the stripes or gaps move. Each pulse represents a certain angle of rotation of the encoder disk. Incremental encoders generally have two output signals, namely A-phase and B-phase signals. By counting the A-phase and B-phase signals and measuring the phase difference, the rotation angle or linear displacement distance of the measured object can be calculated.

Incremental rotary encoders types

According to the working principle differences, there are 3 types of incremental rotary encoders, they are  magnetic, optical and mechanical encoder. Here below the descriptions of each type of them:

Incremental magnetic rotary encoder

Incremental magnetic rotary encoder

Magnetic incremental encoder: Magnetic incremental encoder uses magnetic lines of force to generate pulse signals. On the rotating encoder wheel, the alternating changes in the magnetic field lines are detected and converted into pulse signals.

Compared with traditional incremental optical encoders, incremental magnetic encoders do not require a code disk and a light source, have fewer components, and have a simpler detection structure; at the same time, the hall element itself also has many advantages, such as: solid structure, Small size, light weight, long life, vibration resistance, and not afraid of pollution or corrosion from dust, oil, water vapor, salt spray, etc.

Incremental optical rotary encoder

Structure of a rotary encoder

Optical incremental encoder: This encoder uses optical principles to generate pulse signals. Light passes through a grating on a rotating encoder wheel, creating alternating light and dark areas, thereby generating a pulse signal.

Incremental mechanical rotary encoder

Mechanical incremental encoder: Mechanical incremental encoder uses mechanical contact to generate pulse signals. When the encoder body rotates, the contact points slide on the metal conductive sheet, thereby generating a pulse signal.

Incremental rotary encoder arduino code

An ABZ incremental rotary encoder provides three channels: A, B, and Z (also known as the index channel). The A and B channels are used for determining position and direction, just like in a standard AB encoder. The Z channel provides a single pulse per revolution and is often used for a “home” or “zero” position.

Here’s a simple Arduino code snippet for reading an ABZ incremental rotary encoder:

// Define encoder pin connections & initial values
const int encoderPinA = 2;

// Connected to A channel pin on encoder
const int encoderPinB = 3;

// Connected to B channel pin on encoder
const int encoderPinZ = 4; // Connected to Z channel pin on encoder (Index)
volatile int encoderPos = 0; // Position counter
int lastReportedPos = 0; // Last reported position
int aState;
int aLastState;

void setup() {
// Setup Serial Monitor
Serial.begin(9600);

// Configure encoder pins as inputs
pinMode(encoderPinA, INPUT_PULLUP);
pinMode(encoderPinB, INPUT_PULLUP);
pinMode(encoderPinZ, INPUT_PULLUP);

// Read the initial state of encoderPinA
aLastState = digitalRead(encoderPinA);

// Attach interrupts
attachInterrupt(digitalPinToInterrupt(encoderPinA), readEncoder, CHANGE);
attachInterrupt(digitalPinToInterrupt(encoderPinZ), resetEncoder, RISING);
}

void loop() {
// Check if position has changed since last reported
if (lastReportedPos != encoderPos) {
Serial.print(“Position: “);
Serial.println(encoderPos);
lastReportedPos = encoderPos;
}
}

// Interrupt function for reading encoder A and B channels
void readEncoder() {
aState = digitalRead(encoderPinA); // Reads the “current” state of the encoderPinA
// If the previous and the current state of the encoderPinA are different, that means a Pulse has occurred
if (aState != aLastState) {
// If the B channel state is different to the A channel state, that means the encoder is rotating clockwise
if (digitalRead(encoderPinB) != aState) {
encoderPos++;
} else {
encoderPos–;
}
Serial.print(“Position = “);
Serial.println(encoderPos);
}
aLastState = aState; // Updates the previous state of the encoder with the current state
}

// Interrupt function for reading encoder Z channel (Index)
void resetEncoder() {
encoderPos = 0; // Reset the encoder position to zero
Serial.println(“Index detected, position reset to zero”);
}

How to use this Arduino code

  1. Connect the A, B, and Z channels of your ABZ incremental rotary encoder to pins 2, 3, and 4 on your Arduino, respectively.
  2. Upload the code to your Arduino.
  3. Open the Serial Monitor to view the encoder position and index resets

Incremental vs absolute rotary encoder

There are 14 differences between an incremental and absolute rotary encoder, the below tables will show all the differences between them:

FeatureIncremental Rotary EncoderAbsolute Rotary Encoder
Position InformationRelative to last position Absolute position
Output SignalPulsesUnique code for each position
Power Loss Loses positionRetains position
Initial CalibrationRequired each time powered onNot required
CostGenerally cheaperMore expensive
ComplexitySimplerMore complex
ResolutionLowerHigher
Data OutputAnalog or digitalDigital only
SpeedFaster readoutSlower due to data processing
ApplicationsSpeed control, distance measuringRobotics, CNC machines
Memory RequirementLowerHigher
FeedbackQuadrature (A, B channels)Binary or Gray code
Sensitivity to Electrical NoiseMore sensitiveLess sensitive
Multi-turn CapabilityNoYes (some models)

Applications of incremental encoders

Incremental rotary encoder applications

Automated production lines: In automated production lines, incremental encoders are used to measure and control the position of machines. For example, on an assembly line, encoders can precisely control the position of components to ensure correct assembly.

Robotics: Incremental encoders play an important role in robotics, providing accurate motion feedback so that robots can precisely control their own movements.

Servo Motor Control: Servo motors require precise position feedback for precise control. Incremental encoders are a key component in providing this feedback,

Conclusion

Incremental encoders are an important part of modern industrial and automation applications. By in-depth understanding of the principles, types and applications of incremental encoders, we can better understand their important role in various industrial automation scenarios. Although there are some challenges, with the continuous advancement of technology, we have reason to believe that incremental encoders will play a greater role in the future and promote progress in the field of industrial automation. Hopefully this article has helped you gain a deeper understanding of incremental encoders and piqued your interest in this important technology.

Picture of Shon Xu

Shon Xu

"Hi, I am the author of this article and the owner of Lorentzzi. I have nearly 10 years of experience in selling industrial automation products, specializing in B2B services. If you have quetions, feel free to ask me!"

Contact us now:

Share it to:

Keep learning

10 Differences Between A Contactor And A Relay

Today we will talk 10 differences between a contactor and relay. Contactors and relays are two common electrical control devices. Their differences are mainly reflected in appearance, structure, function, application scenarios, etc., as follows: Table of Contents 1. Appearance difference between a contactor and relay Contactors are usually larger than

Read More
M24 inductive proximity switch-4
Two-Wire Inductive Proximity Sensor: A Comprehensive Overview

Contents Overview Inductive proximity sensors are indispensable tools in various industries, such as automation, automotive, and manufacturing, due to their ability to detect the presence of metallic objects without physical contact. Among the different types of these sensors, two-wire inductive proximity sensors are particularly popular for their simplicity and ease

Read More
Solid State Relay Working Principle

Contents Overview Although there are many models and specifications of solid state relays on the market, the working principles of solid state relays are basically similar. It is mainly composed of three parts: input (control) circuit, drive circuit and output (load) circuit. The working principle of the solid state relay

Read More
Shopping Cart
Lorentzzi logo-China temperature controller, SSR, rotary encoder manufacturer