🎛️ KY-040 Rotary Encoder Module with Push-Button - Choose With or Without Knob Cap
Description: The KY-040 pairs a 360° incremental rotary encoder with a built-in push switch, so one component gives you both a turnable dial and a click action — ideal for menu navigation, volume controls or any project that needs a physical knob. Choose the Without cap option for the bare 6mm D-shaft module (fit your own knob), or the With cap option to receive a D-shaft knob cap with each module.
- ✅ 360° incremental rotary encoder plus an integrated push-button switch on the same shaft — turn and click from one component
- ✅ 20 detents per revolution, giving smooth, evenly-spaced steps for menu or value scrolling
- ✅ Two options — check the Knob Cap choice before you buy: Without cap is the module only, with a bare 6mm D-shaft (no knob supplied); With cap includes a knob cap for the D-shaft with every module
- ✅ UK stock, dispatched daily from our Callander workshop in Scotland
- ✅ Works with Arduino (Uno, Nano, Mega), ESP32, ESP8266, Raspberry Pi, Raspberry Pi Pico, STM32
⚡ General Component Specifications
- Type: Incremental rotary encoder with push-button
- Operating Voltage: 3.3V - 5V DC
- Detents per Revolution: 20
- Switch Type: Momentary push (shaft press)
- Board Dimensions: approx. 32 x 18mm
- Compatibility: Arduino (Uno, Nano, Mega), ESP32, ESP8266, Raspberry Pi, Raspberry Pi Pico, STM32
📌 Pinout Guide
- CLK: Encoder output A — pulses as the shaft turns, read alongside DT to determine direction.
- DT: Encoder output B — the second quadrature signal, compared against CLK for direction.
- SW: Push-button output — pulls low when the shaft is pressed (needs a pull-up if your board doesn't provide one).
- + (VCC): Power in, 3.3V or 5V.
- GND: Ground.
📦 What's Included
Select your pack size from the drop-down above:
- 1x Pack — one encoder module (with or without knob cap, as selected)
- 5x Pack — five encoder modules (with or without knob caps, as selected)
Every order includes:
- 1 x KY-040 rotary encoder module (per unit in the pack)
- 1 x knob cap per module — With cap option only; the Without cap option ships with no knob
🔧 Quality & Handling Best Practice
- Debounce both the rotation and the switch in software. Mechanical contacts bounce on every detent and every press — a few milliseconds of debounce in your code (or a small RC filter) stops double-counted steps and phantom clicks.
- Read CLK and DT together, not CLK alone. The direction of rotation is only knowable by comparing which of the two changes first — most encoder libraries handle this for you, but a from-scratch implementation needs both pins.
- Don't force the shaft past its detents. It rotates freely with no end-stop — forcing it sideways can crack the internal contacts.
- Handle by the edges of the PCB and store in the supplied ESD bag when not in use.
🔄 Returns & Support
This listing has a 30-day return window. If your item arrives faulty or dead-on-arrival, just message us — we typically reply within 24 hours and will sort a replacement or a full refund, no fuss.
Stuck on wiring or getting it talking? Message us before leaving feedback — we use these parts ourselves and are happy to help.
💷 Save More When You Buy Multiples
- Buy 2 — save 5%
- Buy 3 — save 10%
- Buy 4 or more — save 15%
Discounts are applied automatically at checkout — just add the quantity you need to your basket.
🚚 Shipping & Delivery Information
- Free UK delivery on every order
- Fast daily dispatch from our workshop in Callander, Scotland
- Sent in an anti-static ESD bag inside defensive packaging so the pins and PCB arrive undamaged
🛠️ Complete Your Project Build