A potentiometer reports an absolute position — turn it partway and it tells you exactly where it is, but it physically stops at each end of its range and wears unevenly at whichever position gets used most. A rotary encoder solves a different problem: it spins freely with no endpoints and reports only that it moved, and which direction — which is exactly the right shape of information for scrolling through an unbounded menu, nudging a parameter up or down, or sweeping a frequency without caring what the “start” of the range was.
How it actually reports motion
Inside an incremental rotary encoder, two internal switches (or optical sensors) are offset from each other so that turning the shaft toggles them in a staggered, overlapping pattern called quadrature. Reading both signals together doesn’t just tell you that the shaft moved — the order in which the two signals toggle tells you which direction it moved, which is the whole trick: one pair of signals, two independently useful pieces of information. A microcontroller reads both pins, compares their current state against the last state it recorded, and uses that transition to decide whether to increment or decrement a counter. Most encoders also report a certain number of detents (physical clicks) per full rotation — commonly 20 or 24 — with each detent corresponding to one full quadrature cycle.
Why debouncing matters more here
Mechanical rotary encoders (the cheap, common kind with physical contacts rather than optical sensing) bounce just like a push-button does, but the consequence is worse: a bounced button press might register as “pressed” when you only meant to press once, but a bounced encoder transition can register as a phantom step in the wrong direction, making a knob feel like it’s randomly jumping backward while you turn it steadily forward. The standard fix is the same as button debouncing — either a short software delay between reads, or a capacitor across each signal line to smooth out the electrical noise — but it’s worth testing deliberately, because a poorly debounced encoder is one of the more common reasons a “finished” project feels subtly broken to use even though it works in a basic bench test.
Wiring one in, with the push-button detent
Most rotary encoders sold for hobby use include a third function: the shaft itself acts as a push-button when pressed straight down, giving you a built-in “select” or “confirm” action on top of the turn-to-adjust behavior — exactly the combination behind most “turn to choose a value, press to confirm” hardware menus. Wiring one up typically means:
- Two signal pins (often labeled CLK/A and DT/B) to two digital-input-capable pins on your microcontroller, each with a pull-up resistor (many breakout boards include these already).
- The push-button pin, wired the same way as any ordinary momentary button — digital input with a pull-up, reading low when pressed.
- Common ground, shared between the encoder and the microcontroller.
Most microcontroller platforms have a dedicated encoder library that handles the quadrature decoding and debouncing for you, so in practice this becomes a few lines of setup code plus a callback that fires on each detected step, rather than hand-rolling the state machine yourself.
Where you’ll actually use one
Anywhere a project needs to adjust a value with no natural fixed range — tuning a frequency (as in a Chladni-plate build, where turning the knob sweeps continuously rather than jumping between fixed presets), scrolling a menu of arbitrary length, or dialing in a parameter on a synth or lighting rig — a rotary encoder is almost always the right physical control, specifically because it doesn’t impose an artificial start or end point on something that doesn’t actually have one.