{"product_id":"1-to-8-pcs-ky-040-360-degrees-rotary-encoder-module-with-knob-cap-5v-brick-sensor-switch-development-board-module-for-r3-board","title":"1 to 8 PCS KY-040 360 Degrees Rotary Encoder Module with Knob Cap 5V Brick Sensor Switch Development Board Module for R3 Board","description":"\u003ch1\u003eSPECIFICATIONS\u003c\/h1\u003e\u003cp\u003e\u003cspan\u003eBrand Name\u003c\/span\u003e: \u003cspan style=\"color:#333\"\u003eNONE\u003c\/span\u003e\u003c\/p\u003e\u003cp\u003e\u003cspan\u003eChoice\u003c\/span\u003e: \u003cspan style=\"color:#333\"\u003eyes\u003c\/span\u003e\u003c\/p\u003e\u003cp\u003e\u003cspan\u003eCondition\u003c\/span\u003e: \u003cspan style=\"color:#333\"\u003eNew\u003c\/span\u003e\u003c\/p\u003e\u003cp\u003e\u003cspan\u003eHigh-concerned chemical\u003c\/span\u003e: \u003cspan style=\"color:#333\"\u003enone\u003c\/span\u003e\u003c\/p\u003e\u003cp\u003e\u003cspan\u003eOrigin\u003c\/span\u003e: \u003cspan style=\"color:#333\"\u003eMainland China\u003c\/span\u003e\u003c\/p\u003e\u003cp\u003e\u003cspan\u003ePackage\u003c\/span\u003e: \u003cspan style=\"color:#333\"\u003eSMD\u003c\/span\u003e\u003c\/p\u003e\u003cp\u003e\u003cspan\u003eQuantity\u003c\/span\u003e: \u003cspan style=\"color:#333\"\u003e1\u003c\/span\u003e\u003c\/p\u003e\u003cp\u003e\u003cspan\u003eType\u003c\/span\u003e: \u003cspan style=\"color:#333\"\u003eVoltage Regulator\u003c\/span\u003e\u003c\/p\u003e\u003cp\u003e\u003cspan\u003eis_customized\u003c\/span\u003e: \u003cspan style=\"color:#333\"\u003eYes\u003c\/span\u003e\u003c\/p\u003e\u003cdiv class=\"detailmodule_html\"\u003e\u003cdiv class=\"detail-desc-decorate-richtext\"\u003e\n\u003cp style=\"font-size:16px;font-weight:bold;text-align:left;color:rgb(67, 70, 73)\" class=\"word-break white-space mt-10\" align=\"left\"\u003eKY-040 Rotary Encoder Module 360 Degree 20 Pulse with Knob Cap 5V for Arduino DIY Electronics\u003c\/p\u003e\n\u003cp style=\"font-size:16px;font-weight:bold;text-align:left;color:rgb(67, 70, 73)\" class=\"word-break white-space mt-10\" align=\"left\"\u003eKey Features \u0026amp; Benefits\u003c\/p\u003e\n\u003cp style=\"font-size:13px;font-weight:normal;text-align:left;color:rgb(67, 70, 73)\" class=\"word-break white-space mt-10\" align=\"left\"\u003e🔄 360° Infinite Rotation: No mechanical stops – longer lifespan.\u003cbr\u003e\u003cbr\u003e🎛️ 20 Pulses Per Revolution: High precision with direction detection.\u003cbr\u003e\u003cbr\u003e🔘 Built-in Push Button: Press shaft for menu confirmation or reset.\u003cbr\u003e\u003cbr\u003e🔌 5V Compatible: Onboard pull‑up resistors and debounce capacitors.\u003cbr\u003e\u003cbr\u003e🎨 Knob Cap Included: Red\/black cap, comfortable feel.\u003cbr\u003e\u003cbr\u003e🧩 Plug \u0026amp; Play: 5‑pin header (GND, +, SW, DT, CLK).\u003c\/p\u003e\n\u003cp style=\"font-size:16px;font-weight:bold;text-align:left;color:rgb(67, 70, 73)\" class=\"word-break white-space mt-10\" align=\"left\"\u003eProduct Description\u003c\/p\u003e\n\u003cp style=\"font-size:13px;font-weight:normal;text-align:left;color:rgb(67, 70, 73)\" class=\"word-break white-space mt-10\" align=\"left\"\u003eNeed 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.\u003c\/p\u003e\n\u003cp style=\"font-size:16px;font-weight:bold;text-align:left;color:rgb(67, 70, 73)\" class=\"word-break white-space mt-10\" align=\"left\"\u003e⚡ Quick Start Guide \u0026amp; Important Tips\u003c\/p\u003e\n\u003cp style=\"font-size:13px;font-weight:normal;text-align:left;color:rgb(67, 70, 73)\" class=\"word-break white-space mt-10\" align=\"left\"\u003e🔹 What It Does \u0026amp; What You Need\u003cbr\u003e✅ This product does:\u003cbr\u003e\u003cbr\u003eDetects rotation direction and angle (incremental encoder)\u003cbr\u003e\u003cbr\u003e20 pulses per revolution (20 PPR)\u003cbr\u003e\u003cbr\u003eBuilt‑in push button for click actions\u003cbr\u003e\u003cbr\u003eDigital output – direct MCU connection\u003cbr\u003e❌ This product does NOT: Output analog value, remember position after power loss (incremental only), work directly with 3.3V systems\u003cbr\u003e🔧 You will need: Arduino\/5V MCU, jumper wires, 5V power supply\u003cbr\u003e📦 Package includes: KY‑040 Module with Knob Cap × (as per SKU)\u003c\/p\u003e\n\u003cp style=\"font-size:16px;font-weight:bold;text-align:left;color:rgb(67, 70, 73)\" class=\"word-break white-space mt-10\" align=\"left\"\u003e🔹 Pinout\u003c\/p\u003e\n\u003cdiv\u003e\u003cimg style=\"width:100%;height:auto\" width=\"100%\" height=\"auto\" src=\"https:\/\/ae-pic-a1.aliexpress-media.com\/kf\/S11b27b0f672640af93f15b82cefa1bfaB.jpg\" slate-data-type=\"image\"\u003e\u003c\/div\u003e\n\u003cp style=\"font-size:16px;font-weight:bold;text-align:left;color:rgb(67, 70, 73)\" class=\"word-break white-space mt-10\" align=\"left\"\u003e⚠️ Critical Warnings:\u003c\/p\u003e\n\u003cp style=\"font-size:13px;font-weight:normal;text-align:left;color:rgb(67, 70, 73)\" class=\"word-break white-space mt-10\" align=\"left\"\u003eVoltage: 5V only. For 3.3V systems (ESP32), use a level shifter.\u003cbr\u003e\u003cbr\u003eSignal decoding: Must decode both CLK and DT to determine direction.\u003cbr\u003e\u003cbr\u003eContact bounce: Add software debouncing for reliable readings.\u003cbr\u003e\u003cbr\u003eNo absolute position: Code must maintain a counter; position lost on power loss.\u003c\/p\u003e\n\u003cp style=\"font-size:16px;font-weight:bold;text-align:left;color:rgb(67, 70, 73)\" class=\"word-break white-space mt-10\" align=\"left\"\u003e🔹 Arduino Example Code\u003c\/p\u003e\n\u003cp style=\"font-size:13px;font-weight:normal;text-align:left;color:rgb(67, 70, 73)\" class=\"word-break white-space mt-10\" align=\"left\"\u003econst int clkPin = 4;\u003cbr\u003econst int dtPin = 3;\u003cbr\u003econst int swPin = 2;\u003cbr\u003evolatile int counter = 0;\u003cbr\u003evolatile int lastClkState;\u003cbr\u003eint lastSwState = HIGH;\u003cbr\u003e\u003cbr\u003evoid setup() {\u003cbr\u003eSerial.begin(9600);\u003cbr\u003epinMode(clkPin, INPUT_PULLUP);\u003cbr\u003epinMode(dtPin, INPUT_PULLUP);\u003cbr\u003epinMode(swPin, INPUT_PULLUP);\u003cbr\u003elastClkState = digitalRead(clkPin);\u003cbr\u003eattachInterrupt(digitalPinToInterrupt(clkPin), readEncoder, CHANGE);\u003cbr\u003e}\u003cbr\u003e\u003cbr\u003evoid loop() {\u003cbr\u003eint swState = digitalRead(swPin);\u003cbr\u003eif (swState == LOW \u0026amp;\u0026amp; lastSwState == HIGH) {\u003cbr\u003eSerial.println(\"Button pressed!\");\u003cbr\u003edelay(50);\u003cbr\u003e}\u003cbr\u003elastSwState = swState;\u003cbr\u003eSerial.println(counter);\u003cbr\u003edelay(100);\u003cbr\u003e}\u003cbr\u003e\u003cbr\u003evoid readEncoder() {\u003cbr\u003eint clkState = digitalRead(clkPin);\u003cbr\u003eif (clkState != lastClkState) {\u003cbr\u003eif (digitalRead(dtPin) != clkState) counter++;\u003cbr\u003eelse counter--;\u003cbr\u003e}\u003cbr\u003elastClkState = clkState;\u003cbr\u003e}\u003c\/p\u003e\n\u003cp style=\"font-size:16px;font-weight:bold;text-align:left;color:rgb(67, 70, 73)\" class=\"word-break white-space mt-10\" align=\"left\"\u003e🔹 Common Questions\u003c\/p\u003e\n\u003cp style=\"font-size:13px;font-weight:normal;text-align:left;color:rgb(67, 70, 73)\" class=\"word-break white-space mt-10\" align=\"left\"\u003e❓ Jumpy values when rotating?\u003cbr\u003eContact bounce – add software debouncing (e.g., small delay or filtering).\u003cbr\u003e\u003cbr\u003e❓ Use with ESP32?\u003cbr\u003eNot directly – 5V signal may damage 3.3V GPIO. Use level shifter.\u003cbr\u003e\u003cbr\u003e❓ Position lost after power cycle?\u003cbr\u003eNormal for incremental encoders. Save counter to EEPROM if needed.\u003cbr\u003e\u003cbr\u003e❓ Knob cap included?\u003cbr\u003eYes – included and pre‑installed.\u003c\/p\u003e\n\u003cp style=\"font-size:16px;font-weight:bold;text-align:left;color:rgb(67, 70, 73)\" class=\"word-break white-space mt-10\" align=\"left\"\u003eSpecifications\u003c\/p\u003e\n\u003cp style=\"font-size:13px;font-weight:normal;text-align:left;color:rgb(67, 70, 73)\" class=\"word-break white-space mt-10\" align=\"left\"\u003eEncoder Module (KY-040)\u003cbr\u003e\u003cbr\u003eModel: KY-040\u003cbr\u003e\u003cbr\u003eVoltage: 5V\u003cbr\u003e\u003cbr\u003eResolution: 20 PPR\u003cbr\u003e\u003cbr\u003eRotation: 360° infinite\u003cbr\u003e\u003cbr\u003eSwitch: Push button\u003cbr\u003e\u003cbr\u003eOutput Signals: CLK, DT, SW\u003cbr\u003e\u003cbr\u003ePins: 5 (GND, +, SW, DT, CLK)\u003cbr\u003e\u003cbr\u003eKnob Cap: Included (ABS, ~15×16.5mm)\u003cbr\u003e\u003cbr\u003eModule Size: ~30×19×29mm (without knob)\u003cbr\u003e\u003cbr\u003eShaft Length: ~20mm\u003cbr\u003e\u003cbr\u003eCompatible: Arduino, 5V systems (level shifter needed for 3.3V)\u003c\/p\u003e\n\u003cdiv\u003e\n\u003cimg style=\"width:100%;height:auto\" width=\"100%\" height=\"auto\" src=\"https:\/\/ae-pic-a1.aliexpress-media.com\/kf\/S49759e327e66401fa2092aa4bac1dde5I.jpg\" slate-data-type=\"image\"\u003e\u003cimg style=\"width:100%;height:auto\" width=\"100%\" height=\"auto\" src=\"https:\/\/ae-pic-a1.aliexpress-media.com\/kf\/S50de88b80d0f4febb122c3fb3eba79dff.jpg\" slate-data-type=\"image\"\u003e\u003cimg style=\"width:100%;height:auto\" width=\"100%\" height=\"auto\" src=\"https:\/\/ae-pic-a1.aliexpress-media.com\/kf\/S26c661a4849946b39058b219324140d84.jpg\" slate-data-type=\"image\"\u003e\n\u003c\/div\u003e\n\u003cp style=\"font-size:16px;font-weight:bold;text-align:left;color:rgb(67, 70, 73)\" class=\"word-break white-space mt-10\" align=\"left\"\u003eNote: Manual measurement, allow 1‑3mm error. Colors may vary.\u003c\/p\u003e\n\u003c\/div\u003e\u003c\/div\u003e\u003cp\u003e\u003cbr\u003e\u003c\/p\u003e","brand":"Yoeruyo","offers":[{"title":"4 PCS KY-040","offer_id":55428167958827,"sku":"14:201659813#4 PCS KY-040","price":26.33,"currency_code":"USD","in_stock":true},{"title":"1 PCS KY-040","offer_id":55428167991595,"sku":"14:94#1 PCS KY-040","price":10.89,"currency_code":"USD","in_stock":true},{"title":"6 PCS KY-040","offer_id":55428168024363,"sku":"14:351074#6 PCS KY-040","price":37.08,"currency_code":"USD","in_stock":true},{"title":"3 PCS KY-040","offer_id":55428168057131,"sku":"14:10#3 PCS KY-040","price":18.5,"currency_code":"USD","in_stock":true},{"title":"7 PCS KY-040","offer_id":55428168089899,"sku":"14:350852#7 PCS KY-040","price":41.63,"currency_code":"USD","in_stock":true},{"title":"2 PCS KY-040","offer_id":55428168122667,"sku":"14:29#2 PCS KY-040","price":14.22,"currency_code":"USD","in_stock":true},{"title":"8 PCS KY-040","offer_id":55428168155435,"sku":"14:1202#8 PCS KY-040","price":60.8,"currency_code":"USD","in_stock":true},{"title":"5 PCS KY-040","offer_id":55428168188203,"sku":"14:4044226#5 PCS KY-040","price":28.53,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/1000\/5744\/8747\/files\/S9c39df8e8fb74506aaebb3f63ed78ac8N.webp?v=1788580680","url":"https:\/\/yoeruyo.com\/products\/1-to-8-pcs-ky-040-360-degrees-rotary-encoder-module-with-knob-cap-5v-brick-sensor-switch-development-board-module-for-r3-board","provider":"Yoeruyo","version":"1.0","type":"link"}