Rotary Encoder / Rotation Sensor Module with Pushbutton Switch for Arduino AVR PIC DIY KY-040
Rotary Encoder / Rotation Sensor Module with Pushbutton Switch for Arduino AVR PIC DIY KY-040
Hero image 0 of Rotary Encoder / Rotation Sensor Module with Pushbutton Switch for Arduino AVR PIC DIY KY-040, 0 of 5

Rotary Encoder / Rotation Sensor Module with Pushbutton Switch for Arduino AVR PIC DIY KY-040

(No ratings yet)

Key item features

  • Continuous 360-Degree Rotation: Spins freely in both directions with no mechanical stops, providing unlimited rotational input for menu navigation, volume controls, and parameter adjustment.
  • 20 Detents Per Revolution: Each click represents an 18-degree step with tactile feedback, giving precise step-by-step control for accurate input.
  • Quadrature Output for Direction Detection: Two digital output channels (CLK and DT) let your microcontroller determine both the direction and amount of rotation.
  • Built-in Pushbutton Switch: Press the encoder shaft to activate a normally-open momentary switch (active LOW), adding a second input for confirming selections or toggling modes.
  • On-Board 10K Ohm Pull-Up Resistors: Pull-up resistors on CLK, DT, and SW lines are included on the PCB, so no external resistors or extra components are needed.
  • 5V and 3.3V Compatible: Works with Arduino, Raspberry Pi, ESP32, STM32, Teensy, PIC, AVR, and other common microcontroller platforms.
  • Simple 5-Pin Interface: Connect CLK, DT, SW, power, and ground using standard jumper wires for fast, easy setup.

Specs

Switch encoder type, Rotary EncoderBrand, Envistia MallModel name, KY-040Volts, 5 VDimensions, 2.50 x 1.80 x 2.80 CentimetersHas written warranty, No

About this item

Product details

KY-040 Rotary Encoder Module with Pushbutton Switch

The KY-040 Rotary Encoder Module is a continuous 360-degree rotary input device with a built-in pushbutton switch. It outputs digital quadrature signals that let your microcontroller detect both the direction and amount of rotation. On-board 10K ohm pull-up resistors on all signal lines mean you can connect directly to an Arduino or other microcontroller with just jumper wires.

How It Works

  1. Connect the module's five pins (CLK, DT, SW, +, GND) to your microcontroller using jumper wires.
  2. As you turn the knob, two internal switches produce offset digital pulses on the CLK and DT pins.
  3. Your code compares the CLK and DT signals to determine which direction the knob is turning and how many steps it has moved.
  4. Press down on the encoder shaft to activate the built-in pushbutton switch, which pulls the SW pin LOW.

Specifications

  • Model: KY-040
  • Encoder Type: Incremental rotary encoder
  • Operating Voltage: 5V DC (also works with 3.3V)
  • Detents Per Revolution: 20 (18 degrees per detent)
  • Pulses Per Revolution: 20
  • Rotation: Continuous 360 degrees (no mechanical stops)
  • Pushbutton Switch: Normally open, momentary (active LOW)
  • On-Board Pull-Up Resistors: 10K ohm on CLK, DT, and SW
  • Output Signal: 2-bit quadrature (Gray code)
  • Module Dimensions: Approx. 30 x 18 x 30 mm (1.18 x 0.71 x 1.18 inches) L x W x H

What's in the Box

  • 1x KY-040 Rotary Encoder Module (with knob shaft)

Jumper wires, microcontroller board, and knob cap are not included. Any standard 6mm D-shaft knob will fit.

Compatible With

  • Arduino (Uno, Mega, Nano, Leonardo, Due, and compatibles)
  • Raspberry Pi (all models)
  • ESP32 and ESP8266
  • STM32, Teensy, PIC, and AVR microcontrollers

Typical Applications

  • Menu navigation and selection on LCD or OLED displays
  • Volume and brightness controls
  • Parameter adjustment (set points, thresholds, timer values)
  • Stepper and servo motor speed and direction control
  • CNC and 3D printer manual jog controls
  • DIY audio equipment (amplifiers, mixers)
  • Robotics steering and configuration input

Important Notes

  • Mechanical encoders produce contact bounce. Use software debouncing or add 100nF capacitors between CLK/GND and DT/GND for clean signals.
  • For best responsiveness, connect CLK and DT to interrupt-capable pins (Pins 2 and 3 on Arduino Uno).
  • Keep jumper wires under 20cm (8 inches) to minimize electrical noise.
  • Continuous 360-Degree Rotation: Spins freely in both directions with no mechanical stops, providing unlimited rotational input for menu navigation, volume controls, and parameter adjustment.
  • 20 Detents Per Revolution: Each click represents an 18-degree step with tactile feedback, giving precise step-by-step control for accurate input.
  • Quadrature Output for Direction Detection: Two digital output channels (CLK and DT) let your microcontroller determine both the direction and amount of rotation.
  • Built-in Pushbutton Switch: Press the encoder shaft to activate a normally-open momentary switch (active LOW), adding a second input for confirming selections or toggling modes.
  • On-Board 10K Ohm Pull-Up Resistors: Pull-up resistors on CLK, DT, and SW lines are included on the PCB, so no external resistors or extra components are needed.
  • 5V and 3.3V Compatible: Works with Arduino, Raspberry Pi, ESP32, STM32, Teensy, PIC, AVR, and other common microcontroller platforms.
  • Simple 5-Pin Interface: Connect CLK, DT, SW, power, and ground using standard jumper wires for fast, easy setup.
info:
We aim to show you accurate product information. Manufacturers, suppliers and others provide what you see here, and we have not verified it.  

Specifications

Switch encoder type

Rotary Encoder

Brand

Envistia Mall

Model name

KY-040

Volts

5 V

Warranty

Warranty information

Please be aware that the warranty terms on items offered for sale by third party Marketplace sellers may differ from those displayed in this section (if any). To confirm warranty terms on an item offered for sale by a third party Marketplace seller, please use the 'Contact seller' feature on the third party Marketplace seller's information page and request the item's warranty terms prior to purchase.

Customer ratings & reviews

0 out of 5 stars
0 ratings|0 reviews
This item does not have any reviews yet
Current price is $6.29
Price when purchased online
  • Free shipping
  • Free Holiday returns until Jan 31

How do you want your item?

How do you want your item?
Ships to
Arrives by Sat, Nov 21
|
Sold and shipped by Envistia Mall
4.487179487179487 out of 5 stars
4.5 stars out of 5, based on 156 seller reviews(4.5)
Extended holiday returns
Free Holiday returns until Jan 31