User Manual

127
Lesson 27 Rotary Encoder Module
Introduction
A rotary encoder is an electro-mechanical device that converts the angular position or
motion of a shaft or axle to analog or digital code. Rotary encoders are usually placed at
the side which is perpendicular to the shaft. They act as sensors for detecting angle, speed,
length, position, and acceleration in automation field.
Components
- 1 * Raspberry Pi
- 1 * Breadboard
- 4 * Jumper wires (Male to Male, 2 red and 2 black)
- 1 * Network cable (or USB wireless network adapter)
- 1 * Rotary Encoder module
- 1 * 5-Pin anti-reverse cable
Experimental Principle
Most rotary encoders have 5 pins with three functions of turning left & right and pressing down.
Pin 1 and pin 2 are switch wiring terminals used to press. They are similar to buttons previously
mentioned, so we will no longer discuss them in this experiment. Pin 4 is generally connected
to ground. Pin 3 and pin 5 are first connected to pull-up resistor and then to the
microprocessor. In this experiment, they are connected to GPIO0 and GPIO1 of Raspberry Pi.
When it is rotated left and right, there will be pulse inputs in pin 1 and pin 3.