Our first task for our servo example is to wire it up to a power source and our Raspberry Pi. A schematic representing this wiring is shown here:
Figure 10.2 – Servo wiring schematic
Let's get started wiring our servo using a breadboard, as shown:
Figure 10.3 – Servo breadboard layout
Before we step through the wiring procedure, first I want to briefly discuss the wire colors coming out of a servo. While servo wire colors are somewhat standard, they can vary between different manufacturers and servos. Use the following pointers when connecting your servo at steps 4, 5, and 6. If your servo has colored wires that I do not list in the following list, you will need to consult the datasheet for your servo.Â
Common servo wire colors are as follows:
- The brown or black wire connects to GND
- The red wire connects to +5-volts
- The orange, yellow, white, or blue wire is the signal/PWM input wire that connects to a GPIO pin...