Sunday, May 18, 2014

My first working robot, It’s Alive

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 and add the following code to it:

import Adafruit_BBIO.PWM as PWM
import time

pin = "P8_13"

for i in range(0, 100):


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”, 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:
Part 3:


  1. Hi!
    I'm working in a similar project using the Beaglebone black with the a rover 5, but mine has 4 dc motors, i thing this rover 5 motor drive board is meant to work with 5V PWM logic, not 3.3V that the beagle bone have, so you will not get the full speed on the rover 5. To solve that you can use any 3.3v level shifter converter, like the 74AHCT125 (i'm actually using one similar to this:
    My project also includes streaming video to a controller computer! :)

    1. Thank you for the tip, I will have to try it out.

  2. One question: where did you got this blue plate? the one that i bought from dagu does not fit perfectly on my rover 5.

    1. It was actually a left over part from my first failed robot attempt. It is from the Magician Chassis, except my was blue not red:

  3. This comment has been removed by a blog administrator.

  4. As I know there are more components involved than being firmly required for the particular task, but the control of that motor task is distributed. You're right that "the motor controller is rated for a maximum motor supply voltage of 12V." Thanks to this post I learn more about motor controller and this is helpful.

  5. This will give us the ability to control our robot remotely so we do not need to have our robot ...

  6. Hi there,
    I have a questions about BeagleBone Black for the Dagu Rover5 Tracked. I'm asking for Bluetooth part, did you use Angstrom Distribution image or Debian image? because when I use Debian I didn't find the Bluetooth file? and when I'm using Angstrom I found Bluetooth but when I run the code I have issue with Adafriut library? please help!

    1. I used the Angstrom Distribution since I also had issues getting the debian to work with the bluetooth. What issues are you having with the adafruit library?

  7. This comment has been removed by the author.

    1. This comment has been removed by the author.