Hexapod robots are one of the coolest robots to build, but they are usually quite expensive. One of the reasons is that they usually have lots of parts and use 18 servos, all of which need to be powered and driven by some microcontroller. In this tutorial, I will show how to build your own Arduino hexapod, or Ardupod, by 3D printing all the parts and using only 12 servos to control the robot. Are you ready? Let’s get to it!
As mentioned above, this particular hexapod only uses 12 servos to move six legs. That means we have only 2 servos per leg with 2 degrees of freedom (DOF). Compared to the usual 3 servos (per leg), this approach has several advantages. We will need less power to run the servos and less processing time to drive them. However, by removing one of the servos, we also sacrifice 1 DOF, so it might be more challenging to program the robot to crawl steadily.
To compensate for missing one servo, all the legs must have a mechanical system that will translate the angular motion of the servo to linear motion of the leg. You can see how this mechanism works on the following animation.
As you can see in the video, a spring is included inside the mechanism. The main reason is to compensate for any inaccuracies caused during the printing process. The spring can also help achieve a more natural crawling motion as it gives greater support. You can get springs anywhere. For example, the small springs inside ball pens will fit just fine here, but probably you’ll have to trim the lengths a bit. Make sure that they are compressible and can support robot’s weight. Also, before you start printing the parts, make sure that the springs you have will fit between the printed parts leg_1 and leg_1_seg_1 (see Github for details).
Welcome to the most difficult part of this entire article: assembling the legs. This is a fairly advanced project in both construction and programming. It will be assumed that those attempting to make this robot have basic skills with equipment like drills and soldering iron.
When assembling the leg, always remember that you have to put a washer between every two plastic pieces that are supposed to move up and down. You will probably need to adjust the size of the holes with a drill; the bolts have to be able to rotate freely. Please note that for every bolt we need two nuts.
This is extremely important to allow the entire support system to work. When assembling the legs, be sure not to have the bottom nut too tight and adjust it so that the plastic parts can still move freely. Then, tighten the upper nut as much as you can. The bottom nut will ensure everything move freely, while the upper one keeps everything together. It you loosen the nuts too much, the legs will be very unstable. If you tighten them too much, they will put unnecessary load on the servos. Adjusting the legs will probably take several attempts. It’s the most important part of the tutorial, so make sure that you get this step right.
The servos are held in place by a little “horn,” which usually is used to attach the servo gear axis to anything you want to move. In this case, however, the horn will be fixed in place so that when the servo moves, it will move itself, therefore moving the leg.
Make sure you use metal gear servos and not those with plastic gears! Not only are the plastic ones weaker than their metal counterparts, but their gears are also likely to get quickly destroyed in this application.
The servo holder is split into 3 parts to make printing easier. Assuming the parts are printed with Acrylonitrile Butadiene Styrene (ABS), you can use acetone to dissolve the ABS a bit, then stick the parts together and let it dry out. Alternatively, if you have access to a higher quality 3D printer, you can print the entire part in one shot.
The rest of the hexapod body isn’t really all that complex; the main body is made up of two plates, on which we can mount all the electronics, batteries and sensors we need. You can either prepare the holes for mounting the electronics before printing or after by drilling them as you go along. All the parts and printing instructions are available on Github.
That’s it! You have successfully completed the assembly of the robot. You made it through the most difficult part of this tutorial. If something went wrong, don’t worry and try again. If necessary, try making few adjustments to the prints and see it that works.
This is by far the easiest part, because we will use Adafruit PWM shield to do most of the work. We’ll connect the shield to the Arduino and the servos to the shield. In case you’re using the module that can’t be directly connected to Arduino, just connect SDA, SCL and V+ to the appropriate Arduino pins (see the diagram below for details).
You might have noticed that there is a place for a capacitor, but the capacitor is nowhere to be found. Don’t worry, this was intentional! When moving a lot of servos at the same time, the current spikes can reach up to several amps. The capacitor will even out these spikes. You’ll probably need to have this capacitor to ensure stable power for all the servos. Electrolytic capacitors are best for this, but the values are more of a guess than an exact science. Generally the higher the capacity, the better. The voltage of the capacitor should be a bit higher than your battery, so if you use 6V battery to power all the servos, 6.3V 4700µF capacitor should be just fine.
On the shield, you’ll also notice a separate power terminal. That’s there because Arduino itself can’t provide enough current to move more than one or two servos at a time. Connect the battery to this terminal as well as to Arduino power input (VIN and GND pins).
That’s it, the basic wiring is done! If you want to, you can add more modules and sensors, such as ultrasonic range finder.
In this tutorial, I will be adding an ultrasonic sensor to give the robot the ability to navigate around obstacles. I chose HC-SR04 because they are fairly cheap and easy to use with Arduino. Also, the shape of this particular sensor resembles the eyes, so you can tell where the robot is looking!
I mounted the sensor on an extra servo (see Fig. 7 for mounting details). Wiring this sensor is really easy as well, just be careful NOT to connect the VCC pin directly to the battery! Doing this will likely destroy the sensor if you’re using a 6V battery. Connect the VCC pin to Arduino’s 5V output and GND to GND. You can connect TRIG and ECHO pins to any digital pin you have left, just remember to set them appropriately in the code. I connected them to pin 3 (TRIG) and pin 2 (ECHO) just because I like to keep pins 0 and 1 unconnected in case I need the Serial port.
At this point, you should have all the hardware assembled. Before powering anything, I strongly recommend you test and verify every single connection that you made.
I hope you made it this far without any major problems. If you have any suggestions for improvements to this design, please let me know on Github! Stay tuned for the second part of this project. We take it to the next level and have a closer look at inverse kinetics and programming this amazing Arduino hexapod, or Ardupod.
What you see below is the ArduPod stretching its legs one at a time!