{"product_id":"rotary-encoder-module-clk-dt-sw-20-detents-arduino-ky-040","title":"Rotary Encoder Module — CLK\/DT\/SW Output, 20 Detents, Arduino Compatible (KY-040)","description":"\u003ch2\u003eRotary Encoder Module — CLK\/DT\/SW Output, 20 Detents, Arduino Compatible (KY-040)\u003c\/h2\u003e\n\n\u003cp\u003eThis \u003cstrong\u003erotary encoder module\u003c\/strong\u003e (KY-040 compatible) is an incremental position sensor that reports the direction and amount of shaft rotation, plus a pushbutton press when the shaft is depressed. It's the essential input device for Arduino menu navigation, volume control, and any application requiring continuous rotary input without a mechanical stop. The module includes a built-in pull-up resistor on the SW pin and a 5-pin header for direct connection to Arduino.\u003c\/p\u003e\n\n\u003ch3\u003eModule Specifications\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eType:\u003c\/strong\u003e Incremental rotary encoder (no absolute position)\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eDetents per Revolution:\u003c\/strong\u003e 20 (20 clicks = 1 full rotation)\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eOutputs:\u003c\/strong\u003e CLK (A), DT (B), SW (pushbutton)\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eOperating Voltage:\u003c\/strong\u003e 3.3V – 5V DC\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003ePushbutton:\u003c\/strong\u003e Active LOW (shaft press)\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eRotation:\u003c\/strong\u003e Continuous (no mechanical stop, infinite turns)\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003ePCB Dimensions:\u003c\/strong\u003e 26 × 20mm\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eShaft Height:\u003c\/strong\u003e 30mm total\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003e5-Pin Header Connections\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eGND:\u003c\/strong\u003e Ground\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003e+:\u003c\/strong\u003e VCC (3.3V or 5V)\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eSW:\u003c\/strong\u003e Pushbutton output (active LOW) → Arduino digital input\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eDT:\u003c\/strong\u003e Direction output (B phase, 90° lag) → Arduino digital input\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eCLK:\u003c\/strong\u003e Clock output (A phase) → Arduino digital input\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eDirection Detection Logic\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eClockwise (CW):\u003c\/strong\u003e When CLK changes state, DT ≠ CLK\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eCounter-Clockwise (CCW):\u003c\/strong\u003e When CLK changes state, DT = CLK\u003c\/li\u003e\n  \u003cli\u003eCompare CLK and DT states on each CLK edge to determine rotation direction\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eArduino Wiring\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eGND → Arduino GND | + → 5V\u003c\/li\u003e\n  \u003cli\u003eCLK → D6 | DT → D5 | SW → D7 (with INPUT_PULLUP)\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTypical Applications\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eLCD menu navigation:\u003c\/strong\u003e Scroll through menu items (rotate) and select (press) — the most common use case\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eVolume \/ parameter control:\u003c\/strong\u003e Adjust audio volume, motor speed, or any continuous parameter\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eStepper motor control:\u003c\/strong\u003e Rotate encoder to drive stepper motor in same direction and amount\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eOdometer \/ distance measurement:\u003c\/strong\u003e Attach wheel to shaft and count pulses for distance\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003ePosition tracking:\u003c\/strong\u003e Track relative position from power-on reference point\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003ePackage Contents\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e1 × Rotary encoder module (KY-040 compatible) with 5-pin header\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003cp\u003e20 detents, infinite rotation, CLK\/DT\/SW outputs — the KY-040 rotary encoder module is the go-to input device for Arduino menu navigation, volume control, and continuous rotary position sensing.\u003c\/p\u003e","brand":"Keszoox","offers":[{"title":"Default Title","offer_id":45683869581547,"sku":"","price":5.12,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0677\/1005\/8731\/files\/Rotary-Encoder-Module.jpg?v=1723004856","url":"https:\/\/keszoox.com\/products\/rotary-encoder-module-clk-dt-sw-20-detents-arduino-ky-040","provider":"Keszoox","version":"1.0","type":"link"}