KY-040 Rotary Encoder Module
SKU: 01591
Availability: IN STOCK

₹80.83 inc. GST
Ex GST: ₹68.50
Qty:
 

QuantityPrice
50 + ₹76.70
More Quantity?RFQ

Additional Info
  • Prices shown are Including GST.
  • B2B GST Credit Available.
  • Economy shipping at flat ₹59.
  • Free shipping on value > ₹2499.
  • Whatsapp Support @+917231066325
  • Estimated Delivery time?
  • Manufacturing Services

  • KY-040 Rotary Encoder Module 

    This KY-040 Rotary Encoder  based module can be used in variety of rotation encoding functions such as shaft rotation positioning, DSO controles, Digital controlled power supplies, Digital Instruments controls etc. It also has a push switch that can be used to extend functionality of this module.

    Pin Out - 

    GND -  Common

    Power - 5V

    SW - Push switch connection

    DT - Direction

    CLK - Clock


    How to use?

    Using this rotary encoder is straight forward, we have to monitor both CLK and DT pins simultaneously. Whenever the CLK signal changes state to RISING edge or FALLING edge, DT signal's logical state determines the direction of rotation. Each full 360 degree revolution gives 20 pulses on Clock pin.

    From the image above we can deduce that,

    At Falling edge of CLOCK if DT is HIGH - it indicates CW rotation, else CCW.


    Arduino Sketch

    int CLK = 2; // CLK Pin to Pin 2 of Arduino, EXT INT
    int DIR = 3; // DT Pin to Pin 3 of Arduino
    bool DT; // LOW -> CW, HIGH -> CCW
    int count = 0;
    
    void setup() {
     pinMode(DIR, INPUT);
     Serial.begin(9600);
     attachInterrupt(digitalPinToInterrupt(CLK),CW_Test,FALLING);
    }
    
    void loop() {
      Serial.println(DT);
      Serial.println("\n");
      Serial.println(count);
      delay(200);
    }
    
    void CW_Test(){
      
      bool val = digitalRead(DIR);
      if(val == HIGH)
      {
        DT = LOW;
        count = count + 1;
      }
      else
      {
        DT = HIGH;
        count = count-1;
      }
    }
    


    Dimensions - 
     
    PCB Size - 26mm x 18mm
    Shaft Diameter - 6mm, D Shaped

     

    Write a review

    Your Name:


    Your Review: Note: HTML is not translated!

    Rating: Bad           Good

    Enter the code in the box below: