β οΈ Affiliate Disclosure: This post contains Amazon affiliate links. If you purchase through our links, we may earn a small commission at no extra cost to you. Every product below was checked against its live Amazon listing before publishing. Prices change often, so we don’t list them here. Tap any Buy Here button to see the current price on Amazon.
ESP32 User Input Guide
ποΈ Best Rotary Encoders for ESP32
From cheap KY-040 knobs to I2C encoders, a smart ESP32-S3 dial, magnetic AS5600 sensors and 600-pulse optical encoders: 7 picks for menus, volume knobs and motor feedback.
β
7 Encoders Compared
β
Verified Amazon ASINs
β
3.3V Wiring Notes
β
Honest Pros & Cons
A rotary encoder is the knob that makes an ESP32 project feel finished. Unlike a potentiometer, it turns forever, reports direction in clean steps, and usually adds a push button, which is exactly what you need to scroll an OLED menu, set a thermostat, adjust a WLED brightness level or tune a stepper speed. Mounted on a shaft, the same idea measures how far a wheel or motor has turned.
Encoders come in three families: mechanical (cheap, with satisfying detents), optical (hundreds of pulses per turn for speed and position) and magnetic (contactless, absolute angle over I2C). This guide compares 7 picks across all three, plus I2C encoders that save GPIO pins and the M5Stack Dial, an ESP32-S3 built into a knob.
π‘ Before you buy: Decide whether you need a human knob or a measurement sensor. For menus and settings, a 20 to 24 detent mechanical encoder with a push button is ideal, and mechanical contacts bounce, so plan on the ESP32’s PCNT glitch filter or a small debounce. For motor speed or wheel position, use an optical or magnetic encoder instead. Also check which chip you have: the original ESP32 has hardware pulse counters (PCNT), but some newer chips such as the ESP32-C3 do not, which makes an I2C encoder the easier choice there.
β‘ Quick Comparison: All 7 Rotary Encoders
| Encoder | Type | Interface | Resolution | Best For | Buy |
|---|
| π₯ SparkFun Qwiic Twist | Mechanical, RGB lit | I2C (Qwiic) | 24 ticks per turn | Best Overall | Buy Here β |
| π₯οΈ M5Stack Dial v1.1 | ESP32-S3 smart knob | Built in (GPIO) | 64 pulses, 16 positions | Best All-in-One Knob | Buy Here β |
| ποΈ Adafruit Rotary Encoder + Extras | Mechanical, detented | Quadrature (GPIO) | 24 pulses per turn | Best Panel-Mount Knob | Buy Here β |
| π DIYables Rotary Encoder (5 pack) | Mechanical module | CLK, DT, SW (GPIO) | Continuous, with button | Best for Beginners | Buy Here β |
| π¦ WayinTop KY-040 (5 pack) | Mechanical module | CLK, DT, SW (GPIO) | Continuous, with button | Best Budget Multi-Pack | Buy Here β |
| π§² HiLetgo AS5600 (2 pack) | Magnetic, contactless | I2C, analog or PWM | 12-bit absolute angle | Best Absolute Angle | Buy Here β |
| π¦ 600 P/R Optical Encoder | Optical, 6mm shaft | AB quadrature, 5 to 24V | 600 pulses per turn | Best for Speed and Position | Buy Here β |
Specs come from the manufacturers and the live Amazon listings. Star scores below are our ratings.
π What Matters in a Rotary Encoder
βοΈ
Mechanical, Optical or Magnetic
Mechanical is cheap and tactile, optical gives high pulse counts for motors, and magnetic reads an absolute angle with no contacts to wear out.
π―
Pulses and Detents
Menu knobs want 20 to 24 clicks per turn. Motor feedback wants hundreds of pulses, multiplied by four with quadrature decoding.
π
GPIO or I2C
Quadrature encoders use two or three GPIOs each. I2C encoders share two wires with your display and sensors, and count steps for you.
π
Push Button
A press-to-select switch turns one knob into a full menu controller: rotate to scroll, press to confirm.
β‘
3.3V Signal Levels
Power module pull-ups from 3.3V, not 5V. Industrial encoders running at 12 or 24V need open-collector outputs pulled up to 3.3V.
π Detailed Reviews: The Top Two
π₯ BEST OVERALL ROTARY ENCODER FOR ESP32
SparkFun Qwiic Twist RGB Rotary Encoder Breakout
β 4.7/5 Β· Our Rating Β· The No-Debounce Knob
Buy on Amazon β

The Qwiic Twist takes away everything annoying about encoders. An on-board microcontroller reads the knob, debounces it and keeps count, so your ESP32 simply asks over I2C how far it moved, which direction, and whether the button was pressed. It reports 24 ticks per full turn, includes a built-in push button, and lights the shaft with a PWM-controlled RGB LED that can show up to 16 million colours, handy for showing a mode or a warning state. Two Qwiic connectors let you daisy-chain it with an OLED or sensors on the same two wires, it runs at 3.3V, an interrupt pin can wake your code only when something changes, and a solder jumper moves the address from 0x3F to 0x3E for a second knob. SparkFun provides Arduino and Python libraries; in ESP-IDF it’s a handful of simple register reads. Add a clear knob to let the colour glow through.
β
Pros- Zero debouncing code
- Only two I2C wires
- RGB status light
- Works on chips without PCNT
β Cons- Costs more than bare encoders
- Knob not part of the board
- Polling adds slight latency
π― Verdict: The easiest, most reliable menu knob for any ESP32, especially the PCNT-less C3.
π Check Price on Amazon β
π₯οΈ BEST ALL-IN-ONE ESP32 SMART KNOB
M5Stack Dial v1.1 ESP32-S3 Smart Rotary Knob
β 4.6/5 Β· Our Rating Β· A Finished Product in Your Hand
Buy on Amazon β

The M5Stack Dial isn’t a part you wire to an ESP32: it is an ESP32, built into a palm-sized knob. Inside is a StampS3A (ESP32-S3FN8, 8MB flash), surrounded by a 1.28-inch 240×240 round touch screen, a rotating bezel encoder with 16 positions and 64 pulses per revolution, a 13.56 MHz RFID reader, an 80dB buzzer and a BM8563 real-time clock. It powers from USB-C, a 6 to 36V DC terminal or a small battery, and two Grove-style ports (PORT.A and PORT.B) add I2C sensors or relays. That makes it a ready-made smart thermostat, Home Assistant controller, RFID door panel or LVGL dashboard, programmable in ESP-IDF, Arduino, PlatformIO or UiFlow2. The trade-off is flexibility: you get the encoder M5Stack chose, and the case is part of the deal.
β
Pros- ESP32-S3, screen and knob in one
- RFID, buzzer and RTC included
- 6 to 36V wide input
- Finished, enclosed design
β Cons- Not a standalone encoder part
- Limited free GPIO
- USB-C cable not included
π― Verdict: The fastest way to a polished knob-based controller, with no soldering or enclosure work.
π Check Price on Amazon β
π§ Detailed Reviews: Classic Quadrature Encoders
ποΈ BEST PANEL-MOUNT KNOB Β· β 4.6/53. Adafruit Rotary Encoder + Extras
24 pulses with detents Β· push button Β· panel mount or breadboard Β· soft-touch knob included
Buy Here β

When the knob will sit on the front panel of a finished enclosure, use a proper bare encoder rather than a module. Adafruit’s is a high-quality 24-pulse encoder with detents (its datasheet is the Bourns PEC11 series), with a three-pin quadrature connector (A, B and ground) plus a separate normally-open push button. It can be panel mounted with its threaded bushing or plugged straight into a breadboard, and it ships with a soft-touch knob with an arrow. Because there are no resistors on it, enable the ESP32’s internal pull-ups on the A, B and button pins (or add 10k resistors) and feed A and B to a PCNT unit with the glitch filter on.
β
Pros: Quality detents; panel mountable; knob included; breadboard friendly.
β Cons: Needs pull-ups and debouncing; single unit.
π― Verdict: The knob to mount on a finished ESP32 project box.
π BEST FOR BEGINNERS Β· β 4.4/54. DIYables Rotary Encoder Module (5 Pack)
3.3 to 5V Β· CLK, DT, SW, +, GND Β· continuous rotation Β· push button Β· online tutorials
Buy Here β

If you just want a knob working on a breadboard tonight, this 5 pack of KY-040 style modules is the friendliest start. Each board carries the encoder, its push button and pull-up resistors, with a labelled 5-pin header (CLK, DT, SW, + and GND), and it’s rated for 3.3 to 5V, so you can power it straight from the ESP32’s 3.3V pin and connect the outputs directly. It turns continuously in both directions, and DIYables publishes step-by-step ESP32, Arduino and Raspberry Pi tutorials for it, which is a real help the first time you meet quadrature signals. Five pieces means spares for several projects.
β
Pros: 3.3V rated; pull-ups on board; labelled pins; tutorials provided.
β Cons: Hobby-grade detents; not panel friendly.
π― Verdict: The easiest first encoder for ESP32 breadboard projects.
β Also Worth Considering
π¦ BEST BUDGET MULTI-PACK Β· β 4.2/5
5. WayinTop KY-040 Rotary Encoder Module (5 Pack)
Five classic KY-040 360 degree encoder modules with push buttons, the board used in countless tutorials. Same CLK, DT, SW pinout as the DIYables pack, and the same rule applies: power the + pin from 3.3V so the on-board pull-ups never send 5V into an ESP32 pin. A cheap way to stock your parts drawer.
Buy Here βπ§² BEST ABSOLUTE ANGLE Β· β 4.3/5
6. HiLetgo AS5600 Magnetic Encoder Module (2 Pack, with Magnets)
The AS5600 reads a spinning magnet without touching it and reports a 12-bit absolute angle over I2C (address 0x36), or as an analog or PWM output. That means no wear, no bounce, and the ESP32 knows the exact position at power-up. It’s the go-to sensor for FOC gimbal motors, smooth volume knobs and robot joints. On these clone boards, tie the DIR pin to GND or VCC rather than leaving it floating.
Buy Here βπ¦ BEST FOR SPEED AND POSITION Β· β 4.2/5
7. 600 P/R AB 2-Phase Incremental Optical Rotary Encoder
A metal-bodied optical encoder with a 6mm shaft, 600 pulses per revolution on A and B channels, a 5 to 24V supply and a listed top speed of 5000 RPM. Decoded in all four edges by the ESP32’s PCNT, that’s 2400 counts per turn, enough for wheel odometry, a DIY CNC handwheel or measuring motor RPM. Check the listing’s output type: open-collector (NPN) versions need pull-up resistors to 3.3V.
Buy Here βπ€ Which Encoder for Which ESP32 Project?
| Project | What You Need | Recommended Encoder |
|---|
| OLED or TFT menu system | Clicky knob, button, few pins | SparkFun Qwiic Twist |
| Smart thermostat or Home Assistant controller | Screen, knob and enclosure in one | M5Stack Dial v1.1 |
| Front panel of a finished box | Panel-mount encoder and knob | Adafruit Rotary Encoder + Extras |
| Learning PCNT and interrupts | Cheap breadboard modules | DIYables or WayinTop KY-040 |
| FOC gimbal motor or robot joint | Absolute angle, no wear | HiLetgo AS5600 |
| Wheel odometry, RPM, CNC handwheel | High pulse count on a shaft | 600 P/R Optical Encoder |
| ESP32-C3 project (no PCNT) | Encoder that counts for you | SparkFun Qwiic Twist or AS5600 |
π Which One Should You Buy?
ποΈ
You want it to just work
The SparkFun Qwiic Twist: no debouncing, two wires, RGB feedback.
π₯οΈ
You want a finished device
The M5Stack Dial v1.1, an ESP32-S3 with screen, knob and RFID.
π
You’re learning
The DIYables 5 pack, 3.3V rated with tutorials, or the WayinTop KY-040 pack.
π
You’re measuring motion
The AS5600 for absolute angle, the 600 P/R optical for speed and distance.
β Frequently Asked Questions
How should I read a rotary encoder on the ESP32?
Use the hardware pulse counter (PCNT) where your chip has one: it decodes quadrature in hardware, filters glitches and never misses steps, even while Wi-Fi is busy. Our ESP32 PCNT rotary encoder tutorial with ESP-IDF walks through it. GPIO interrupts also work for slow hand-turned knobs.
Why does my encoder skip or count twice?
Mechanical contacts bounce. Enable the PCNT glitch filter, add pull-ups if the encoder has none, and consider a small capacitor (around 10nF to 100nF) from each signal to ground. Also remember most detented encoders produce several counts per click, so divide the raw count to get one step per detent.
Can I use a KY-040 module with 3.3V?
Yes. The encoder itself is just switches, and the pull-up resistors connect to the module’s + pin. Power + from the ESP32’s 3.3V pin and the CLK, DT and SW outputs will stay at safe 3.3V levels.
What’s the difference between an incremental and an absolute encoder?
An incremental encoder (KY-040, Adafruit, optical) only reports movement, so the ESP32 must count from a known start point. An absolute sensor like the AS5600 reports the actual angle at any moment, including right after power-up, which is ideal for joints and motor control.
How many encoders can one ESP32 handle?
It depends on the chip’s PCNT units: the original ESP32 has 8, the ESP32-S3 has 4, and the ESP32-C3 has none. Beyond that, use GPIO interrupts or put several I2C encoders on one bus (the Qwiic Twist offers two addresses).
π Final Verdict: Best Rotary Encoders for ESP32
The right encoder for each job:
ποΈ Best Panel-Mount Knob: Adafruit Rotary Encoder + Extras
Buy Here βπ Best for Beginners: DIYables Rotary Encoder (5 Pack)
Buy Here βπ¦ Best Budget Multi-Pack: WayinTop KY-040 (5 Pack)
Buy Here βπ§² Best Absolute Angle: HiLetgo AS5600 (2 Pack)
Buy Here βπ¦ Best for Speed and Position: 600 P/R Optical Encoder
Buy Here βFor most ESP32 builds, the SparkFun Qwiic Twist is the encoder to buy: it handles debouncing and counting for you and shares the I2C bus with your display. Choose the M5Stack Dial when you want a finished knob controller, the Adafruit encoder for a panel-mounted front end, a KY-040 pack for learning, and the AS5600 or 600 P/R optical encoder when the job is measuring motion. To read encoders the right way, start with our ESP32 PCNT rotary encoder tutorial, pair your knob with a screen from our ESP32 displays guide, put encoders on your motors with our DC motor drivers guide, and stock up on wires and breadboards from our prototyping supplies guide.
π¬ Building a knob-controlled ESP32 project? Tell us what it controls in the comments below, and we’ll help you pick the right encoder.
All Amazon links above use our affiliate tag (esp32tutorials-20). Purchasing through them supports esp32tutorials.com at no extra cost to you. Prices and availability change frequently, so always confirm the current price on Amazon before buying.
We are a team of experienced Embedded Software Developers with skills in developing Embedded Linux, RTOS, and IoT products from scratch to deployment with a demonstrated history of working in the embedded software industry. Contact us for your projects: admin@esp32tutorials.com