

The Rotary Encoder (Arduino ABX00107) is an electromechanical device designed to convert the angular position or motion of a shaft into an analog or digital signal. This versatile component is widely used for position sensing, control systems, and user input in various applications. Unlike potentiometers, rotary encoders can rotate continuously without limits, making them ideal for applications requiring infinite rotation or precise incremental adjustments.








The following table outlines the key technical details of the Arduino ABX00107 Rotary Encoder:
| Parameter | Specification |
|---|---|
| Manufacturer | Arduino |
| Part ID | ABX00107 |
| Operating Voltage | 5V |
| Output Signal | Digital (Quadrature: A and B phases) |
| Maximum Rotational Speed | 100 RPM (recommended) |
| Shaft Type | Continuous rotation |
| Detents | 20 detents per revolution |
| Push Button | Integrated (momentary switch) |
| Operating Temperature | -20°C to 70°C |
| Dimensions | 11.5mm x 12.5mm x 15.5mm |
The rotary encoder has five pins, as described in the table below:
| Pin | Name | Description |
|---|---|---|
| 1 | GND | Ground connection |
| 2 | +5V | Power supply (5V) |
| 3 | SW | Push button output (active LOW) |
| 4 | DT | Data signal (B phase of quadrature output) |
| 5 | CLK | Clock signal (A phase of quadrature output) |
+5V pin to the 5V output of your microcontroller and the GND pin to ground.CLK pin to a digital input pin on your microcontroller.DT pin to another digital input pin.SW pin to a digital input pin with a pull-up resistor.Below is an example code snippet for interfacing the rotary encoder with an Arduino UNO:
// Rotary Encoder Example Code for Arduino UNO
// Manufacturer: Arduino
// Part ID: ABX00107
#define CLK 2 // Connect CLK pin to digital pin 2
#define DT 3 // Connect DT pin to digital pin 3
#define SW 4 // Connect SW pin to digital pin 4
int counter = 0; // Variable to store the encoder position
int currentStateCLK;
int lastStateCLK;
bool buttonPressed = false;
void setup() {
pinMode(CLK, INPUT);
pinMode(DT, INPUT);
pinMode(SW, INPUT_PULLUP); // Use internal pull-up resistor for the button
Serial.begin(9600);
// Read the initial state of CLK
lastStateCLK = digitalRead(CLK);
}
void loop() {
// Read the current state of CLK
currentStateCLK = digitalRead(CLK);
// If the state of CLK has changed, a rotation has occurred
if (currentStateCLK != lastStateCLK) {
// Determine the direction of rotation
if (digitalRead(DT) != currentStateCLK) {
counter++; // Clockwise rotation
} else {
counter--; // Counterclockwise rotation
}
// Print the updated counter value
Serial.print("Position: ");
Serial.println(counter);
}
// Update the last state of CLK
lastStateCLK = currentStateCLK;
// Check if the button is pressed
if (digitalRead(SW) == LOW) {
if (!buttonPressed) {
Serial.println("Button Pressed!");
buttonPressed = true;
}
} else {
buttonPressed = false;
}
}
SW pin is connected to a pull-up resistor (internal or external) to avoid floating states.CLK and DT lines to reduce noise.Unstable or Erratic Readings:
No Response from the Encoder:
Push Button Not Working:
Incorrect Direction Detection:
CLK and DT connections.CLK and DT pins.Q1: Can the rotary encoder be used with 3.3V systems?
A1: The Arduino ABX00107 is designed for 5V operation. For 3.3V systems, use a level shifter or ensure compatibility with the microcontroller's input voltage range.
Q2: How many detents does the encoder have per revolution?
A2: The encoder has 20 detents per revolution, providing precise incremental control.
Q3: Can the encoder be used for high-speed applications?
A3: The recommended maximum rotational speed is 100 RPM. For higher speeds, ensure proper signal filtering and processing.
Q4: Is the push button momentary or latching?
A4: The push button is momentary, meaning it only remains active while pressed.
By following this documentation, users can effectively integrate the Arduino ABX00107 Rotary Encoder into their projects for reliable and precise control.