← Wiki · Component

Rotary encoder

A knob that turns endlessly and reports steps as two phase-shifted signals (A, B). The EC11 adds a push switch. Common as a volume knob.

What it does#

Inside are two switches, A and B, against a common pin C. Turning the knob opens and closes them a quarter step apart (quadrature), so the order of the edges gives the direction. The EC11 with switch has two more pins, S1/S2, for the push button. It is mechanical: no supply needed.

Example circuit: C and S2 to GND; A, B and the switch to GPIOs. R1/R2 pull A and B up (the internal pull-ups usually do too).
C and S2 to GND; A, B and the switch to GPIOs. R1/R2 pull A and B up (the internal pull-ups usually do too). Open the rotary_encoder example from this page in PCB Canvas: “Insert into my schematic”.

Detents and pulses#

The catalog EC11 has 30 detents and 15 pulses per turn: one full A/B cycle every two clicks. Firmware (QMK ENCODER_RESOLUTION, ZMK steps) must match, or one click counts twice or every other click is lost.

Pitfalls#

  • Bounce. Mechanical contacts bounce; decode with a state machine, and add 10 nF from A and B to GND if the readings jitter.
  • Pin order on the footprint. The three pins are A, C, B (C in the middle) on Alps EC11 parts; the two switch pins are on the other side.
  • Mounting legs of the footprint are not in the symbol; the ERC warns that a pad stays unconnected, which is fine.

Footprint#

Through-hole only. JLCPCB lists the Alps EC11E183440C (C370986) but you will usually solder encoders yourself.