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

  • $1.39


The KY-040 rotary encoder is a 360-degree rotary input device (i.e. a control knob) that provides an indication of how much the knob has been rotated AND which direction it is rotating in.

It is a great device for stepper and servo motor control. You can also use it to control devices like digital potentiometers.

The KY-040 rotary encoder has a fixed number of 20 positions per revolution. These positions are felt as small “clicks” when you turn the encoder. Inside the encoder, there are two switches. One switch connects pin A to pin C and the other switch connects pin B to C. In each encoder position, both switches are either opened or closed. Each click causes these switches to change states. If both switches are closed, turning the encoder either clockwise or counterclockwise one position will cause both switches to open. If both switches are open, turning the encoder either clockwise or counterclockwise one position will cause both switches to close.

Determining which switch changed states first is how the direction of rotation is determined. If A changed states first, the switch is rotating in a clockwise direction. If B changed states first, the switch is rotating in a counter clockwise direction.

A push button switch is built into this encoder. If you push on the shaft, the normally open switch "SW" will close. This can be used as an On/Off switch, or to change control functions, ranges, etc.

Features & Specifications:

  • Working voltage: 5V
  • Pulses per 360-degree revolution: 20
  • Push button shaft On/Off switch
  • Threaded shaft for panel mounting, also 2 mounting screw holes on the circuit board
  • Standard "D" shaft, you can purchase knobs to give it a finished look
  • Size: 2.5 x 1.8 x 2.8 cm (L x W x H)

KY-040 Pin Outs:

CLK: Encoder Pin A
DT: Encoder Pin B
SW: Pushbutton On/Off Switch
+: +5V DC Power Supply
GND: Ground (Encoder Pin C)

For a detailed description and operating overview of the KY-040, see "Keyes KY-040 Arduino Rotary Encoder User Manual" on Henry's Bench.

Package Includes:

1X KY-040 Rotary Encode Module

Get it faster! We ship in 1 business day from our US facility in Colorado for quick delivery.

Please contact us for quantity/OEM pricing.

Looking for a digital encoder component (not board mounted? See our EC11 Rotary Encoder Digital Potentiometer 20mm D Shaft with Switch