Andy the Autonomous Arduino Powered Rover - Part 1
A few months ago, I set out to create a simple robot that would teach kids both the mechanical and coding side of robotics and could be used in STEM education curriculums. After a few weeks of research and development, I settled on a design that was based on the Dagu Magician Chassis and Arduino. The Magician Chassis is a low-cost robotics platform that is based off of two gear motors and laser cut acrylic sheets that have hundreds of mounting points on both the top and bottom.
Since I was designing the robot for youth STEM education, I wanted to make him appeal to a younger audience, so I named him Andy the Autonomous Arduino Powered Rover, or ATAAPR for short. In this tutorial series, I will be showing you how to build Andy from the ground up, code him to avoid obstacles in his path, and how to tweak him to perform better. For this installment, we will be focusing solely on building the robot from the ground up.
I will not cover the whole education aspect of the robot as that is still an on-going project that I will be refining over the next several months. However, by the end of this series, you will be able to build an Andy replica that you and your kids could easily build on a Saturday afternoon with little to no knowledge of coding or robotics yourself.
The Magician Chassis is the perfect platform for this type of robot because it includes the motors, wheels, chassis, battery pack, and standoffs needed to mount the electronics, and, with a price of about $15, it is an unbeatable value. As for the electronics, I chose to go with Arduino-based hardware as it is easy to interface, open source, and kid friendly. Its IDE is also easy to use and beginner friendly, which is key to designing a successful educational kit. I have also utilized a cheap hobby servo and a HC-SR04 ultra-sonic "ping" sensor to help aid in object detection. This sensor is a little harder to interface than the three-pin version from Parallax but only costs a few dollars on Ebay.
Several discrete components are needed as well, including two 480 ohm 1/4 watt resistors, two 5mm LEDs, and a 9V battery clip. Several male-male jumper wires of various lengths will be needed as well as eight male-female jumper wires. A micro-breadboard, Velcro strips, some double stick foam mounting tape, and large 1.5-inch "googly eyes" will be needed as well. Finally, some 3D printed parts will need to be acquired, but only one of them is critical and could be made by hand from cardboard, wood, or anything else that is easily workable with hand tools.
Tools needed include a Phillips screwdriver, precision flat head screw driver, hot glue gun, wire strippers (if using hookup wire like I did), and a small pair of pliers. A multi-rotary tool, such as a Dremel, with diamond bur bit is also needed to modify the chassis a little. Additionally, a multimeter with continuity testing could come in handy if you need to troubleshoot connections. As far as software goes, the Arduino IDE is the only thing you will need, and it can be downloaded for free from Arduino.cc. Below is a list of exactly what you will need, and you can find links to buy these components by heading over to my TweakTown Author Blog.
- 1x Dagu Magician's Chassis
- 1x Arduino Uno R3
- 1x Arduino Motor Shield R3
- 1x Hobby Servo
- 4x M3 x 40mm Screws With Nuts
- 1x HC-SR04 Ultra Sonic Sensor
- 2x 480 OHM 1/4 Watt Resistors
- 2x 5mm White LEDs
- 1x 9V Battery Clip
- 1x Pack of Male-Male Jumper Wires
- 8x Female-Male Jumper Wires
- 1x Micro Breadboard
- 1x Velcro Strip
- 2x 1.5-Inch "Googly Eyes"
- 1x Foam Mounting Tape
- 4x AA batteries
- 1x 9V Battery
- 1x USB A to USB B Cable
Total cost for the robot comes to about $100 when bought in single quantities, which is less than what most educational robot kits cost now. Factor in about an hour's build time and an hour of teaching the coding aspect, and you have a complete low-cost educational robotics kit that could be built and taught over two class sessions to youth ranging from sixth grade up to high-school seniors and beyond.
I always like to start my builds by laying out all of the components in a neat and orderly grid pattern. This makes it easy to find parts and lets me make sure that everything is there before I begin the build process. To get started, lay everything out and make sure it's all there. You may notice that some pieces are missing in this photo, and that is because Andy evolved over the course of the build, and some things were added or removed.
The first thing you need to do when building the Magician Chassis is to attach the motors. They attach to the chassis via two small tabs that keep them in line with the robot's center of gravity. In your kit, you will find four small screws with accompanying nuts. These will be the screws that hold the motors in place.
Unfortunately, the wires that were soldered to my motor were very lose and broke off during installation, so I had to solder them back on. I took note of which direction the wires would feed into the chassis and soldered them with a bias to that direction.
Once the solder cooled, I secured the wires to the motor's housing using some hot-melt glue and then proceeded to mount the motor to the chassis using the small tabs and screws. You will notice that I went a step further and glued the wires to the chassis as well. This is not a necessary step and was just an extra precaution I took as Andy will be handled by many people in the next few months.
With both motors mounted and secured, it is now time to move on to the rear "wheel" support. Notice how I placed the nuts to the inside of the motors. This made attaching the second motor a little harder but was well worth it for appearance's sake in my opinion. Be careful not to tighten the screws down too tight as it will crack the acrylic tabs and ruin the entire kit.
With the motors mounted, we can move on to mounting the rear omni-ball support that will help our robot stay stable when traversing the course we will lay out later for him to navigate through. The omni-ball mounts consist of two 25mm long stand offs, four screws, and the omni-ball. Line them up with the correct holes on the chassis and screw everything down; remain mindful not to tighten down the screws too much.
With the omni-ball mounted, we can move onto mounting the battery pack. The kit's official directions say to screw this down to the chassis, but I found that to be difficult as it requires disassembly of the robot to change the batteries. A better solution is to use Velcro to allow the battery pack to be easily removed from the chassis without any disassembly.
If you cannot tell by now, I use hot glue for everything and, over the years, have found it to be the best method to glue Velcro to plastic surfaces. In the image above, you will notice that I used a long strip of Velcro on both surfaces. In hindsight, I would recommend using a long strip of the hook side of the Velcro on the robot chassis and a smaller 1-inch piece on the battery pack. This provides enough grip to hold the pack but leaves it loose enough to be easily removable with just two fingers.
With the battery pack now securely in place, we can attach the wheels in preparation for adding the top half of the chassis. Make note that the wheels are indexed to the axles by the flat spots on the axle and wheel hub. Since all of these parts are extrusion molded, it is best to use a file, piece of sandpaper, or hobby knife to remove the mold seam from the parts for a better fit.
I have built Andy several times over the last few months, and I have taken notes each time on how to do things easier and make the entire project look cleaner when finished. The battery pack we installed earlier is used to power the Arduino via a barrel jack, and the connector on the end is too fat to fit through the holes in the Magician Chassis, so a little modification is needed to make things fit. Luckily, only a small tab needs to be removed, and quick work of it can be made with a Dremel. Alternatively, a file could be used, but the Dremel is much faster.
Using a cut off wheel on the Dremel rotary tool, cut two small slices into each end of the tab and then do the same thing on the reverse side of the chassis. Use a pair of small diagonals or nippers to remove the now weakened tab.
You can leave the hole like this if you chose, but I like to clean things up a little and make modifications look as close to factory as possible. I used a diamond bur bit to remove the excess material in the newly enlarged slot. This only took a minute or so to do, and the result is a clean slot to pass your power cable through. This entire step is not necessary, though, as you could just pass the cable on the outside of the chassis frame.
Now we need to mount the Arduino board to the upper chassis. You can use mounting tape for this, but I like to use the provided stand-offs and mount the board the proper way. It will take a little fine positioning to find the exact location where the holes on the Arduino line up perfectly with the holes on the chassis, but they do line up. You will also notice that I have already mounted the micro-breadboard to the chassis during a previous build. I used 3M heavy duty mounting tape, which proved impossible to remove for this build.
If you position the micro-breadboard flush with the rear edge of the chassis, the Arduino should but up to it perfectly when mounted. Use 3M mounting tape as the included double stick tape is just not strong enough to hold a good bond. Once everything is lined up nicely, you can secure the Arduino to the stand-offs with the supplied screws.
Flip the top half of the chassis over and attach the 25mm stand-offs to the chassis mounting holes as seen in the image above. It is important to use all of the mounting points for added strength and rigidity.
Before we mate the two halves of the chassis together, we need to install the servo that will sweep the ultrasonic sensor to "look" for objects in the path of the rover. I used a standard-sized hobby servo for this and mounted it to the chassis using M3 x 40mm screws. The screws did not fit well, so I had to modify the chassis slightly with the Dremel tool again.
With the screws in place and tight, the servo has been securely mounted. It's worth noting that my servo had a fairly long cable and I had to Dremel out the front hole in the chassis to fit its connector through. This took just a few moments and made for a very clean install.
Here is where you will notice one of the big changes I made. The original Arduino I mounted to the chassis was not an Uno R3 compatible version, and this did not allow the Arduino Motor Shield R3 to fit, so I had to substitute this Arduino-compatible board from SainSmart that I had laying around. It is an R3 design, and everything is pin-to pin compatible with an official Arduino Uno R3. Here is where I began to route the various wires through the chassis. You can see that I have pulled the left motor wires through one of the slots in the board and that the power cable is also routed through the hole I enlarged. Flipping to the other side, and you can see how I routed the servo cable to the breadboard and used header pins to connect it.
I also connected the two halves together at this point but forgot to take photos of the process. It is as simple as aligning the standoffs with the proper holes on the bottom of the chassis and screwing them together while remembering not to make things so tight as to break the fragile acrylic.
Building Andy Cont.
Building Andy Continued
The SainSmart Uno S is very similar to the Arduino R3 and actually includes both female and male breakout connectors. This is handy when you only have female-male jumper wires. Moving back to the left-hand side, you can see that I routed the second set of motor wires through the adjacent hole I routed the first wires through.
I found that the pins connected to the motor wires prohibit a 90-degree connection from the motor shield because they no longer reach inside the screw terminals when they are bent. If you are not worried much about aesthetics, you can skip this step and just screw them into the terminal blocks as normal. I clipped off these ends and stripped back bare wire.
To ensure a good connection, I quickly tinned the bare wire with my soldering iron and screwed them down tight into the terminal. This ensured that my connection held fast to the screw terminal and would not break away during transport or handling. I did this with both sets of motor wires.
Now it's time to include a power source to drive the motors. The simplest and cheapest way to do this is through a common 9V battery. Take your 9V battery clip and strip and tin the ends if they are not already tinned for you. Then, using a screw driver, insert the wires into the terminal blocks in the Vin (Red) and GND (Black) slots. You will notice later that I routed the 9V wires through a hole in the chassis.
Here is a nice shot of everything connected. You also get to see the Arduino Motor Shield R3 here for the first time. Note how I have everything connected as you may need to reverse one set of the motor wires later on.
Now that we have the Arduino, Motor Shield, and Motors partially wired up, it's time to move onto the ultra-sonic sensor and get it installed onto the servo. As you can see, I used my 3D printer to print a custom mounting bracket for the HC-SR04 sensor. I have uploaded the .STL file for this bracket to my Thingiverse account so you can download it for free. Here is where the male-female jumper wires come in handy. I did not have any, so I had to improvise and use male header pins to make male-female jumpers. Mounting the sensor to the bracket is as easy as sliding the round transceivers through the holes. You may need to file these holes some depending on how well calibrated your 3D printer is.
I used a little dab of hot glue on each corner to secure the sensor to the mount. Once this is completed, you can place the mount on top of the servo. Once you are sure that the mount is centered with the servo's sweep, you can screw it down. I used a dab of hot glue on the screw and mount as my servo's splines were a bit worn down. Be careful not to tighten the screw too much as it will bind the servo.
Here you can see that I again used hot glue to secure the makeshift connector to the sensor's pins. Since this is a moving piece, I highly recommend doing this. I have also hot glued the cable where it passes through the chassis leaving about two inches of slack to compensate for the movement of the ultra-sonic sensor. This helps prevent abrasion of the cable and keeps everything nice and secure.
In these two shots, you can see how much slack I left between the sensor and where I glued it down to the chassis. Moving to the back of the chassis, you see how I routed the sensor wires close to the servo wires and used the header pin method to connect the cable to the breadboard.
Now it's time to give Andy some headlights. While this is not a necessary step, I included this as a way to add in another coding lesson to the robot. Using female-male jumpers, affix 2 LEDs to the wires and route them back through the chassis.
Before gluing on the LEDs, let's affix some goofy "googly eyes" for comical effect. Just a thin dab of hot glue is needed as anymore will melt the eyes.
Once you have the eyes glued on, glue the LEDs in place as seen in the image above. I glued all the way past the connector making sure the glue encapsulated the LED leads as well as the connector. This prevents the LEDs from falling out of the connector. Remember to color code the jumper wires with the leads; make the anode the lighter color wire and the cathode the black wire.
What would a robot named Andy be without a big, toothy smile? Here I printed a mouth with teeth out on my 3D Printer. I used mounting tape that I trimmed to fit and then pressed the mouth into place.
Here is Andy with his big smile! Notice that the mouth has been placed behind the front chassis mounting screw.
Now it's time to tackle the most tedious part of the entire process. Wiring up the Arduino to the servo, ultra-sonic sensor, and LED headlights is a simple task and quite quick if you use generic jumper wires. For the purpose of this article, I chose to use hookup wire that was cut and bent to size to make everything easier to follow and as neat as possible. The first thing we need to do is drop a ground to the breadboard; as you can tell, I did just that. I extended the ground to each LED. In the image above, I did mess up and have the right resistor out of place a little. Move the ground wire over by one hole to the left and all will be fine.
In these two images, you can see that I cleverly ran the wires for the LEDs under the motor shield in an effort to keep the project neat and clean. Don't worry too much about following the wiring in the images as I will have a wiring schematic you can follow instead at the bottom of this article.
Here you can see that I have extended the ground to another row of connectors and dropped 5V down to the board.
In these two images, I have connected the servo and ultra-sonic sensor pins to the Arduino using more tight-fit custom-bent jumpers to keep things clean.
Finally, you can see where I brought the servo and sensor data lines to the other side of the Arduino using the same method I used when running the LED power lines. Below, I have included a wiring diagram to help you wire your robot exactly as I did mine. In the next installment, we will cover programming Andy using the Arduino IDE. Thanks for reading and remember to Hack The World and Make Awesome!
PRICING: You can find products similar to this one for sale below.
United States: Find other tech and computer products like this over at Amazon.com
United Kingdom: Find other tech and computer products like this over at Amazon.co.uk
Australia: Find other tech and computer products like this over at Amazon.com.au
Canada: Find other tech and computer products like this over at Amazon.ca
Deutschland: Finde andere Technik- und Computerprodukte wie dieses auf Amazon.de