Rotary Encoder Module KY-040

Rotary Encoder Module KY-040

Components
DET590
Part.No: KY-040
€2.50
In Stock
Immediate Dispatch
KY-040 Rotary Encoder Module for Arduino — 5V incremental rotary encoder with push-button, 20 pulses per revolution, bidirectional counting, unlimited rotation range. Ideal for menus, volume controls, and position tracking.

 

The KY-040 Rotary Encoder Module (MPN: KY-040) is a compact 5V incremental rotary encoder designed for use with Arduino and compatible microcontrollers. Unlike a potentiometer, the KY-040 has no physical stops — it rotates continuously in both directions, making it ideal for any application that requires unlimited, bidirectional counting. An integrated push-button switch allows the user to reset or confirm a selection, adding an extra layer of interactivity to your project.

Key Features

  • Bidirectional counting: Detects both clockwise and counter-clockwise rotation → suitable for menu navigation, motor control, and position tracking
  • 20 pulses per revolution: Each full 360° rotation generates 20 output pulses → predictable, fine-grained resolution for precise control
  • Unlimited rotation: No mechanical end-stop, unlike a potentiometer → continuous, unrestricted input
  • Integrated push-button: Press the encoder shaft to trigger a button event → reset counter or confirm selection without extra components
  • Ready-to-use PCB module: Pull-up resistors and decoupling capacitors included on-board → plug directly into a breadboard or Arduino header
  • Compact form factor: 31 × 19 × 29 mm → fits easily in prototypes and enclosures

Pinout & Wiring

PinSymbolDescription
1CLK (A)Clock output — primary pulse signal for rotation detection
2DT (B)Data output — used with CLK to determine rotation direction
3SWPush-button output — LOW when shaft is pressed
4VCCPower supply — connect to 5V
5GNDGround — connect to GND

Connect VCC to Arduino 5V and GND to Arduino GND. Connect CLK and DT to any two digital input pins. Connect SW to a digital input pin. Read CLK and DT together in your sketch to determine rotation direction and speed.

Compatibility

  • Arduino UNO / Nano / Mega: Direct 5V compatibility — connect VCC to the 5V pin, no level shifter required
  • Raspberry Pi / ESP32 (3.3V logic): Requires a logic level shifter on CLK, DT, and SW pins, as the module operates at 5V

Typical Applications

  • Menu navigation on LCD/OLED displays — scroll through options and confirm with the push-button
  • Volume or brightness control in DIY audio or lighting projects
  • Stepper motor or servo position input — set target position intuitively
  • Parameter adjustment in embedded systems (e.g., set temperature, speed, frequency)
  • Educational projects for learning digital signal reading and interrupt-based programming on Arduino

Technical Specifications

InterfaceDigital (CLK, DT, SW)
Working Voltage5V
Pulses per Revolution20
Rotation360° unlimited, bidirectional
Push-buttonYes (integrated, active LOW)
Main ColorBlack
Dimensions31 × 19 × 29 mm (1.22" × 0.75" × 1.14")
MaterialElectronic components + PCB
MPNKY-040

FAQ

Q: What is the difference between a rotary encoder and a potentiometer?
A: A potentiometer has a fixed range (0°–300°) and outputs an analog voltage. The KY-040 encoder rotates continuously with no limit and outputs digital pulses, making it better for counting steps, navigation menus, and precise control without signal drift.

Q: Do I need external pull-up resistors for the KY-040?
A: No. The KY-040 module includes on-board pull-up resistors for CLK, DT, and SW, so you can connect it directly to your Arduino digital pins without any additional components.

Package Contents: 1 × KY-040 Rotary Encoder Module

Note: This module operates at 5V. Direct connection to 3.3V-only systems (ESP32, Raspberry Pi) may cause damage to the host microcontroller. Always use a logic level shifter when interfacing with 3.3V boards.
16 other products in the same category:
Product added to wishlist
Product added to compare.