User Manual

84
Lesson 12 Rotary Encoder
Introduction
A rotary encoder is an electro-mechanical dev ice 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-rev erse cable
Experimental Principle
A rotary encoder is an electronic switch with a set of regular pulses with strictly timing
sequence. When used with IC, it can achieve increment, decrement, page turning and
other operations such as mouse scrolling, menu selection, and so on.
There are mainly two types of rotary encoders: absolute and incremental (relative) encoders.
Here we use an incremental (relative) encoders.
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. Pin 4 is generally connected to
ground. Pin 3 and pin 5 are first connected to pull-up resistor and connect to VCC. Pin 3 and
pin 5 generate two-phase square waves whose phase difference is 90°. Usually the two-
phase square waves are called channel A and channel B as shown below:
SunFounder