What is Incremental Encoder : Working & Its Applications

A rotary encoder or shaft encoder is an electro-mechanical device used to change the shaft’s motion, the angular position. These encoders are available in two types absolute & incremental. The absolute encoder output indicates the current position of the shaft whereas an incremental encoder output provides the data regarding the motion of the shaft which can be data related to speed, distance, and position. Rotary encoders are mainly used where monitoring and controlling are required in mechanical systems and input devices of computers. So, this article discusses one of the types of rotary encoders namely incremental encoder, and its working with applications.


What is Incremental Encoder?

An encoder that is used to convert the position or angular motion of a shaft into an analog code or digital code to recognize motion or position is known as an incremental encoder. These types of encoders are the most frequently used rotary encoders. These encoders are mainly used in positioning & motor speed feedback-based applications like industrial, light or servo, heavy-duty, etc.

Incremental Encoder
Incremental Encoder

The incremental encoder working principle is, that it works by changing the shaft’s angular position into a pulse or digital signal through an optical disk. For every revolution, numbers of pulses are generated where every pulse is an increment related to the defined resolution.

Incremental Encoder Specifications

The specifications of the incremental encoder include the following.

  • Operating voltage ranges from 5V to 24V.
  • Pulse is 500 P/R.
  • The output waveform is a Square wave.
  • Slew speed is 6000 RPM.
  • The diameter of the shaft is 4mm.
  • Body diameter is 25mm.

Incremental Encoder Types

There are different Incremental encoder output types. While selecting this encoder, you should decide which kind of output is necessary to be well-matched with the application device that will be using the encoder signals. Selecting the incorrect output type will affect a non-functional system & hardware may get damaged.  So, here we are explaining three output types of incremental decoder like TTL, HTL & Open collector.

HTL (Push-pull)

The term “HTL” stands for “High Transistor Logic”. These circuits can be designed with two transistors within a Totem design to produce the output channels to make sure the signal is low or high. The voltage supply of these circuits normally ranges from 8V to 30 VDC. The level of the output voltage of this circuit is equal to the applied voltage once switched ON. Similarly, the signal will be pulled to deliver once switched OFF.

HTL (Push-pull)
HTL (Push-pull)

This output type circuit is used where the PLC, motion controller otherwise other receiving device needs 12V or 24V level signals.

RS422 (TTL)

RS422 circuits provide a stable 5V signal that is not reliant on the voltage supply. TTL (transistor-transistor logic) offers an RS422 output signal, which will be +5VDC. For any input voltage, you will obtain the output like either 0V in a low condition, otherwise 5V in a high condition.

RS422 (TTL)
RS422 (TTL)

The differential outputs of RS422 will provide outstanding noise immunity, fast signal response, and the capacity to utilize long cable lengths. The voltage supply on different models of encoder ranges from 4.5 to 5.5VDC or 10V to 30VDC.

Open Collector NPN

This output type is a sinking output through a floating signal level once the output is deactivated and the signal is pulled low when activated. This circuit design is simple, so used in short cable lengths-based applications. An open collector is normally more vulnerable to electrical noise as compared to HTL or TTL.

Open Collector NPN
Open Collector NPN

Incremental Encoder Circuit Diagram

Incremental encoders are used as inputs in Arduino-based circuits. These can be used to increase or decrease the variable values for different tasks like motor speed controlling or controlling the LED brightness. Here the rotary encoder module used for Arduino is KY-040. The pin configuration of this module includes five pins which are discussed below.

KY-040 Pin Out
KY-040 Pin Out
  • GND is a Ground connection.
  • VCC is a 5V supply or 3.3V supply.
  • SW is an output of a push-button switch (0V when pushed and 5V while resting.
  • DT is a data output.
  • CLK is a Clock output.

An incremental encoder wiring diagram is shown below.

Incremental Encoder Interfacing with Arduino
Incremental Encoder Interfacing with Arduino

In this incremental encoder wiring circuit, the incremental encoder is simply connected to an Arduino UNO board. The SW pin of this module can be directly connected to pin 4 of Arduino, CLK pin to pin 2 & DT pin is connected to pin -3 of the Arduino board. VCC of this module is directly connected to +5V & the GND pin of this module is connected to the Arduino’s GND pin as shown below.

Once the knob of the incremental encoder is turned, the Arduino program will detect the change within the CLK line. After that, it verifies the condition of the DT pin.

If both are similar, it means the encoder was rotted in the CLK-wise direction, otherwise, it was rotated counterclockwise. For every detection in the meantime, the value of the variable counter can also be increased or decreased based on the direction.

Example Program for Arduino Interface with Incremental Encoder

The below program for the button condition of the rotary encoder. If the button is pressed, then the program will print as ‘button pressed’ onto the monitor and also prints the present value of the number of counted pulses.

// Rotary Encoder Inputs
#define CLK 2
#define DT 3
#define SW 4

int counter = 0;
int currentStateCLK;
int lastStateCLK;
String currentDir =””;

unsigned long lastButtonPress = 0;

void setup() {

// Set encoder pins as inputs
pinMode(CLK,INPUT);
pinMode(DT,INPUT);
pinMode(SW, INPUT_PULLUP);

// Setup Serial Monitor
Serial.begin(9600);

// Read the initial state of CLK
lastStateCLK = digitalRead(CLK);

}

void loop() {

// Read the current state of CLK
currentStateCLK = digitalRead(CLK);

// If last and current state of CLK are different, then pulse occurred
// React to only 1 state change to avoid double count
if (currentStateCLK != lastStateCLK && currentStateCLK == 1){

// If the DT state is different than the CLK state then
// the encoder is rotating CCW so decrement
if (digitalRead(DT) != currentStateCLK) {
counter –;
currentDir =”CCW”;
} else {

// Encoder is rotating CW so increment
counter ++;
currentDir =”CW”;
}

Serial.print(“Direction: “);
Serial.print(currentDir);
Serial.print(” | Counter: “);
Serial.println(counter);
}

// Remember last CLK state
lastStateCLK = currentStateCLK;

// Read the button state
int btnState = digitalRead(SW);

//If we detect LOW signal, button is pressed
if (btnState == LOW) {
//if 50ms have passed since last LOW pulse, it means that the
//button has been pressed, released and pressed again
if (millis() – lastButtonPress > 50) {
Serial.println(“Button pressed!”);
}

// Remember last button press event
lastButtonPress = millis();

}

// Put in a slight delay to help debounce the reading
delay(1);

}

Incremental Encoder vs Absolute Encoder

The difference between incremental encoder and absolute encoder includes the following.

Incremental Encoder Absolute Encoder
It is one type of rotary encoder. It is also one type of rotary encoder.
These encoders are used to measure speed, position, and distance but this encoder cannot keep the last measured position. These encoders are used to measure angular position but this encoder can keep the last measured position.
This encoder needs power throughout its operation. This encoder needs power while taking reading only.
Less cost as compared to the absolute encoder. High cost as compared to the incremental encoder.
It is less complex as compared to an absolute encoder. It is not less complex.
The battery is not required. A battery is required.

How to Choose an Incremental Encoder?

While selecting an incremental encoder for a specific application, there are several factors that need to consider like the following,

  • Outer diameter.
  • Type of shaft & diameter.
  • Outlet way &cable length.
  • Voltage supply.
  • Type of output signal.
  • Pulse count.
  • Output technique of signal.

Advantages & Disadvantages

The advantages of incremental encoder include the following.

  • Very simple to manufacture.
  • It determines direction, speed.
  • Less cost.
  • Simple hardware.
  • Simple to use.
  • Speed control.
  • Scaling functionality is flexible.
  • It is very simple to handle because it is compatible with another designer’s incremental encoder.

The disadvantages of incremental encoder include the following.

  • All marks in a raw are the same.
  • Need to set a reference point.
  • Results will be lost without an electrical supply.

Applications

The applications of incremental encoder include the following.

  • These encoders are normally used to calculate the mechanical systems speed for monitoring purposes otherwise to give feedback for controlling motion or both.
  • These encoders are mainly used to compute angular position within a broad range of industries & applications like automation, machine tool, printing, packaging, etc.
  • It is used in motor drive-based applications.
  • These encoders change the angular position or motion of a shaft into an analog code or digital code to recognize motion or position.

Thus, this is all about an overview of an incremental encoder and its working. The electrical characteristics of these encoders are: supply voltage, current consumption, output voltage, fall & rise time, and frequency response. Here is a question for you, how do you read an incremental encoder?