Over the weekend I successfully connected my BeagleBone
Black to a Dagu Rover 5 Tracked Chassis using the Rover 5 motor driver board. I was then able to write Python client/server
scripts that allowed me to controller the robot over a Bluetooth RFComm connection. You can see the video of my first successful
test drive below. The next few posts will document the steps it took to get this working.
Here is the video of my first successful test drive. For those of you thinking that this is actually
a remote controller vehicle and not a robot, you are right but this is the
pretty huge step towards my goal of creating a robot because I want my robot to be mobile.
This post will describe how to connect the BeagleBone Black
to the Motor driver board and the Rover 5 Tracked Chassis. I am assuming that you have the basic
understanding of the BeagleBone Black expansion headers as described in my “Playingwith LEDs” post and have set the Adafruit_BBIO Python library as described in my “I just got myBeagleBone Black, now what?” post.
Connecting the Motor
Controller to your Tracked Chassis:
The chassis I choose is the Rover 5 Tracked Chassis that
contains a battery holder, two DC motors and a quadrature encoder for each
tread. For the motor controller I chose
the four channel Rover 5 Motor Driver Board. As you can probably tell by the
names, these are kind of designed to work together which makes it a lot easier
for a beginner like myself. Below are
pictures of the motor controller and the chassis.
In this section we will be connecting the encoder and the
power for the motor from the chassis to the motor controller. From each motor housing, there is a think
black power cable for the motors and four small wires, each with female connectors,
which go to the encoder. These
connectors are:
RED: +5V for the encoder
BLACK: Ground
WHITE: Input signal A
YELLOW: Input signal B
To connect the Chassis to the motor driver board, we connect
the thick motor power cable from the motor housing to the motor output
connector on the motor controller. We
will then connect the four encoder cables to the encoder connections on the
motor driver board. Make sure you do not
cross up the red (5V) and the black (ground) wires as this could damage the
encoders. This image shows how I made
the connections.
Connecting the
BeagleBone Black to the Motor Controller:
Now that we have the chassis connected to the motor
controller, lets connect the BeagleBone Black to the motor controller. Remember to disconnect the power to the
BeagleBone Black prior to connecting it to the motor controller. We will want to connect two PWM pins and two
digital pins from the BeagleBone Black to the motor controller.
We will be connecting PWM pins 13 and 19 from the P8
expansion header and the digital pins 14 and 16 also from the P8 expansion
header to the motor controller. The
image below shows a close up of the BeagleBone Black with the yellow wires
connected to the PWM pins and the green wires connected to the digital pins.
I am running PWM pin 13 and digital pin 14 to one encoder
and PWM pin 19 and digital pin 16 to the other encoder. You can see how the wires are connected here:
Running Power to the
Motor Controller:
Now lets connect power to the motor controller. We have two power inputs on our motor
controller. One input is for +5V for logic
and the other is to power the motors.
The motor controller is rated for a maximum motor supply voltage of
12V. I am using the 6AA battery holder
that came with the chassis to supply the motor power. Note:
Do not put the batteries in the battery holder until everything is
connected.
On the motor controller board, one of the power inputs is
labeled “Vbat” and the other is labeled “VCC”.
We will connect the 6AA battery holder to the power input labeled
“Vbat”. We will then run 5V (pin 7 of
expansion header P9) and ground (pin 1 of expansion header P9) from the
BeagleBone Black to the power input label “VCC” on the motor controller.
Now we can put the batteries in the battery holder and power
up the BeagleBone Black.
Testing the
Connection:
Now that we have everything connected and powered up, lets
see if we have everything connected correctly.
Lets create a script called rovertest.py and add the following code to
it:
#!/usr/bin/python
import Adafruit_BBIO.PWM as
PWM
import time
pin = "P8_13"
PWM.start(pin,0)
for i in range(0, 100):
PWM.set_duty_cycle(pin,75)
time.sleep(.1)
PWM.stop(pin)
PWM.cleanup()
We need to make sure that the chassis is not on the ground
when we run the script because we do not want the chassis to actually move
since the BeagleBone Black is still connected to the computer. What I did was to type in “python
rovertest.py”, picked up the chassis and then pressed enter to run the
script. If everything is connected
correctly, one of the tracks should run for 10 seconds and then stop. To test the other track, change the ‘pin = “P8_13”’
line to ‘pin = “P8_19”’ and rerun the script.
The next post will cover how to connect and configure a
Bluetooth adapter with the BeagleBone Black running Angstrom Linux. This will give us the ability to control our
robot remotely so we do not need to have our robot connected to a computer.
Part 2: http://myroboticadventure.blogspot.com/2014/05/my-first-working-robot-its-alive-part-2.html
Part 3: http://myroboticadventure.blogspot.com/2014/05/my-first-working-robot-its-alive-part-3.html
Part 2: http://myroboticadventure.blogspot.com/2014/05/my-first-working-robot-its-alive-part-2.html
Part 3: http://myroboticadventure.blogspot.com/2014/05/my-first-working-robot-its-alive-part-3.html