Home › Parts › Switches & protection › Rotary encoder (KY-040)

Rotary encoder (KY-040) (EC11)

Switches & protection · A/B + push

KY-040 incremental rotary encoder · 20 detents per turn, 1 quadrature cycle per detent · CLK/DT pulled up 10 kΩ to + · SW to GND when pressed (no pull-up fitted) · contact bounce on

Rotary encoder (KY-040) (EC11) on the simulator's bench

Try it on the benchThe lab drops it on an empty bench and opens its datasheet card.

Typical part: KY-040 rotary encoder module (EC11-type, 20 detents)

Pins

Ratings and limits

SignalsCLK (A) and DT (B): 2-bit Gray code, 90° apart; one full cycle (4 edges) per detent; both high at rest
Pull-ups10 kΩ on CLK and DT to +; the SW pull-up is usually not fitted (use INPUT_PULLUP)
SwitchSW to GND while the shaft is pressed
Bouncea few ms of contact bounce on each edge: debounce in software (ignore edges closer than about 1–2 ms) or with RC filters
Supply+ 3.3–5 V (only the pull-ups use it)

How to use it

Turn = count steps (the direction comes from which signal changes first), press = select. Read it with interrupts on CLK (or both pins) and a small debounce, or poll every millisecond.

More in switches & protection

Sources: ALPS EC11 series data; KY-040 module schematic (10 kΩ pull-ups on CLK and DT, R1 for SW often unpopulated).