Chapter 6. Making the Unit Very Mobile – Controlling the Movement of a Robot with Legs

In the previous chapter, we covered wheeled and tracked movement. That's cool enough, but what if you want your robot to navigate uneven ground? Now you will add the capability to move the entire project using legs. In this chapter, you will be introduced to some of the basics of servo motors and using Raspberry Pi to control the speed and direction of your legged platform. The following is an image of a finished project:

Making the Unit Very Mobile – Controlling the Movement of a Robot with Legs

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 the path is not smooth or flat; perhaps you'll even want your robot to go up stairs or around curbs. In this chapter, you'll learn how to attach your board, both mechanically and electrically, to a platform with legs so that your projects can be mobile in many more environments. Robots that can walk! What could be more amazing than that?

In this chapter, we will cover the following topics:

  • Connecting Raspberry Pi to a two-legged mobile platform using a servo motor controller
  • Creating a program in Linux so that you can control the movement of the two-legged mobile platform
  • Making your robot truly mobile by adding voice control

Gathering the hardware

In this chapter, you'll need to add a legged platform to make your project mobile.

For a legged robot, there are a lot of choices for hardware. As seen in Chapter 5, Creating Mobile Robots on Wheels, some are completely assembled, others require some assembly, and you may even choose to buy the components and construct your own custom mobile platform. Also I'm going to assume that you don't want to do any soldering or mechanical machining yourself, so let's look at several choices of hardware that are available completely assembled or can be assembled using simple tools (a screwdriver and/or pliers).

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

Gathering the hardware

We'll use this legged mobile platform in this chapter because it is the simplest to program and the least expensive, requiring only four servos. To construct this platform, you must purchase the parts and then assemble them 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 by purchasing a biped robot kit with six DOF (degrees of freedom). This will contain the parts needed to construct your four-servo biped. These six DOF bipeds can be purchased on eBay or at http://www.robotshop.com/2-wheeled-development-platforms-1.html.

You'll also need to purchase the servo motors. Servo motors are similar to the DC motors you may have used in Chapter 5, Creating Mobile Robots on Wheels, except that servo motors are designed to move at specific angles based on the control signals that you send. For this type of robot, you can use standard-sized servos. I like the Hitec HS-311 or HS-322 for this robot. They are inexpensive but powerful enough in operations. You can get them on Amazon or eBay. The following is an image of an HS-311 servo:

Gathering the hardware

As in the last chapter, you'll need a mobile power supply for Raspberry Pi. I personally like the 5V cell phone rechargeable batteries that are available at almost any place that supplies cell phones. Choose one that comes with two USB connectors; you can use the second port to power your servo controller. The mobile power supply shown in the following image mounts well on the biped hardware platform:

Gathering the hardware

You'll also need a USB cable to connect your battery to Raspberry Pi. You should already have one of those.

Now that you have the mechanical parts for your legged mobile platform, you'll need some hardware that will turn the control signals from your Raspberry Pi into voltage levels that can control the servo motors. Servo motors are controlled using a 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 Raspberry Pi's GPIO (General Purpose Input/Output) pins, for example, those at http://learn.adafruit.com/adafruit-16-channel-servo-driver-with-raspberry-pi/ and http://www.youtube.com/watch?v=ddlDgUymbxc. For ease of use, I've chosen to purchase a servo controller that can talk over a USB and control the servo motor. These controllers protect my board and make controlling many servos easy. My personal favorite for this application is a simple servo motor controller utilizing a USB from Pololu that can control six servo motors—the Micro Maestro 6-Channel USB Servo Controller (Assembled). The following is an image of the unit:

Gathering the hardware

Make sure you order the assembled version. This piece of hardware will turn USB commands into voltage levels 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 choose a controller that can control that many servos. In this book, we will use a two-legged, four-servo robot, so I will illustrate the robot using the six-servo version. Since you are going to connect this controller to Raspberry Pi via USB, you'll also need a USB A to mini-B cable.

You'll also need a power cable running from the battery to your servo controller. You'll want to purchase a USB to FTDI cable adapter that has female connectors, for example, the PL2303HX USB to TTL to UART RS232 COM cable available on amazon.com. The TTL to UART RS232 cable isn't particularly important, other than that the cable itself provides individual connectors to each of the four wires in aUSB cable. The following is an image of the cable:

Gathering the hardware

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

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.14.22.250