
The basic function of a rotary encoder can be explained by considering it as a combination of two switches that close or open due to rotation of the shaft.Īs the shaft rotates, the switches are closed and opened in a pattern. This type provides an instantaneous result about the rotating shaft by generating two square wave outputs that are 90 degrees out of phase with each other.Ī rotary encoder has to coding pins A and B produce either High or Low output depending on the rotation and direction of the shaft. The commonly used rotary encoder is an incremental rotary encoder. There is a select switch associated with the rotary encoders that can be activated by pushing the knob. Introduction to Rotary EncodersĪ Rotary Encoder is an input device that provides the information about the direction and amount of rotation of the knob. Get EC11 Rotary Encoder Module_SKU SEN0235 from DFRobot Store or DFRobot Distributor.Select the Next Set of Arduino Projects You Want to Learn in Electronicshub : Arduino Projects» Hardware Required Dimension EC11 Forward Direction Series Specification.pdf.LastEncoded = encoded //store this value for next timeįor any questions, advice or cool ideas to share, please visit the DFRobot Forum. Int sum = (lastEncoded << 2) | encoded //adding it to the previous encoded value Int encoded = (MSB << 1) |LSB //converting the 2 pin value to single number Int LSB = digitalRead(encoderPinB) //LSB = least significant bit Int MSB = digitalRead(encoderPinA) //MSB = most significant bit Serial.println("you push button down!!!") ĭelay(50) //just here to slow down the output, and show it will work even during a delay on interrupt 0 (pin 2), or interrupt 1 (pin 3)ĪttachInterrupt(0, updateEncoder, CHANGE) ĪttachInterrupt(1, updateEncoder, CHANGE) call updateEncoder() when any high/low changed seen Arduino IDE (Version requirements: V1.6.?), ĭigitalWrite(encoderPinA, HIGH) //turn pullup resistor onĭigitalWrite(encoderPinB, HIGH) //turn pullup resistor on.Module Size: 33.8 * 22.4 (mm) /1.3 * 1.1 (inches)ĬW Direction: phase A B signal: Tutorial Requirements.Full Rotation Angle: 360 degrees (no stop point).The rotary encoder module comes with XH2.54 bonding pad, easy to be used in prototyping projects, like automotive electronics, multimedia speakers, instrumentation, smart home and other fields. It is very suitable for applications such as volume knob, lighting adjustment. This module has three signal terminals: terminal A & B is encoder output terminal C is button signal output. EC11_Rotary_Encoder_Module_SKU_SEN0235-DFRobotĭFRobot 360 degree rotary encoder module is designed based on EC11 rotary encoder button.
