
KY-040 Rotary Encoder
- Fresh, latest-batch stock — never old shelf stock
- Tested before it ships
- Arrives dead? We replace it
- Same-day delivery in Dhaka · Cash on Delivery nationwide
- See it before you buy: visit our shop at Ansar Ali Sarak, Boat Ghat, East Nurer Chala, Vatara
The KY-040 Rotary Encoder puts an endless-spinning knob on your project: 20 clicky detents per turn, quadrature CLK and DT outputs that report direction as well as steps, and a push button on the shaft for select. Menus, volume, radio tuning, clock setting and stepper position all work better with a dial than with plus and minus buttons, on Arduino, ESP32 and Raspberry Pi alike.
- 20 detents per 360 degrees
- 5 pins: CLK, DT, SW, + and GND
- Centre press switch on the SW pin
- D-shaped shaft takes standard push-on knobs
- Read CLK and DT with interrupts and add a little debounce
Not sure it will work? Test your circuit free in Tekko Sim — on your phone, in Bangla or English.
Type: Mechanical incremental rotary encoder
Detents: 20 per 360 degrees
Signals: Quadrature outputs, CLK and DT
Push Button: Center press switch on the SW pin
Pins: 5 (CLK, DT, SW, +, GND)
Supply Voltage: 5 V (works with 3.3 V logic)
Shaft: D-shaped shaft for push-on knobs
Interface: Digital inputs, interrupt reading recommended
Typical Uses: Menu navigation, volume control, position setting
Mounting: Through-hole breakout, breadboard friendly
| Category | Modules |
| Model no. | KY-040 |
| Availability | In stock |
| In stock | 5 pcs |
| Delivery | Cash on Delivery, nationwide Bangladesh |
Customer reviews
No reviews yet — be the first.
Questions about the KY-040 Rotary Encoder
What is the KY-040 rotary encoder used for?
It converts knob rotation into digital pulses so a microcontroller can count direction and steps, which suits menus, volume control, motor position and any setting you adjust with a dial.
How do I wire and program it with an Arduino?
Connect CLK, DT and SW to three digital pins, + to 5V and GND to ground, then read CLK and DT inside an interrupt routine to track direction, and digitalRead on SW for the push button.
How is an encoder different from a potentiometer?
A potentiometer reports an absolute position with a fixed end of travel, while the KY-040 spins endlessly and reports relative steps, so it fits menus and unlimited ranges far better.
Can I use it with a 3.3V ESP32 or Raspberry Pi?
Yes. Power the 5V pin for full output swing or run the module from 3.3V; either way the outputs read fine on 3.3V logic inputs.
My counts jump around. What is wrong?
Mechanical quadrature contacts bounce. Decode CLK and DT with interrupts using a small state table, and add 100nF capacitors from those pins to ground or debounce in software.
এটা দিয়ে কী কী প্রজেক্ট বানানো যায়?
ডিজিটাল ভলিউম কন্ট্রোল, FM রেডিও টিউনার, ঘড়ির সময় সেট, স্টেপার পজিশন কন্ট্রোল বা LCD মেনু। ঘুরিয়ে ভ্যালু কমানো-বাড়ানো আর চাপ দিয়ে সিলেক্ট, দুটোই এক নবে।


