The first step is to wire up and configure the drive electronics and motors that will move the various parts of the robot arm; this will consist of four micro servos that will move the arm, and two geared motors that will provide drive to the chassis.
The servos are powered by a 5 V power supply and can be driven using a pulsed digital signal (through Pulse Width Modulation (PWM)) from the Pi GPIO ports, which define the position that the arm of the servo is to be kept in.
The motors will be driven using a relay board, which allows the Pi GPIO port to switch the higher currents needed to power the motor. This is just one of the many ways this can be done. Another possibility is to use a MOSFET H-bridge, which will also allow control of the speed of the motors. However, the relay solution is simpler in both code and electronic construction, so it will be used here.
The wiring for the drive electronics is shown in the following diagram:
The wiring of the Pi GPIO header is shown in greater detail in the following diagram:
We will start by constructing the power board; this is simply two sets of 0.1 inch pin headers on a small section of the stripboard that will distribute the 5 V and ground power rails. We will need at least seven headers for both the 5 V and ground rails; however, adding more headers will allow possible expansion later.
The board should be laid out as shown in the following diagram:
Now that we have all the parts needed for the drive electronics, we can start assembling them to test with the web application, later in the chapter:
Now that the wiring is complete, attach the USB power bank to the USB cable to provide power to the Pi and servos. Ensure that you use the higher output current port on the bank (usually marked as either 2.1 A or used for tablet charging) and connect a 9 V PP3 battery to the battery clip attached to the relay board.
3.12.123.2