A rotary encoder module converts mechanical rotation into electrical pulses using quadrature (two phase-shifted signals, typically A and B) to determine both step count and rotation direction. It is commonly interfaced to an Arduino/ESP32 with digital inputs (often using interrupts for fast response). Many encoder modules also include a momentary push-button that can be read as an additional input.
| Pin | Signal | Description |
|---|---|---|
CLK |
digital | Rotary encoder phase A pulse output for counting steps and direction. |
DT |
digital | Rotary encoder phase B pulse output, phase-shifted from CLK for direction sensing. |
SW |
digital | Momentary push-button switch output, typically read as a digital input. |
+ |
power | Positive supply input for the encoder module, commonly connected to 5V or 3.3V. |
GND |
ground | Ground reference for power and all encoder output signals. |
Describe what you want to build. Codey Online writes the code, draws the wiring diagram, compiles it and flashes your board straight from the browser.
Start for free