- All products
- Sensors & Modules
- Rotary Encoder Module RobotDYN
- Sensors & Modules
Features
- 24 steps per revolution (24 PPR)
- Full 360° continuous rotation
- Built-in push-button switch (SW pin)
- 5V operating voltage
- Quadrature output (2-bit Gray code)
- Onboard power indicator LED
Specifications
- Operating Voltage: 5V DC
- Mechanical Angle: 360° continuous
- Positions per Revolution: 24
- Output Signal: 2-bit Gray code (CLK and DT)
- Integrated Push Button: Yes (SW)
Working Principle
Inside the encoder, a slotted disc connects to the common ground (C). Two output pins (A and B) generate signals as the shaft rotates.
The signals from pins A and B are 90° out of phase (quadrature encoding). The order in which these signals change determines the direction of rotation:
- If B ≠ A when A changes → Clockwise rotation
- If B = A when A changes → Counterclockwise rotation
By monitoring these transitions, a microcontroller can determine both direction and position increment/decrement.
Pinout

| Pin | Description |
|---|---|
| CLK | Encoder Output A |
| DT | Encoder Output B |
| SW | Push Button Switch |
| VCC | +5V Power Input |
| GND | Ground (Common C) |
Applications
- Robotic arm control
- Servo and stepper motor positioning
- Menu navigation systems
- CNC machines
- Volume and parameter adjustment interfaces
Arduino Connection Example
- VCC → 5V
- GND → GND
- CLK → Pin 6
- DT → Pin 7
- SW → Optional digital pin
Arduino Example Code
#define outputA 6
#define outputB 7
int counter = 0;
int aState;
int aLastState;
void setup() {
pinMode(outputA, INPUT);
pinMode(outputB, INPUT);
Serial.begin(9600);
aLastState = digitalRead(outputA);
}
void loop() {
aState = digitalRead(outputA);
if (aState != aLastState) {
if (digitalRead(outputB) != aState) {
counter++;
} else {
counter--;
}
Serial.print("Position: ");
Serial.println(counter);
}
aLastState = aState;
}
Library
No external library is required. The module works using standard Arduino digitalRead() functions to detect quadrature signals.
Comparison with Potentiometer
Unlike potentiometers, which have a limited rotation angle (typically 270°) and provide absolute position, rotary encoders rotate endlessly and detect relative movement. This makes them ideal for increment/decrement control applications rather than fixed position measurement.
Features
- 24 steps per revolution (24 PPR)
- Full 360° continuous rotation
- Built-in push-button switch (SW pin)
- 5V operating voltage
- Quadrature output (2-bit Gray code)
- Onboard power indicator LED
Specifications
- Operating Voltage: 5V DC
- Mechanical Angle: 360° continuous
- Positions per Revolution: 24
- Output Signal: 2-bit Gray code (CLK and DT)
- Integrated Push Button: Yes (SW)
Working Principle
Inside the encoder, a slotted disc connects to the common ground (C). Two output pins (A and B) generate signals as the shaft rotates.
The signals from pins A and B are 90° out of phase (quadrature encoding). The order in which these signals change determines the direction of rotation:
- If B ≠ A when A changes → Clockwise rotation
- If B = A when A changes → Counterclockwise rotation
By monitoring these transitions, a microcontroller can determine both direction and position increment/decrement.
Pinout

| Pin | Description |
|---|---|
| CLK | Encoder Output A |
| DT | Encoder Output B |
| SW | Push Button Switch |
| VCC | +5V Power Input |
| GND | Ground (Common C) |
Applications
- Robotic arm control
- Servo and stepper motor positioning
- Menu navigation systems
- CNC machines
- Volume and parameter adjustment interfaces
Arduino Connection Example
- VCC → 5V
- GND → GND
- CLK → Pin 6
- DT → Pin 7
- SW → Optional digital pin
Arduino Example Code
#define outputA 6
#define outputB 7
int counter = 0;
int aState;
int aLastState;
void setup() {
pinMode(outputA, INPUT);
pinMode(outputB, INPUT);
Serial.begin(9600);
aLastState = digitalRead(outputA);
}
void loop() {
aState = digitalRead(outputA);
if (aState != aLastState) {
if (digitalRead(outputB) != aState) {
counter++;
} else {
counter--;
}
Serial.print("Position: ");
Serial.println(counter);
}
aLastState = aState;
}
Library
No external library is required. The module works using standard Arduino digitalRead() functions to detect quadrature signals.
Comparison with Potentiometer
Unlike potentiometers, which have a limited rotation angle (typically 270°) and provide absolute position, rotary encoders rotate endlessly and detect relative movement. This makes them ideal for increment/decrement control applications rather than fixed position measurement.

