10 min read

(for more resources related to this topic, see here.)

Mission briefing

We’ve covered creating robots using a wheeled/track base. In this article, you will be introduced to some of the basics of servo motors and using the BeagleBone Black to control the speed and direction of your legged platform. Here is an image of a finished project:

Why is it awesome?

Even though you’ve learned to make your robot mobile by adding wheels or tracks, this mobile platform will only work well on smooth, flat surfaces. Often, you’ll want your robot to work in environments where it is not smooth or flat; perhaps, you’ll even want your robot to go upstairs or over curbs. In this article, you’ll learn how to attach your board, both mechanically and electrically, to a platform with legs, so your projects can be mobile in many more environments. Robots that can walk: what could be more amazing than that?

Your objectives

In this article, you will learn:

  • Connecting the BeagleBone Black to a mobile platform using a servo controller
  • Creating a program in Linux to control the movement of the mobile platform
  • Making your mobile platform truly mobile by issuing voice commands

 

Mission checklist

In this article, you’ll need to add a legged platform to make your project mobile. So, here is your parts’ list:

  • A legged robot: There are a lot of choices. As before, some are completely assembled, others have some assembly required, and you may even choose to buy the components and construct your own custom mobile platform. Also, as before, I’m going to assume that you don’t want to do any soldering or mechanical machining yourself, so let’s look at a several choices that are available completely assembled or can be assembled by simple tools (screwdriver and/or pliers).

    One of the easiest legged mobile platforms is one that has two legs and four servo motors. Here is an image of this type of platform:

    You’ll use this platform in this article because it is the simplest to program and because it is the least expensive, requiring only four servos. To construct this platform, you must purchase the parts and then assemble it yourself. Find the instructions and parts list at http://www.lynxmotion.com/images/html/build112.htm. Another easy way to get all the mechanical parts (except servos) is to purchase a biped robot kit with six degrees of freedom (DOF). This will contain the parts needed to construct your four-servo biped. These six DOF bipeds can be purchased by searching eBay or by going to http://www.robotshop.com/2-wheeled-development-platforms-1.html.

  • You’ll also need to purchase the servo motors. For this type of robot, you can use standard size servos. I like the Hitec HS-311 or HS-322 for this robot. They are inexpensive but powerful enough. You can get those on Amazon or eBay. Here is an image of an HS-311:

  • You’ll need a mobile power supply for the BeagleBone Black. Again, I personally like the 5V cell phone rechargeable batteries that are available almost anywhere that supplies cell phones. Choose one that comes with two USB connectors, just in case you want to also use the powered USB hub. This one mounts well on the biped HW platform:

  • You’ll also need a USB cable to connect your battery to the BeagleBone Black, but you can just use the cable supplied with the BeagleBone Black. If you want to connect your powered USB hub, you’ll need a USB to DC jack adapter for that as well.
  • You’ll also need a way to connect your batteries to the servo motor controller. Here is an image of a four AA battery holder, available at most electronics parts stores or from Amazon:

  • Now that you have the mechanical parts for your legged mobile platform, you’ll need some HW that will take the control signals from your BeagleBone Black and turn them into a voltage that can control the servo motors. Servo motors are controlled using a control signal called PWM. For a good overview of this type of control, see http://pcbheaven.com/wikipages/How_RC_Servos_Works/ or https://www.ghielectronics.com/docs/18/pwm. You can find tutorials that show you how to control servos directly using the BeagleBone Black’s GPIO pins, for example, here at http://learn.adafruit.com/controlling-a-servowith-a-beaglebone-black/overview and http://www.youtube.com/watch?v=6gv3gWtoBWQ. For ease of use I chose to purchase a motor controller that can talk over USB and control the servo motor. These protect my board and make controlling many servos easy. My personal favorite for this application is a simple servo motor controller utilizing USB from Pololu that can control 18 servo motors. Here is an image of the unit:

    Again, make sure you order the assembled version. This piece of HW will turn USB commands into voltage that control your servo motors. Pololu makes a number of different versions of this controller, each able to control a certain number of servos. Once you’ve chosen your legged platform, simply count the number of servos you need to control, and chose the controller that can control that number of servos. One advantage of the 18 servo controller is the ease of connecting power to the unit via screw type connectors.

  • Since you are going to connect this controller to your BeagleBone Black via USB, you’ll also need a USB A to mini-B cable.

Now that you have all the HW, let’s walk through a quick tutorial on how a two-legged system with servos works and then some step-by-step instructions to make your project walk.

Connecting the BeagleBone Black to the mobile platform using a servo controller

Now that you have a legged platform and a servo motor controller, you are ready to make your project walk!

Prepare for lift off

Before you begin, you’ll need some background on servo motors. Servo motors are somewhat similar to DC motors; however, there is an important difference. While DC motors are generally designed to move in a continuous way—rotating 360 degrees at a given speed—servos are generally designed to move within a limited set of angles. In other words, in the DC motor world, you generally want your motors to spin with continuous rotation speed that you control. In the servo world, you want your motor to move to a specific position that you control.

Engage thrusters

To make your project walk, you first need to connect the servo motor controller to the servos. There are two connections you need to make: the first to the servo motors, the second to the battery holder. In this section, you’ll connect your servo controller to your PC to check to see if everything is working.

  1. First, connect the servos to the controller. Here is an image of your two-legged robot, and the four different servo connections:

  2. In order to be consistent, let’s connect your four servos to the connections marked 0 through 3 on the controller using this configuration: 0 – left foot, 1 – left hip, 2 – right foot, and 3 – right hip. Here is an image of the back of the controller; it will tell you where to connect your servos:

  3. Connect these to the servo motor controller like this: the left foot to the top O connector, black cable to the outside (–), the left hip to the 1 connector, black cable out, right foot to the 2 connector, black cable out, and right hip to the 3 connector, black cable out. See the following image for a clearer description:

  4. Now you need to connect the servo motor controller to your battery. If you are using a standard 4 AA battery holder, connect it to the two green screw connectors, the black cable to the outside, and the red cable to the inside, as shown in the following image:

  5. Now you can connect the motor controller to your PC to see if you can talk with it.

 

Objective complete – mini debriefing

Now that the HW is connected, you can use some SW provided by Polulu to control the servos. It is easiest to do this using your personal computer. First, download the Polulu SW from http://www.pololu.com/docs/0J40/3.a and install it based on the instructions on the website. Once it is installed, run the SW, and you should see the following screen:

You first will need to change the configuration on Serial Settings, so select the Serial Settings tab, and you should see a screen as shown in the following screenshot:

Make sure that the USB Chained option is selected; this will allow you to connect and control the motor controller over USB. Now go back to the main screen by selecting the Status tab, and now you can turn on the four servos. The screen should look like the following screenshot:

Now you can use the sliders to control the servos. Make sure that the servo 0 moves the left foot, 1 the left hip, 2 the right foot, and 3 the right hip.

You’ve checked the motor controllers and the servos, and you’ll now connect the motor controller up to the BeagleBone Black control the servos from it. Remove the USB cable from the PC and connect it into the powered USB hub. The entire system will look like the following image:

Let’s now talk to the motor controller by downloading the Linux code from Pololu at http://www.pololu.com/docs/0J40/3.b. Perhaps, the best way is to log in to your Beagle Bone Black by using vncserver and a vncviewer window on your PC. To do this, log in to your BeagleBone Black using PuTTY, then type vncserver at the prompt to make sure vncserver is running.

  1. On your PC open the VNC Viewer application, enter your IP address, then press connect. Then enter your password that you created for the vncserver, and you should see the BeagleBone Black Viewer screen, which should look like this:

  2. Open a Firefox browser window and go to http://www.pololu.com/docs/0J40/3.b. Click on the Maestro Servo Controller Linux Software link. You will download the file maestro_linux_100507.tar.gz to the Download directory.
  3. Go to your download directory, move this file to your home directory by typing mv maestro_linux_100507.tar.gz .. and then you can go back to your home directory.
  4. Unpack the file by typing tar –xzfv maestro_linux_011507.tar.gz. This will create a directory called maestro_linux. Go to that directory by typing cd maestro_linux and then type ls. You should see something like this:

The document README.txt will give you explicit instructions on how to install the SW. Unfortunately you can’t run MaestroControlCenter on your BeagleBone Black. Our version of windowing doesn’t support the graphics, but you can control your servos using the UscCmd command-line application. First type ./UscCmd –list and you should see the following:

The unit sees your servo controller. If you just type ./UscCmd you can see all the commands you could send to your controller:

Notice you can send a servo a specific target angle, although the target is not in angle values, so it makes it a bit difficult to know where you are sending your servo. Try typing ./UscCmd –servo 0, 10. The servo will most likely move to its full angle position. Type ./UscCmd –servo 0, 0 and it will stop the servo from trying to move. In the next section, you’ll write some SW that will translate your angles to the commands that the servo controller will want to see.

If you didn’t run the Windows version of Maestro Controller and set the serial settings to USB Chained, your motor controller may not respond.

LEAVE A REPLY

Please enter your comment!
Please enter your name here