Wiring in encoders on a Raspberry Pi Pico robot
Our robot has already got encoders on board, and we have already wired them in. We can take a closer look at the motors and how they are wired into Raspberry Pi Pico GPIO pins to understand the robot better.
Examining the motors
We use N20 geared motors with encoders. The following diagram labels the motor parts:
Figure 6.3 – The N20 motor parts
Figure 6.3 shows a drawing of the motors we have used. Marked on it are essential features that affect how we use the encoders. On the left is a magnetic disk with markers in it. This disk is attached to the motor’s driveshaft and sensed by the encoder sensor board. On the right are the gearbox and the motor output shaft.
The driveshaft goes through the gearbox, so the output shaft will not make the same number of rotations as the disk – the gear ratio will determine this relationship. So one revolution of the output wheel could count many...