1 to 8 PCS KY-040 360 Degrees Rotary Encoder Module with Knob Cap 5V Brick Sensor Switch Development Board Module for R3 Board

1 to 8 PCS KY-040 360 Degrees Rotary Encoder Module with Knob Cap 5V Brick Sensor Switch Development Board Module for R3 Board

4 PCS KY-040
$26.33
Sale price  $26.33 Regular price  $0.00
Skip to product information
1 to 8 PCS KY-040 360 Degrees Rotary Encoder Module with Knob Cap 5V Brick Sensor Switch Development Board Module for R3 Board
1 to 8 PCS KY-040 360 Degrees Rotary Encoder Module with Knob Cap 5V Brick Sensor Switch Development Board Module for R3 Board
$26.33
Sale price  $26.33 Regular price  $0.00
Color
Description

SPECIFICATIONS

Brand Name: NONE

Choice: yes

Condition: New

High-concerned chemical: none

Origin: Mainland China

Package: SMD

Quantity: 1

Type: Voltage Regulator

is_customized: Yes

KY-040 Rotary Encoder Module 360 Degree 20 Pulse with Knob Cap 5V for Arduino DIY Electronics

Key Features & Benefits

πŸ”„ 360Β° Infinite Rotation: No mechanical stops – longer lifespan.

πŸŽ›οΈ 20 Pulses Per Revolution: High precision with direction detection.

πŸ”˜ Built-in Push Button: Press shaft for menu confirmation or reset.

πŸ”Œ 5V Compatible: Onboard pull‑up resistors and debounce capacitors.

🎨 Knob Cap Included: Red/black cap, comfortable feel.

🧩 Plug & Play: 5‑pin header (GND, +, SW, DT, CLK).

Product Description

Need intuitive menu control for your Arduino project? KY‑040 rotary encoder module is the perfect choice. 360Β° infinite rotation, 20 pulses per revolution, built‑in push button. Onboard pull‑ups and debounce caps for clean signals. Includes comfortable knob cap. Perfect for digital volume controls, motor position sensing, Arduino menu navigation.

⚑ Quick Start Guide & Important Tips

πŸ”Ή What It Does & What You Need
βœ… This product does:

Detects rotation direction and angle (incremental encoder)

20 pulses per revolution (20 PPR)

Built‑in push button for click actions

Digital output – direct MCU connection
❌ This product does NOT: Output analog value, remember position after power loss (incremental only), work directly with 3.3V systems
πŸ”§ You will need: Arduino/5V MCU, jumper wires, 5V power supply
πŸ“¦ Package includes: KY‑040 Module with Knob Cap Γ— (as per SKU)

πŸ”Ή Pinout

⚠️ Critical Warnings:

Voltage: 5V only. For 3.3V systems (ESP32), use a level shifter.

Signal decoding: Must decode both CLK and DT to determine direction.

Contact bounce: Add software debouncing for reliable readings.

No absolute position: Code must maintain a counter; position lost on power loss.

πŸ”Ή Arduino Example Code

const int clkPin = 4;
const int dtPin = 3;
const int swPin = 2;
volatile int counter = 0;
volatile int lastClkState;
int lastSwState = HIGH;

void setup() {
Serial.begin(9600);
pinMode(clkPin, INPUT_PULLUP);
pinMode(dtPin, INPUT_PULLUP);
pinMode(swPin, INPUT_PULLUP);
lastClkState = digitalRead(clkPin);
attachInterrupt(digitalPinToInterrupt(clkPin), readEncoder, CHANGE);
}

void loop() {
int swState = digitalRead(swPin);
if (swState == LOW && lastSwState == HIGH) {
Serial.println("Button pressed!");
delay(50);
}
lastSwState = swState;
Serial.println(counter);
delay(100);
}

void readEncoder() {
int clkState = digitalRead(clkPin);
if (clkState != lastClkState) {
if (digitalRead(dtPin) != clkState) counter++;
else counter--;
}
lastClkState = clkState;
}

πŸ”Ή Common Questions

❓ Jumpy values when rotating?
Contact bounce – add software debouncing (e.g., small delay or filtering).

❓ Use with ESP32?
Not directly – 5V signal may damage 3.3V GPIO. Use level shifter.

❓ Position lost after power cycle?
Normal for incremental encoders. Save counter to EEPROM if needed.

❓ Knob cap included?
Yes – included and pre‑installed.

Specifications

Encoder Module (KY-040)

Model: KY-040

Voltage: 5V

Resolution: 20 PPR

Rotation: 360Β° infinite

Switch: Push button

Output Signals: CLK, DT, SW

Pins: 5 (GND, +, SW, DT, CLK)

Knob Cap: Included (ABS, ~15Γ—16.5mm)

Module Size: ~30Γ—19Γ—29mm (without knob)

Shaft Length: ~20mm

Compatible: Arduino, 5V systems (level shifter needed for 3.3V)

Note: Manual measurement, allow 1‑3mm error. Colors may vary.


Free Shipping Over $199
  • Standard Shipping: Standard Shipping (12–18 Business Days)
  • Express Shipping: Expedited Shipping (5–9 Business Days)
  • Free Shipping: Orders over $199 qualify automatically
  • Tracking: Full tracking number provided for all orders
30-Day Return Policy
  • Returns: 30-day hassle-free return window
  • Condition: Items must be unused and in original packaging
  • Refund: Full refund processed within 3-5 business days
Why Choose Us?
  • Factory Direct: ISO/TS 16949 certified manufacturer
  • Quality: 100% electrical continuity tested before shipment
  • Experience: 15+ years in automotive connector industry
  • Support: Professional technical support available
Secure Payment Latest encryption technology
Money-Back Guarantee 30-day hassle-free returns
Quality Assured Factory certified products
Global Fast Shipping Worldwide express delivery

You may also like

Contact us

Subscribe to our emails

Be the first to know about new collections and special offers.