Choose the right rotary encoder type before comparing specs
| Need |
Choose this type |
Matching product example |
Why it fits |
Don’t choose it if |
| Human-turned menu or settings knob |
Incremental rotary encoder module |
KY-040 rotary encoder with push switch |
Brush-type mechanical incremental encoder with 20 pulses per revolution and an integrated push-button switch; a practical default for Arduino-style UI builds on Arduino boards |
You need position to survive power-off; incremental encoders report relative motion only |
| USB volume knob or macro dial |
Bare incremental panel encoder |
EC11 rotary encoder with push button |
Integrated push-button functionality and 2-bit Gray code output make it a clean panel/PCB option for an encoder knob build |
You want a breadboard-ready module with headers and pull-ups already fitted |
| Motor speed + direction or closed-loop shaft feedback |
Optical encoder or Hall quadrature encoder |
HN3806 360PPR optical rotary encoder |
HN3806 units are 2-phase incremental shaft encoders offered here in 100 PPR and 360 PPR versions for quadrature feedback |
You only need single-channel RPM pulses |
| RPM only |
Slot-type or Hall speed sensor |
HC-020K slot-type motor speed sensor |
Stable digital pulse output for speed or distance measurement, with a 5.9 mm slot width; simpler than a full quadrature encoder when direction is irrelevant |
You need direction or position, which requires A/B channels |
| Exact angle retained at power-up |
Absolute rotary encoder / magnetic angle sensor |
AS5600 12-bit magnetic encoder module |
12-bit resolution with programmable I2C, PWM, and analog voltage outputs, so it can report exact shaft angle at startup |
You want a simple hand-input click encoder with no magnet mounting |
| Fixed 0–F position selection |
Coded switch |
16-position rotary DIP switch |
16 positions from 0–F for fixed coded selection |
It is not a pulse-counting encoder |
| Simple analog limited-angle knob |
Potentiometer |
YwRobot 20K analog potentiometer module |
270-degree rotation with analog output from 0 to VCC is the straightforward choice for absolute analog control |
You need endless rotation or digital quadrature pulses |
Incremental encoders do not retain position after power-off; absolute encoders do. For deeper background on the difference between encoder outputs and how quadrature works, that article helps once you have narrowed the family.
Quick comparison: module, bare encoder, optical shaft encoder, Hall motor encoder, and absolute magnetic sensor
| Product name |
Type |
Resolution or positions |
Output or interface |
Voltage |
Fit clue |
Best for |
Gotcha |
| KY-040 rotary encoder with push switch |
Mechanical incremental rotary encoder module |
20 PPR |
5-pin breakout with push switch |
5V DC |
Compact module format |
Breadboard-friendly UI input |
Mechanical contact style, not for shaft feedback |
| EC11 rotary encoder with push button |
Bare incremental encoder switch |
— |
2-bit Gray code with push button |
— |
15x11 mm body |
Compact panel or PCB encoder knob builds |
Bare part, so you add pull-ups yourself |
| HN3806 100PPR optical rotary encoder |
Optical rotary encoder |
100 PPR |
NPN open-collector |
DC 5-24V |
Shaft encoder format |
Moderate-resolution shaft feedback |
Requires pull-ups; 5000 R/min max mechanical speed |
| HN3806 360PPR optical rotary encoder |
Optical rotary encoder |
360 PPR |
NPN open-collector |
DC 5-24V |
6 mm shaft, 2-meter cable |
Higher-resolution shaft monitoring |
Requires external pull-up resistors for both phases |
| AS5600 12-bit magnetic encoder module |
Absolute magnetic sensor |
12-bit |
I2C, PWM, analog output |
— |
Non-contact magnetic sensing |
Absolute angle measurement |
Fixed-address I2C planning matters in multi-sensor builds |
| HC-020K slot-type motor speed sensor |
Slot-type speed sensor |
— |
Stable digital pulse output |
— |
5.9 mm slot |
RPM or distance measurement |
Single-channel sensor, not direction-capable |
| Hall effect speed encoder for DC motors |
Hall motor encoder |
12, 13, or 16 CPR |
Dual-phase outputs, 90° phase difference |
— |
Fits JGB37 and JGA25 motor families |
Low-resolution motor speed and direction feedback |
Compatibility is motor-family specific |
| 16-position rotary DIP switch |
Coded selector |
16 positions |
Fixed coded output |
24VDC, 0.025A |
2.54 mm pitch, through-hole |
PCB mode or address setting |
Not a control encoder; only 2000 mechanical cycles |
| YwRobot 20K analog potentiometer module |
Potentiometer |
270° travel |
Analog output |
3.3V or 5V |
Knob module format |
Simple absolute analog control |
Limited rotation instead of endless turning |
For shaft-feedback options in an ESP32 project, the 3.3 V logic side and hardware counting support on ESP32 boards can matter as much as encoder resolution. For deeper implementation detail on optical models, see reading a photoelectric shaft encoder with a microcontroller.
Electrical compatibility checks that prevent the most common wrong encoder purchases
- CLK = channel A, DT = channel B, and SW = push button. On a typical hand-input encoder, A/B use two digital inputs, and SW is optional if you want click-to-select behavior.
- KY-040 rotary encoder with push switch includes onboard 10 kΩ pull-ups, which makes it the easier first-project choice than a bare encoder.
- EC11 rotary encoder with push button does not include pull-ups; most builds use the microcontroller’s internal pull-up resistors.
- Open-collector optical encoders such as the HN3806 class require pull-ups.
- On the 100PPR HN3806, the data lines must connect to VCC through 1 to 100 kΩ resistors, and the AB outputs should not be tied directly to VCC.
- The 360PPR HN3806 optical encoder also needs external pull-up resistors on both phases because its outputs are NPN open collector.
- ESP32 GPIOs are 3.3 V, so power a KY-040 from 3.3 V or level-shift any 5 V signals before feeding them into an ESP32 input.
- One interrupt pin per encoder is enough for x2 decoding; two pins allow x4 decoding. For higher pulse rates, ESP32 hardware PCNT and the timer encoder mode on STM boards reduce missed counts.
- AS5600 uses I2C instead of A/B quadrature decoding and sits at fixed address 0x36, which saves pulse-counting pins but matters if you want more than one on the same bus.
For a concrete hookup example, see wiring CLK, DT, and SW on a rotary encoder module.
Resolution, feel, and speed: how many pulses are actually enough?
For a hand-turned encoder knob, 15 to 30 detents per revolution is the normal range. That is why the KY-040 at 20 pulses per revolution feels right for menus rather than coarse or under-specced. The FZ0535 rotary encoder with reset button is also specified at 20 pulse precision, but adds a dedicated reset button when you want a quick return-to-zero control.
Motor feedback is a different sizing problem. The HN3806 options here are 100 PPR and 360 PPR, while the Hall motor encoder for JGB37 and JGA25 motors comes in 12, 13, or 16 CPR versions for lower-resolution integrated feedback. AS5600 uses absolute 12-bit angle measurement instead of pulse counting, which means 4096 positions per turn.
Watch the PPR/CPR distinction. In x4 quadrature decoding, CPR can equal 4 × PPR. That matters quickly at speed—a 400 PPR encoder at 3000 RPM generates 20,000 pulses per second—so more resolution is not always the right call, especially if your controller is not using hardware counting on ESP32. If you want the count-mode detail, see why one encoder can produce multiple counts per click.
Common mistakes to avoid before you order an encoder
- KY-040 is a module, while EC11 is the bare component used in this style of build. If you expect headers and plug-in wiring, choose the module.
- Mechanical knob encoders are for hand-turn speeds. For high-RPM motor feedback, move to an optical HN3806 or the Hall motor encoder instead of using a KY-040 or EC11.
- Incremental encoders lose position at power-off. If the system must know its angle immediately after reboot, use AS5600, not a standard incremental rotary encoder.
- AS5600 needs a diametrically magnetized magnet centered over the chip with a 0.5–3 mm air gap, and ferrous shafts or mounts should be avoided. The module includes a small magnet, but the mounting requirement still decides whether it will read cleanly.
- AS5600 uses fixed I2C address 0x36, so multiple sensors need bus planning such as a TCA9548A multiplexer or a second I2C bus.
- HC-020K is the right buy when you only need RPM. If you need direction too, choose a 2-channel quadrature encoder instead.
- The 16-position rotary DIP switch gives fixed 0-F positions, not continuous pulse output.
- A module does not solve debounce by itself. The resistors you see on a KY-040 are pull-ups, not a full debounce circuit, so software filtering is still the normal fix for skips or double counts.
- In a menu-driven interface, many buyers pair a hand encoder with LCD modules; blocking display updates can still make mechanical encoder decoding feel worse.
For the common symptom side of this problem, see why mechanical encoder modules can skip or double count without proper decoding.
FAQs on Rotary Encoders
Will a rotary encoder work like a potentiometer for a simple knob project?
No — an encoder gives continuous-rotation digital pulse output, while the YwRobot 20K analog potentiometer module gives about 270° of rotation with analog output from 0 to VCC. Choose the potentiometer when you want a fixed-range absolute knob on one analog pin, and choose an encoder when you want endless rotation or push-to-select behavior.
Do rotary encoders keep their position after power is turned off?
No — incremental encoders do not retain position after power-off, while AS5600 is an absolute 12-bit angle sensor that reports exact angle at startup. That is the deciding difference for valve, steering, vane, and any project that cannot home after a reboot.
Do I need pull-up resistors for these encoders?
Yes in some cases — KY-040 has onboard 10 kΩ pull-ups, bare EC11 does not, and HN3806 optical encoders use NPN open-collector outputs that require pull-ups, with the 100PPR version calling for 1 to 100 kΩ to VCC. If the line can only pull low and never drive high, you need the pull-up path planned before ordering.
Why do some encoders skip steps or count twice?
Mechanical contact bounce is the main cause, and roughly 100 nF RC filtering or software debounce is the usual fix. Modules mainly provide pull-ups, not full debounce, so a mechanical encoder can still jitter or double count if the decoding method is too naive.
Which rotary encoder is better for ESP32 projects?
For ESP32, a KY-040 works well if you power it at 3.3 V or level-shift any 5 V signal, because ESP32 GPIOs are 3.3 V. ESP32 also has hardware PCNT, which makes it a better fit for higher pulse rates than simple polling on a smaller board.
Do I need a quadrature encoder if I only want RPM?
Can I use more than one AS5600 on the same microcontroller?
Not directly on one I2C bus — AS5600 uses fixed address 0x36, so multiple units need a second I2C bus, an AS5600L-style alternative, or a TCA9548A multiplexer. This matters most on multi-knob or multi-angle builds where the wiring looks simple until the address conflict appears.
Glossary
- Incremental encoder
- An incremental encoder reports movement step by step, but it does not remember position after power loss.
- Absolute encoder
- An absolute encoder reports the actual shaft angle at startup, which is why it suits power-loss-sensitive position sensing.
- PPR
- PPR means pulses per revolution on one channel, and it is the main resolution figure on shaft encoders.
- CPR
- CPR means counts per revolution, and with x4 quadrature decoding it can equal 4 × PPR.
- Detent
- A detent is the tactile click you feel when turning a hand encoder, and it strongly affects menu-control feel.
- Pull-up resistor
- A pull-up resistor holds a signal line high until the encoder pulls it low, which is required for bare EC11 parts and open-collector optical encoders.
- Debounce
- Debounce is the filtering that removes false transitions from mechanical contacts so the encoder does not skip or double count.
- Open collector (NPN)
- Open collector means the output can pull low but not drive high by itself, so products such as HN3806 optical encoders need pull-up resistors.
Please complete your information below to login.
Sign In
Create New Account