Chapter 11. By Land, Sea, and Air

You've built robots that can navigate on land; now let's look at some possibilities for utilizing the tools you have used so far to build some robots that dazzle the imagination. By now, I hope you are comfortable accessing the USB control channels and with talking to servo controllers and other devices that can communicate over USB. Instead of leading you through each step, in this chapter, I'm going to point you in the right direction and then allow you to explore a bit. I'll try to give you some examples using some of the projects that are going on around the Internet.

You don't want to limit your robotic possibilities to just walking or rolling. You'll want your robot to fly, or sail, or swim. In this chapter, you'll see how you can use the capabilities you have already mastered in projects that defy gravity, explore the open sea, or navigate below the open sea.

In this chapter, we will do the following:

  • Use Raspberry Pi in robots that can sail
  • Use Raspberry Pi in robots that can fly
  • Use Raspberry Pi in robots that can go underwater

We need to add hardware to our robotics in order to complete these projects. Since the hardware is different for each of these projects, I'll introduce them in each individual section.

Using Raspberry Pi to sail

Now that you've created platforms that can move on land, let's turn to a completely different type of mobile platform, that is, one that can sail. In this section, you'll discover how to use Raspberry Pi to control your sailboat.

Getting started

Fortunately, sailing on water is about as simple as walking on land. First, however, you need a sailing platform. The following is an image of an RC sailing platform that can be modified to accept control from Raspberry Pi:

Getting started

In fact, many RC-controlled boats can be modified to add Raspberry Pi. All you need is space to put the processor, the battery, and any additional control circuitry. In this case, the sailing platform has two controls: a rudder, which is controlled by a servo, and a second servo, which controls the position of the sail, as shown in the following image:

Getting started

To automate the control of the sailboat, you'll need Raspberry Pi, a battery, and a servo controller. The servo controller I would advise for this project is the one that you used in Chapter 6, Making the Unit Very Mobile – Controlling the Movement of a Robot with Legs. It is a six-servo controller made by Pololu (available at www.pololu.com), and it looks as follows:

Getting started

The advantage is that this servo controller is very small and fits in limited space. The only challenge is getting a power connection for the device. Fortunately, there is a cable that you can purchase that makes these power connections available from a standard cable. The cable you want is a USB-to-TTL serial/RS232 adapter cable. Make sure that the TTL end of the cable has individual female connectors. You can get this cable at www.amazon.com and also at www.adafruit.com. The following is an image of the cable:

Getting started

The red and black wires are for connection to the power. These can be connected to the servo controller in the following manner:

Getting started

Once you have assembled your sailboat, you will first need to hook up the servo controller to the servos on the boat. You should try to control the servos before installing all the electronics inside the boat, as shown in the following image:

Getting started

Just as in Chapter 6, Making the Unit Very Mobile – Controlling the Movement of a Robot with Legs, you can use the Maestro Servo Controller software to control the servo controller from your PC. When you are ready to hook it up to Raspberry Pi, you can start with the same Python program you used in Chapter 6, Making the Unit Very MobileControlling the Movement of a Robot with Legs. You will probably want to control the system without a wired connection, so you can use the principles that you learned in Chapter 8, Going Truly Mobile – The Remote Control of Your Robot.

It may be a bit challenging if you are using the standard 2.4 GHz keyboard or a smaller 2.4 GHz controller. One possible solution is wireless LAN, where you can set up your own ad hoc wireless network using a router connected to a laptop. Also, as noted in Chapter 8, Going Truly Mobile –The Remote Control of Your Robot, many cell phones have the ability to set up a wireless hot spot, which can create a wireless network so that you can communicate remotely with your sailboat.

Another possible solution is to use ZigBee wireless devices to connect your sailboat to a computer. We already covered the details in Chapter 8, Going Truly Mobile – The Remote Control of Your Robot. You'll need two of them and a USB shield for each. You can get these at a number of places, including www.adafruit.com. If you can connect your computer and Raspberry Pi via this wireless network, the advantage is that it carries communications to and from your sailboat and can have a range of up to a mile using the right devices.

Now you can sail your boat, controlling it all through an external keyboard or through a ZigBee wireless network from your computer. If you want to fully automate your system, you could add your GPS and then have your sailboat sail to each of the programmed positions. One additional item you may want to add to make the system fully automated is a wind sensor. The following is an image of a wind sensor that is fairly inexpensive if you buy it from www.moderndevices.com:

Getting started

You can mount it to the mast if you'd like; I used a small piece of heavy-duty tape and mounted it to the top of the mast, as shown in the following image:

Getting started

To add this to your system, you'll also need a way to take the analog input from the sensor and send it to Raspberry Pi. The easiest way to do this is to add a USB device that samples the analog signal and reports the measurements over the USB bus. The device I like to use is the PhidgetInterfaceKit 2/2/2 from www.phidgets.com. The following is an image of this device:

Getting started

The following is an image of the wind sensor connected to the converter:

Getting started

The following wiring diagram shows how the wind sensor interfaces with the Phidgets USB device:

Getting started

Now you can access the wind speed from the USB connection in the same way that you received data from the other USB devices that you have already used. The Phidgets website will lead you through the download process; I chose Python as my language and downloaded the appropriate libraries and sample code. When I run this sample code, I get the following output while blowing on the sensor:

Getting started

Now that you have a way to measure your location and the wind, you can use your Raspberry Pi to sail your boat all by itself. I am not a sailor myself, but you'll want to use the wind sensor to get a sense of the direction of the wind and then use classic sailing techniques such as tacking (moving back and forth to use the wind effectively) to sail.

While constructing this, you'll need to be careful with waterproofing, especially while sailing in heavy wind. Think about attaching a hatch that covers the electronics securely. I added small screws and tabs and also some waterproof sealant to hold the hatch.

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

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