Many of us grew up fascinated with building things out of Legos, Erector Sets or Tinker Toys. As time passed and technology advanced the potential of our creations began to expand. If you’re anything like us, you’ve at some point considered the questions, “I wonder if I could build a robot?”. Over the years the tools and resources have changed, but we’re still intrigued by the idea of constructing and programming intelligent machines. Fortunately, the development of small, easy to use, simple to program devices like the BeagleBone Black have made projects like this easier than ever before.
In one of our most requested tutorials we give you the tools to start building your very own BeagleBone Black-powered robot. We’ll help you establish your project plan, talk about chassis and drive system options, discuss power needs and communication methods and point you to some helpful resources that will have your BeagleBone Robot up and running (or walking, or crawling, or rolling) in no time.
Want a project that will move you? This is the one!
This project will help you get started building a BeagleBone robot.
The complexity and cost of a robot design can vary greatly. The objective here is to keep the example design simple and flexible. This project is a basic introduction to robots using a BeagleBone Black and a Relay Plus IO cape.
A robot project required a few basic building blocks.
- A project plan
- Chassis and drive system
- Power system
- Control program
- Purpose/design role
What You Will Need
- BeagleBone Black
- BeagleBone expandable case Orange or Black (recommended)
- AC adapter 5 Volts, 2 Amp (recommended – during debug)
- Relay Plus IO cape and user manual
- Prototyping project parts kit (optional)
- USB Wireless WiFi Adapter with 4″ Antenna (suggested)
- (1-2) Gearhead motor (such as this example)
- Servo Motor (optional)
- Power source (6V or 12V Battery and a 5V regulator)
- Wheels, nuts bolts, wires.
- Creative approach
Materials are provided as a guideline (this is not an exact “kit”).
Most of the fun and reward of building a robot comes from the journey of finding parts and coming up with a design. Be inspired and creative with the materials you may find around your home.
STEP 1 – Plan
Start by thinking about what you want your robot to do. What size? What is your budget? How long do you have to build it? What battery life do you need? For this project we will explore a simple design, on which you can build.
STEP 2 – Drive System
- What motion is desired (forward/backward/turning radius) ?
- What surface will be traveled (carpet, smooth floor, grass, other)?
- How fast does it need to travel?
- How sturdy does it have to be (environment)?
Lets look at a few simple starting options.
A first simple drive system can use a single motor (driving both wheels). A servo motor can be used for steering the third wheel using guide rods (or bent paper clips) attached to the servo ‘horn’. A simple relay circuit can provide forward and reverse control. It is possible to also direct drive only one wheel (the other wheel is then free-wheeling). Advantage: simple, only one primary drive motor, sturdy. Disadvantage: larger turning radius.
A second simple drive system uses two motors, spinning in only one direction. Each motor can be turned ON independently. Turning is achieved by activating a single motor at a time (while the other one is OFF). Advantage: simple, direct-drive. Disadvantage: turning control can be affected by surface/grip (non-driven wheel can slip).
A third drive system also uses two motors, but adds forward and reverse control using an ‘H-bridge’ (so-called because of the circuit layout of the drive electronics resembles the letter ‘H’). (Electronic H-bridges are not covered in this project). Advantage: Better turning control. Disadvantage: Increased cost of electronics.
An H-bridge can be implemented with relays or electronic switches (transistors). Transistors can switch faster and use PWM (Pulse Width Modulation) for speed control. When both SW1 and SW4 are ON (SW2,SW3 OFF) the motor spins in the forward direction. When SW2 and SW3 are ON the motor spins in the reverse direction. SW1 and SW3 (or SW2 and SW4) should NEVER be ON at the same time as this results in a short-circuit.
Using the CBB-Relay cape, the motor direction can be controlled in either direction. Relay contacts are rated for a maximum of 10 Amps.
Using a protective fuse in series with the battery is highly recommended.
Wiring Example – Reversing Motor Control
Wiring Example – Dual Motor Control
A larger wheel diameter will perform better on carpet and grass (4 inch / 10 cm is a good starting point). Omni-wheels are interesting options for smooth floors, but will quickly add costs to the project.
If you want to direct drive the wheels from the motor output shaft, chose a motor geared for 100-200 RPM (using 4 inch/ 10cm wheel). Driving a motor in both directions (Clockwise/counter-Clockwise) can be achieved using two common approaches: a simple (electro-mechanical) relay or an H-Bridge electronic controller.
IMPORTANT NOTE: Mechanical systems that include gears and moving parts can present safety exposures (pinched fingers). Always take precaution and consider safety first when applying power or working on areas where potential mechanical, electrical or other dangers could result in injury.
Every robot needs a chassis or base as a framework to hold all the pieces together. This can be as simple as a piece of wood, a PVC pipe frame or a piece of laser cut acrylic, all the way up to a welded aluminum frame. Be sure to consider the weight of the chassis. A heavier chassis will require more motor power, which will need a bigger battery. Tetrix makes modular pieces for constructing robots.
STEP 3 – Power System
This can be a big topic, as there are many options and factors to consider. A simple tiny robot can use a few “AA” cells. A more substantial robot will need more power.
How much power?
12V (SLA) Sealed-Lead-Acid batteries are common, simple and low-cost. These are heavier than LiPo cells, but in a robots, weight is not always as critical as in flying applications (drone/quads). Lithium (LiIon/LiPo) cells have better energy density but are trickier to charge. For simplicity, consider an SLA Battery for a first simple robot.
Batteries are rated in ‘amp-hour’. A “4Ahr” battery will deliver 4 amperes for 1 hour, at which point the voltage drops below the operating voltage level (around 75-80%). The battery will last longer if you draw less current, and die earlier if you draw more current. (your gas mileage may vary!)
Speed-Vs-Power-Vs-Battery Life Trade-Off
A heavy robot needs bigger motors to move it, bigger motors need bigger batteries, bigger batteries need a bigger robot which needs bigger motor… A robot that moves very fast needs more energy or results in short battery life. If you need a “race car” robot, pay close attention to the total weight!
There are two main power needs for this robot: Power for the wheel motor and accessories and power for the BeagleBone. When the motor is turned on, this creates a bump in the power supply, which may disturb the computer. It is best to keep each power source separate.
We need 5V at 1-2 amps for the BeagleBone and 6-12V for the motor(s).
5V at 1Amp will be sufficient for the BeagleBone itself, however if a servo motor is also used, more current will be required from the 5V power source (2A suggested). Consider adding a large electrolytic capacitor (1000uF/ 16V) for the 5V supply, if you present a heavy load to the servo motor or experience large voltage dips that may cause the BeagleBone to reboot.
(just in case your robot has a mind of its own)
STEP 4 – Communication System
There are two primary approaches to controlling the robot.
In autonomous operation, the robot ‘wanders’ on its own, and may interact with its environment (bumping or sensing obstacle) and changing it behavior based on pre-programmed actions to take.
A second approach required input from an observer. Commands are sent over a wireless link.
This can be Wifi, Bluetooth, ZigBee or custom link.
A wifi link with extended range can be established with the UWN200 USB Wifi Adapter or for a more compact adapter the UWN100. The network connected BeagleBone can be controlled remotely over wifi. Tutorials including WiFi setup and troubleshooting
STEP 5 – Control Program
The control program will vary greatly, based on the function of the robot, the programming language and level of control required. Start with simple motion using the relay cape. Basic examples of controlling the relays are presented in the Relay Plus IO cape user manual.
Add bumper switches, bells and whistle to create a unique design.
You can use other tutorials and projects as inspiration for your robot.
STEP 6 – Design Role, Function
Robots can be used for many tasks from the practical to the ridiculous. You could make a tail-waging BeagleBone using a servo for Halloween Fun or just to learn more about robots. Do you have a local robotics club? You can add accessories such as LEDs, or beepers using the four outputs of the Relay plus IO cape.