Pinagem
Pinagem Módulo encoder rotativo (KY-040, 5 pinos)

Pinos
- GND
- + (VCC, 3.3–5V — only feeds the two 10kΩ pull-ups on CLK and DT)
- SW — built-in pushbutton, shorts to GND when the shaft is pressed (no pull-up on the board for this one: use INPUT_PULLUP)
- DT — quadrature output B
- CLK — quadrature output A
Especificações
| Tensão de alimentação | 3.3–5 V |
|---|---|
| Saída | 2-channel quadrature (CLK, DT) |
| Resistores pull-up | 10 kΩ on CLK and DT; none on SW |
| Detents per turn | Typically 20 |
| Rotation | Continuous 360°, no end stop |
| Push switch | Shorts SW to GND when pressed |
| Contatos | Mechanical — debounce needed |
Notas
- Read CLK/DT transitions to determine rotation direction; debounce SW (and CLK/DT) in software, or read CLK/DT from an interrupt on CLK.
- The header reads GND, +, SW, DT, CLK top to bottom with the mounting hole above it — most clones keep this order, but check the silkscreen: a few swap CLK and DT.







