Attaching encoders to the robot
Our robot is now getting quite busy, and our Raspberry Pi is above the encoder's slots. Due to the slots being under the Raspberry Pi, we should wire them in a little before returning the Raspberry Pi. After bolting in the Raspberry Pi, we wire the encoders to its GPIO, as well as the power and ground.
Figure 11.5 shows what the robot block diagram looks like after attaching the encoders:
This block diagram adds a left and right encoder, each with an arrow for the information flow connecting them to the Raspberry Pi. The highlighted elements are the new ones.
Before we start changing the robot and making it harder to see, we need to know the number of slots in the encoder wheel for later:
My encoder wheels, shown in Figure 11.6, ended up having 20 slots. Ensure you use the number of spaces your...