Chapter 6. A Robot that Can Sail

You've built robots that can navigate on land; now let's look at some amazingly cool possibilities for utilizing the tools to build some robots that dazzle the imagination. You don't want to limit your robotic possibilities to just walking or rolling. You might want your robot to sail. In this chapter, you'll see how to build a robot that can sail the open sea, or at least your local park's pond.

In this chapter, you will build the basic sailing platform. To do this, you will learn the following:

  • Using the BeagleBone Black to control servos directly
  • Communicating with your platform via long range RF signals so that you can retain control of your robotic sailboat

The BeagleBone Black and robots that can sail

Now that you've discovered that the BeagleBone Black can guide platforms that can move on land, let's turn to a completely different type of mobile platform, one that can sail. In this section, you'll discover how to add the BeagleBone Black to a sailing platform and utilize it to control your sailboat.

Building the sailboat platform

Fortunately, sailing in water is about as simple as walking on land. First, however, you need a sailing platform. Here is an image of an RC sailing platform that can be modified to accept control from the BeagleBone Black:

Building the sailboat platform

In fact, many RC controller boats can be modified to add the BeagleBone Black. All you need is space to put the processor, the battery, and any additional control circuitry that you might need. In this case, the sailing platform has basically two controls: a rudder that is controlled by a servo and a second servo that controls the position of the sail. These are shown here:

Building the sailboat platform

You'll use your BeagleBone Black to control these two servos that will control both the rudder and the sail position, so let's start by connecting these two servos to the BeagleBone Black. You'll drive the two servomotor control signals from the BeagleBone Black GPIO pins, but you'll supply the DC power from a battery.

Controlling servos with the BeagleBone Black

Once you have assembled your sailboat, you'll want to hook up the BeagleBone Black to the servos on the boat. In order to connect this servomotor to your BeagleBone Black, you'll need some male-to-male jumper cables. You'll notice that there are three wires coming from the servo. Two of these supply the voltage and current to the servo. The third provides a control signal that tells the servo where and how to move.

The best way to connect the servo is to connect the power wires to a battery that will supply power to the servos. The servos will want something more than 6 volts; a 2-cell 7.4 volt LiPo RC battery is an excellent choice. Here is an image of one of these:

Controlling servos with the BeagleBone Black

You'll also need a USB battery to supply the BeagleBone Black with power. You can connect the servos to the power of this LiPo battery by using male-to-male solderless wires. The red wire output of the LiPo battery will be 7.4 volts, and the black wire output will be GND. Here is an image of these connections:

Controlling servos with the BeagleBone Black

You will connect the control signal of the servos to the GPIO pins of the BeagleBone Black. There are two GPIO pin connectors on the BeagleBone Black, one on each side of the board. They are labeled P8 and P9, but just in case you again need an image with the pin-out, it is here:

Controlling servos with the BeagleBone Black

Connect the control wire connection on each servo, normally a yellow wire, to one of the GPIO pins on the BeagleBone Black that supports PWM output. For example, connect P8_13 and P9_14 on the BeagleBone Black. You can use P8_13 and P9_14 for the two servos in this project. Here is an image of the connections:

Controlling servos with the BeagleBone Black

When you have the electrical connections made, you'll need to write some code for the BeagleBone Black.

Controlling the servos on the sailboat from a program

In order to control the servos with a Python script, if you have not done it previously, you'll need to add a library that will allow you to talk to the GPIO pins via Python. Follow these steps:

  1. Install the sudo apt-get install build-essential python-dev python-setuptools python-pip python-smbus packages.
  2. Type sudo easy_install -U distribute. This will install easy_install, a utility that will help manage Python packages.
  3. Now type sudo pip install Adafruit_BBIO. This will install the Adafruit library for talking via the GPIO pins.
  4. To test your installation, type sudo python -c "import Adafruit_BBIO.GPIO as GPIO; print GPIO", and you should see a screen like this:
    Controlling the servos on the sailboat from a program

When you have installed the library, create this program to give you basic control over the two servos:

Controlling the servos on the sailboat from a program

When you run the program, you should be able to enter the servo number you wish to control and the desired angle so that the servos can move to that angle. If you need more information on servo control using the BeagleBone Black, look at https://learn.adafruit.com/controlling-a-servo-with-a-beaglebone-black?view=all. Now you can sail your boat, but you'll need to add the ability to talk to it remotely.

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

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