Artificial Intelligence for Robotics
上QQ阅读APP看书,第一时间看更新

Wiring

The power wiring diagram is included by way of illustration. We have four main electronic components: the Raspberry Pi 3, our robot's brain; the Arduino Mega; the motor shield; and the servo controller. We will be needing two sets of power – the Pi and servo controller need 5v, while the motor controller needs the full 11 volts from the battery pack. I purchased a 5v power supply to convert the battery to 11v. The motor controller needs power on the screw terminals labeled "EXT_PWR". Hence, we need to create a power harness with two splits – one split that puts 11v into the power supply board and the motor controller. We can then wire 5v from the power supply board to the Pi 3. A second 5v goes to the "servo power" connection on the servo controller board. This is the two-pin connector that is aligned with the six servo three-pin connectors, as can be seen in the following diagram:

The Pi 3 has sufficient power on its USB interface to power the Arduino (that has almost no load on it) and on the servo controller logic circuit, which also takes very little power. We run USB cables from Pi 3 to Arduino, and from Pi 3 to the servo controller. Later, we will plug a USB camera into the Pi 3 as well. If we need to, we can run a separate 5 v to the Arduino at a later date if we are having power problems. The USB lines also take care of control signals to the Arduino and the servo controller. The motor shield is plugged directly onto the top of the Arduino Mega and needs no further connections.

My plan of attack was to put together the battery and power converter and test them for the proper voltages and polarity using a voltmeter before connecting any of the sensitive components. I also loaded the drivers and control software to the Arduino and Raspberry Pi 3 before plugging them into the battery power supply and connecting with USB cables. All of the servo cables can be installed in the servo controller, being careful to put the black wires, which are the ground wires (or negative wires), all on the same side. They go to the outside of the servo controller. You will want to double check that all of the black wires on the servos are lined up on the "-" or negative pins.

I've provided connections for teleoperations using a PlayStation/Xbox-type joystick, which is useful for establishing that all motors are running the right way. We'll cover calibration in the software section. If one or other of the drive motors are running backward, you just have to switch the motor wires.