Like this:

LikeLoading...

This Instructable shows you how to build a simple, inexpensive breadboard for robotics experiments. It is a companion to Cheap, Easy Robotics for the Non-Programmer. Here we'll learn how to build a Babuino robot to use for experiments with the Babuino/Blocos software environment. Using a breadboard like this makes it easy to experiment with robotic circuits. Since no soldering is required, it's also very easy to make changes to your circuits. (Note that some soldering is required to build the breadboard, but it's pretty minimal.)

This website (featured in the last Instructable) provides a great design for a simple robot. That platform is both simple and elegant, but has two short-comings for an individual wishing to experiment with robotics. The first is that the platform really wants to be built for a class. That is, the tools and setup to build it may be beyond an individual who does not have a fairly complete shop (like a band saw or jig saw) and the materials become economical when purchased in quantity. The other short-coming is that the platform is fairly specific once the Radio Shack prototype board is built. Sensors, motors, etc. are soldered in place, so making changes is difficult.

There are many other examples of simple robots and Arduino clones on the Internet. Pointers to some of these were given in the last Instructable, and lots more can be found with Google. So why am I reinventing the wheel? Simply to bring together in one place all the pieces you need to build a robot breadboard, complete with motors and motor controls, at minimal cost and assembly effort. Add the environment from the last Instructable and have a blast with robotics for a tiny investment.

First, I'll show you how to build the mechanical platform, then we'll add the Babuino controller. Two alternative Babuino incarnations will be presented. The first will be an actual Arduino clone, using the same processor used on Arduino and having exactly the same hardware resources. The second is a simpler to use version with a built-in USB interface and additional hardware resources. Both will work great, pick your favorite.

Important Note: When I use the name “Arduino” I mean not just the (not quite copyrighted) Arduino itself, but also the many public domain versions collectively known as “Freeduino”. In some cases I use the term “Ard/Free-duino”, but the terms should be considered interchangeable for the purposes of this Instructible.

Step 1: Assembling the Robotics Breadboard - Part 1: Mechanical

Here are the mechanical parts need to build the robotics breadboard. Suitable suppliers are listed for most of these although there are many alternatives you can use.

Mechanical Parts ListNote: Digikey part numbers can be entered on their home page. Press GO and you'll go right to the part description.

1 Solderless Breadboard (Available from PJRC, Radio Shack, or Digikey 438-1045-ND)2 Pololu Motors1 Pololu Roller Ball (come in a pack of 3. Share with a friend or keep for spares.)1 Battery box for 4 – AA Batteries (Digikey BC4AAW-ND; also try Frys, RadioShack, etc.)1 Battery box for 2 – AA Batteries (Digikey BC22AAW-NDFoam Tape2 Pipe Plugs (These become wheels) You can find these in the Plumbing department at Home Depot or a good hardware store. Pick a diameter you like. See the pictures below.2 Large rubber bands (like on asparagus bundles). Could use multiple smaller ones also.

Let's start putting the pieces together. Picture 1 shows the front of a solderless breadboard. This will be the chassis for the robotics breadboard. We'll attach our motors, battery holders, and roller ball to this. If you don't already have a suitable one, some alternatives are in the Parts List.

The key mechanical component for a robot is the motor. Let's talk about motors for a minute before we get on with building. The Babuino is designed to control DC motors. The problem with DC motors is that they spin very fast. If their voltage is reduced enough to slow them down, then the power they have is greatly reduced. To reduce the output speed without reducing power, gears are used. A servo motor contains both a motor and a gear train in a nice package, but must be modified to provide continuous rotation. Thiswebsite provides clear, thorough instructions for turning a servo into a DC motor which you can use for this project. (Such servos can be purchased very reasonably here.) However, while those instructions are very clear, this modification is still a lot of work. A simpler solution is to buy the units shown in Picture 2 from Pololu; they are less than $6 each. The link is in the Parts List.

To ready them for use on our breadboard, simply solder a wire to each lug on the motor (22 gauge solid copper works great). Cut pieces of Scotch foam tape (Picture 3) to fit, apply them to the motors and attach them to the breadboard. Line up the axles of the motor gearboxes and get them as perpendicular to the breadboard as possible. Place the motors as far to the rear of the breadboard as you can to leave room for the other parts. Then stick them to the back of the breadboard as shown in Picture 4. I used foam tape to do this, but you could use Velcro or hot melt glue to do the job.

Once the motors are in place, it's time to add the battery holders. We need two battery holders: one for four AA batteries and one for two AA batteries. We'll mount the one for the four batteries first right in front of the motors. Attach with foam tape, Velcro, or hot glue. Your breadboard should now look a lot like Picture 4 (except you won't have wheels yet). The two battery holder can be attached to the top of the breadboard wherever it's convenient – there'll be pictures later. Velcro works great here because you can move the batteries when you're building circuits.

At the front of the robot (or the back, you can make it go either way) we'll mount a roller ball. It is shown with the motors in Picture 2. Picture 5 shows one way to make the roller ball mount from a milk jug handle. After removing the handle, cut it to length with the hack saw and drill a 5/16ths inch hole in it. The roller ball will be a force fit into the hole. The finished mount is shown in Picture 2 also. Picture 6 shows the attachment to the breadboard. You could use a block of wood, or other scrap to mount the roller ball.

Step 2: Building the Wheels

Now let's make some wheels for our breadboard. The usual website provides some great instructions for building wheels for robots. While cheap, building these may require tools that folks wanting to build a simple robot may not have, but the concept is inspiring. Pololu, SparkFun, and others will sell you some very nice wheels for $3 to $6 per pair. But that ain't exactly what I consider cheap! How about $0.30 or less each? Searching for a plastic disk with a rim, I found knock-out plugs in the plumbing section of my local Home Depot. Three inch diameter for $0.30 each and 2” diameter for $0.20 each. I'll show you how to make a wheel from one of these disks. It's easy.

To mount the wheel to an axle we need a small opening in the center of the wheel that will fit tightly onto the axle. There's a small mold mark in the center you can use for a drill guide. The picture labeled “Wheel 1” shows the center bump with two dots marked as drill guides. Drill two 5/32nd inch holes, one on each side of the center mark (the holes should overlap) and use an Xacto to carve out the hole until it fits the axle on the motor (Wheel 2). Work slowly and you'll end up with a nice fit to the axle (Wheel 3).

Now use a hack saw to cut the protruding edge away from the rim of the wheel (Wheel 4). The result is shown in Wheel 5; discard the edge you cut off and use an Xacto to clean up the edge of the rim.

Since a perfect press-fit to the axle is difficult, we need a way to secure the wheel to the axle. The axles on the Pololu motors have a small hole in them – just right for a tiny screw. The ones I used are #2x1/4 inch wood screws from my local hardware store. Cut a quarter-sized disk from some scrap plastic (Wheel 6). Drill a 5/64th hole near the center (doesn't have to be perfectly centered) so the screw can pass through. Wheel 7 shows the disk trimmed to fit, but just laying roughly in place.

Trial fit the screw into the axle hole. Run the screw in until it stops (don't force it). It probably won't go in all the way (Wheel 8) and you'll need a small spacer to hold the wheel securely. Cut one from a scrap of plastic and drill a 5/64th hole in it for the screw to go through.

Assemble the screw, the spacer and the disk you cut. Put your wheel on an axle and run the screw in firmly (Wheel 9). Now we want to attach the disk to our wheel. Since everything is assembled, we know it's lined up. We'll use a hobby knife (Xacto or similar) or small nail to permanently join the disk and the wheel. Simply heat the blade or nail and melt a small hole in the disk and wheel by poking the point through the two. Do this five or six times and the two will be joined by the melted plastic in the holes. Be careful not to hit the motor casing or axle. It's good to practice a few times on scrap plastic. The result is Wheel 10.

Use a rubber band or two for the tires. The large ones that hold asparagus bundles together work great. Picture 7 shows the wheels in place on the breadboard. Mechanical assembly is now complete except for adding the two-battery holder to the top with some Velcro. I used the foam tape to hold the Velcro on.

Step 3: Electronics Components for Babuino

Before we start building the electronic circuits for our robotics breadboard, we need to understand some basics about the components we'll use. I'm assuming you're comfortable with using a solderless breadboard and know how to hook up circuitry on it. If you're totally new to breadboards, have a look at this nice introduction.

Let's start with some simple parts first. The picture labeled “LEDs” shows an LED on the left, a resistor on the right, and an LED with a resistor soldered in one leg in the middle. For our purposes, an LED must always have a resistor in series with it. It's convenient to solder the resistor to one leg (doesn't matter which one) as shown here. This way, you can just plug it into your breadboard (original idea here). The resistor should be in the range of 220 Ohms to 1K Ohms; the exact value doesn't matter. A new LED will usually have one leg longer than the other. The shorter leg is the one that goes to ground. If you're unsure which way your LED should be connected, it's easy to test. Hook the resistor from ground to one leg. Touch the other leg to a positive voltage around 5 volts. If the LED doesn't come on, swap the connections of the two legs. As long as you have the resistor in series, the LED won't be damaged by your tests. To build Babuino, you can pick any color LEDs you like.

The picture labeled “Button” shows one example of a button we can use. It's just a simple push button. There are many suitable buttons to choose from, so no specific one is called out. The buttons you choose should be Normally Open, and close when pressed. Pick a size you like. Notice the short lengths of 22 gauge copper wire soldered to connections to make it easy to plug into the breadboard.

Moving along, look at “Cap & Buzzer” to see, yup, you guessed it, a capacitor and the buzzer. The capacitor shown (on the left) is one of the two larger, electrolytic capacitors we'll use on the breadboard. The important thing to note is that one side of the cap will have one or more “-” signs on it. This means the leg nearest this “-” must be connected to ground. This is very important – don't get it wrong! The other capacitors we'll use are small ceramic caps and can be plugged in either way. The buzzer is included here because it also cares how it is plugged in. In this case, a small “+” denotes the leg that is not connected to ground. A resistor (120 to 200 Ohms) should be placed in series with the buzzer.

“Resonator” shows two of the ceramic resonators like we'll use (only one is used). I like these for Arduinos because they are both cheaper and easier to use than crystals. The one on the left has short lengths of copper wire soldered to the legs to make it easy to plug into the breadboard. The longer wire goes to the center leg and connects to ground. Although the resonator is not as accurate as a crystal, it is plenty accurate for baud rate generation and so meets our needs just fine.

Three integrated circuits (ICs) are used to build Babuino. The first is the Voltage Regulator (guess what picture shows it? Right! How did you know?) The picture shows the front view and shows what pin is pin 1. Pin 1 should be connected to the positive connection from the batteries, pin 2 is connected to ground, and pin 3 supplies 5 volts as Vcc to the other ICs. Connection diagrams are provided, but you should always check the connections anyway. Note that the large metal tab on this part should be treated as Ground. Be careful when you are connecting wires!

The remaining two ICs are the microprocessor and the motor controller. These will be discussed further below. One thing you should know about these parts: pin 1 is always in the lower left corner when the IC is viewed from top. To correctly orient the IC, look for a notch or circle on one end. That is the end pin 1 is on. In the diagrams to follow, a white bar in the center at one end of each IC indicates this notch.

Step 4: H-Bridge for Motor Control

Motors are what make our robot move. To control the movement, we must control the motors. We want to be able to turn the motors on and off, change the direction they rotate, and slow them down or speed them up. The microcontroller (Babuino in our case) provides control signals, but we need something that can switch the current our motors need. Happily, there is one device that can provide all the desired capability. That device is known as an H-Bridge. Refer to the H-Bridge diagram; the gray thing in the middle is the motor that we want to control. Here's how it works.

The microcontroller supplies the control signals SwitchA (which can be HI or LO), SwitchB (HI or LO) and Enable (HI or LO). SwitchA controls A1 and A2 in the diagram. When SwitchA is HI, A1 is closed and A2 is open. When SwitchA is LO, A1 is open and A2 is closed. SwitchB controls B1 and B2 in the same way. Enable works differently. When Enable is HI, both switches connected to it close; they open when it's LO, thus turning the motor off. Let's consider what happens when we make SwitchA HI, SwitchB LO and Enable HI. The two switches controlled by Enable close, and A1 and B2 also close. A2 and B1 remain open. So there is a complete circuit from Vmot (the voltage on the motors) to Ground through the motor. Current flows as shown by the red arrow. If we now turn off SwitchA and turn on SwitchB, A1 and B2 open while A2 and B2 close. We again have a complete circuit from Vmot to Ground, but this time the direction of current flow is reversed through the motor (as shown by the green arrow), so it reverses its direction of rotation.

If we turn on or off both SwitchA and SwitchB at the same time while Enable is HI, then the motor sees the same voltage on both sides. No current flows, but dynamic braking of the motor occurs and it comes to a stop more quickly than it would if only the Enable is switched LO (off). Sometimes this is important if you want to stop your robot quickly.

Great! We can control direction, but what about speed? That's where the Enable signal comes in. Obviously, if we turn off the Enable, our current path is interrupted and the motor would stop. But what if we turn the Enable on and off very rapidly? As it turns out, if we do this rapidly enough, the motor never comes to a complete stop but just slows down. For example, if the switch is off half the time then the motor sees half power. This technique is known as Pulse Width Modulation (or PWM for short). A full discussion is beyond the scope of this Instructable (Google can help those interested) but the microcontrollers we use have special circuitry just for this. Babuino provides three signals to control each motor. For Motor A, these are named Motor A Left, Motor A Right, and Motor A PWM. Motor B has similar control signals. Left and Right are the signals we called SwitchA and SwitchB above, and thus control the motor direction. PWM is the Enable signal.

The H-Bridge does all the switching while handling enough current to run the motors. The particular H-Bridge we'll use is the L293D. The L293D is a dual H-Bridge IC that has anti-kickback diodes built in. Anti-kickback diodes protect the H-Bridge from current spikes. The L293D is all we need to provide forward/reverse control for two small DC motors. Two of them can control four motors. The diagrams to follow show how to hook it up for our robotics breadboard.

Step 5: Assembling the Robot Breadboard - Part 2: Babuino

In Step 1 we put all the mechanical components on our robotics breadboard.We added wheels in Step 2. Now we just need to add the electronic components we learned about in steps 3 and 4, and we're ready to play. As stated in the Introduction, I'll show you how to build an Arduino clone and configure it as a Babuino. I'll also show you an alternative Arduino-compatible Babuino that is simpler, easier to program, and has additional hardware resources (for a future Babuino release). The parts lists for both versions are given here. Build the one you like best, or build them both! Gather your parts and let's get started.

Parts List for Arduino version of BabuinoNote: Digikey part numbers can be entered on their home page. Press GO and you'll go right to the part description.

Step 6: Building an Arduino-based Babuino

As mentioned in the last Instructable, there are a number of sites that will show you how to build an Arduino on a breadboard. These sites show lots of pictures and discuss all the details, especially about buying a chip programmed with Arduino or how to program your own chip. So I'm not going to belabor those points. For reference, the links are here and here. That said, I will show you one way to build an Arduino, how to add the Babuino features, and how to hook up the motor control chip. Download the pdf version of the schematic for reference.

Begin by installing the AVR328P microprocessor (you can also use the 168 version – mostly works the same, just no room for expansion). It should be programmed with the Arduino bootloader. Also install the L293D dual H-bridge as shown in the diagram labeled “Arduino 1”. This diagram also shows how to hook up the power supply and the voltage regulator IC. Connect your battery holders as shown in the Battery Holder Connection Diagram, but don't actually connect any power to the breadboard yet! If you use battery holders with wires already connected to them, the red wire will be positive and the black wire will be negative (ground). If you're not sure, check them with your voltmeter.

Once your power supply components are in place, you should verify that the output voltage is correct before you connect the microcontroller and the motor controller. This is a better safe than sorry step! So with the wire from VR1 to Vcc (+5V) disconnected, hook the wires from the battery holders to GND and to Vbatt at C3. Using a voltmeter, check the voltage at pin 3 of VR1 (the output). It should be close to 5 Volts. If it isn't, check your wiring and correct any errors. If you don't have a voltmeter, double check your wiring and hope for the best. (Also consider buying one. Harbor Freight sells a suitable unit for about $10 and often has them on sale for much less.)

Continue building Babuino following the Arduino 2 diagram to hook up most of the rest of the components. This diagram shows the resistors and LEDs as separate components; you may have joined them together as discussed above. Picture 8 shows some of the parts installed on the breadboard.

Arduino 3 shows the final step: how to hook up the L293D dual H-bridge. Picture 9 shows the completed Babuino circuitry – minus the power supply. (Those with sharp eyes may notice some minor variations between the picture and the diagrams. The diagrams and schematic are correct and are what you should follow.) The connection of the serial port to USB adapter is shown here.

For reference, the Babuino connection diagrams for the 328P (same for 168) and the L293D are provided. Use these to guide any experiments you may want to do. One final note, if you already have a basic Arduino/Freeduino clone similar to this one, you can plug it into this circuit with little modification. Just don't put the components on your breadboard that are already on the Freeduino board (such as the resonator) and be very aware of the power and ground connections. Getting this right is up to you since there are many variations, but shouldn't be hard if you're careful.

Step 7: Building a Teensy2-based Babuino

Caution: Teensy2 will not work with Mac OS-X 10.4 or earlier – Apple's problem, not Teensy2's. Works fine on OS-X 10.5 and above - and on all Windows and Linux systems.

If you don't already have an Arduino (or clone), Teensy2 is a really great option that combines an Arduino functional clone (that is, it runs most Arduino sketches with little modification) and the USB serial port in a package for little more than the cost of a USB serial port adapter. This nice little package actually has more resources than a standard Arduino. As a Babuino, it will be able to support 4 DC motors and 6 switch/sensor inputs in the future. The “Teensy2 Details” diagram shows major features of the Teensy2. Because basic items like the reset button, an LED, the crystal, and the USB port are already on the Teensy2, our circuitry is significantly simplified. The bootloader is already programmed into Teensy2, so we can forget about that hassle also. It's also worth noting that the Teensy2 can be used as a general serial port emulator for USB and as a programmer for the AVR processors. You can learn more by visiting the website.

When you get your Teensy2, plug it into your breadboard with nothing else connected to it. Go to the website, click the heading on the left that says “Getting Started” and follow the directions. These will guide you through downloading software and testing the Teensy2. You only need to go through Step 2 and download the correct Loader. That's all you'll need for this Instructable. When you're satisfied it all works and that you know how to load a program into Teensy2, proceed with assembly of your Babuino. I will show you how to hook up Teensy2, how to add the Babuino features, and how to hook up the motor control chip. Download the pdf version of the schematic for reference.

Begin by installing Teensy2 and the L293D dual H-bridge as shown in the diagram labeled “Teensy2-1”. This diagram also shows how to hook up the power supply and the voltage regulator IC. Connect your battery holders as shown in the Battery Holder Connection Diagram, but don't actually connect any power to the breadboard yet! If you use battery holders with wires already connected to them, the red wire will be positive and the black wire will be negative (ground). If you're not sure, check them with your voltmeter.

Once your power supply components are in place, you should verify that the output voltage is correct before you connect Teensy2 and the motor controller. This is a better safe than sorry step! So with the wire from VR1 to Vcc (+5V) disconnected, hook the wires from the battery holders to GND and to Vbatt at C3. Using a voltmeter, check the voltage at pin 3 of VR1 (the output). It should be close to 5 Volts. If it isn't, check your wiring and correct any errors. If you don't have a voltmeter, double check your wiring and hope for the best. (Also consider buying one. Harbor Freight sells a suitable unit for about $10 and often has them on sale for much less.)

Continue building Babuino following the Teensy2-2 diagram to hook up most of the rest of the components. This diagram shows the resistor and LED as separate components; you may have joined them together as discussed above.

Teensy2-3 shows the final step: how to hook up the L293D dual H-bridge. Picture 10 shows the completed Babuino circuitry. Note the orientation of the voltage regulator VR1 chip. Be sure you have this part connected correctly! This picture also shows the placement of the two battery holder on top of the breadboard. (Those with sharp eyes may notice some minor variations between the picture and the diagrams. The diagrams and schematic are correct and are what you should follow.)

For reference, the Babuino connection diagrams for Teensy2 and the L293D are provided. Use these to guide any experiments you may want to do. Right now, Teensy2 Babuino only supports two motors and 4 switch/sensor inputs (same as the Arduino version). You can imagine, given the number of reserved pins in the Teensy2 diagram, that more resources are available. And you are correct. Future versions of Teensy2 Babuino will support 4 motors and 6 switch/sensors. Be warned that the pinout may change to support this expansion.

Step 8: Using Your Robotics Breadboard

The last Instructable explains how to download the Babuino firmware and the Blocos programming environment for it. Please refer to that work for all the details. Downloading Babuino to a standard Arduino (with the 328P) is explained there also, so I won't go over that again. The only missing part is how to use Babuino with the Teensy2 and I'll explain that here.

If you have a Linux or Windows system, you need to do a bit of work to get the usb/serial port ready to use. The instructions are on this page. You do not need to download and install Teensyduino (unless you want to – it won't hurt if you do). Scroll down to “Additional Installation Instructions” and follow these to ready your usb/serial communications. For Linux, the file you need is at the top of the page under “Teensyduino Files”, with the heading “Linux udev rules”.

Download Babuino for Teensy2 following the same procedure described in the Instructable, but choose the file named file “ Babuino_Teensy_v020.hex “. To install Babuino on Teensy2, follow the instructions given on the Teensy2 website for the Loader for your PC. Mostly, you can just drag and drop! After the Teensy Loader completes, it will start Babuino and the USB connection will become a serial port. Install the default driver when prompted in Windows; Mac or Linux systems should just work. You will hear Babuino beep and see the Status Led (on board Teensy) blink slowly to indicate it is ready for a program to be loaded. Run Blocos, create a program and click Download. You'll hear two beeps when the program is loaded. Now press the RUN button on your Babuino and your program will run. Press it again to stop. Since the Blocos program is stored in EEPROM, you can unhook your USB cable and press RUN to run the program using battery power only.

The simplest way to turn on and off your Babuino (either version) is to unplug the connection from the battery holders to Gnd (ground) on your breadboard. Note that the Arduino version uses the RESET version to reset, while the Teensy2 version expects you to cycle power to reset. The Reset button on board the Teensy2 board starts the Teensy2 Loader as described on the Teensy2 website. When using the USB with Teensy2, it's a good idea to unplug the Gnd connection so the voltage from the USB won't compete with that from the Babuino voltage regulator.

If either or your motors runs the wrong way (that is, turns opposite to what you think it should), simply swap the two wires from the motor at the L293D. There are other places you could make the swap, but this is the easiest. Using Blocos, you'll find it's very easy to write short programs to test your Babuino. These will help you learn how to use it for more interesting projects.

Step 9: Notes on Switches and Sensors for Babuino

Building switches and sensors for Babuino will be the subject for future Instructables. But since there will be a lot of folks who won't want to wait and will want to start experimenting, here are some general notes to guide you. Refer again to the 328P (Free/Arduino) and Teensy2 pin diagrams to see the Switch/Sensor connections.

Switches (buttons) are sensed by Babuino (in fact any microcontroller) by connecting one side of the switch to Vcc (5 Volts in our case) and the other side to one of the four switch/sensor pins. Then a resistor (5K to 20K) is connected from the pin to ground. This resistor pulls down the pin to ground, so a LO is read at the input when the button is released (switch is open). When the button is pressed, the pin will be shorted to Vcc (the resistor limits the current from ground) so a HI will be seen at the switch. (Note that the RUN button on Babuino does not require a resistor since it uses one internal to the microcontroller.)

Sensors work in a way similar to switches, but a continuously variable voltage level is sensed instead of just Vcc or ground (HI or LO). Different sensors have different ways of signaling the level of the variable they sense, and so there's a bewildering number of ways of creating a voltage level to sense. Probably the simplest way is to put the sensor in one leg of a voltage divider. I'll explain the details in a future Instructable, but this hint should put you experimenter on the right track.

For some very useful examples, use the Instructables Search box and enter “adafruit sensors”. You'll find some great examples and some useful information which will get you off and running building your own sensors.