This is my hexapod robot inspired by the PhantomX AX from Trossen Robotics. The PhantomX costs $1300, which is way too expensive for my taste, so I decided to design a robot using cheap 180 degree MG996R clone 11kg-cm servos. Before starting, I added up the approximate weights of the servos, 3D printed parts, hardware, and electronics and computed the worst-case required torques for the various leg joints, which I found were within the capacity of these servos. I paid about $5 each on Amazon for my 180 degree MG996R clones in packs of 10 – mine were marked LKY62. The rest of the parts (SBEC, Mega 2560, LiPo battery, 624Z bearings, and screws) totalled about $75. I had the PS2 controller already, but you can find them used on ebay for around $25. The 3D printed parts used around 600g of PLA filament, so figure less than $10 for that. So total cost is right around $200.
Here is a demonstration video of the finished robot:
I designed the robot in Autodesk Fusion 360 and printed the parts on my Creality CR-10S 3D printer. The parts were designed with low weight in mind (thin walls, lightening holes, etc.) to maximize the chances of this working with the servos I had chosen. The PLA parts were printed a bit on the hot side (210° C) for better layer-to-layer adhesion and part strength. All parts were printed with a 0.4mm nozzle at 0.2mm layer height. Files for all the 3D printed parts are available on Thingiverse.
The following parts and quantities are printed in PLA at 30% infill, no support material is needed:
- 1 – Body Bottom Plate
- 6 – Body Risers
- 1 – Body Top Plate
- 12 – Femur Bracket End Caps
- 12 – Femur Brackets
- 18 – Servo Bearing Centers
- 6 – Tibia Base Plates
- 6 – Tibia Bracket End Caps
- 6 – Tibia Brackets
- 6 – Tibia Foot Plates
- 6 – Tibia Sides 1
- 6 – Tibia Sides 2 (Note: the tibia sides are identical, they are just printed with opposing sides down)
- 6 – Tibia Spacer Tubes
The following parts and quantities are printed in PLA at 30% infill with support:
- 1 – Receiver Holder
- 1 – SBEC Holder
- 18 – Servo Mounts
- 6 – Wire Guides
The following parts and quantities are printed in TPU at 10% infill, no support needed
- 6 – Tibia Foot Bumpers
3/8″, 1/2″, and 5/8″ 4-40 machine screws and nuts and 1/4″ #2 screws from McMaster-Carr . I originally started out by tapping the holes in the plastic parts but I found that the screws worked just fine when driven into the raw holes with an electric drill-driver. The 624Z bearings fit tightly into the servo mounts, so heating the bearings before pressing them into the mount made assembly easier.
Important note: the servos need to be ‘centered’ (i.e. set to 90 degrees) before they are attached and assembled into the leg parts. The ‘select’ button on the PS2 controller provides a convenient way to set the outputs to all the servos to 90 degrees, which is the center value. The 1.-IK-Y-Z-Computation-
- a Mega 2560 processor board (Arduino clone) bought on ebay.
- a YEP 20A HV (2~12S) SBEC to power the servos bought from Hobby King. I removed the shrink wrap and remounted it in a 3D printed base, which required resoldering the power leads. The regulator was set to output 6 volts by placing the jumper in the appropriate spot.
- a Logitech PS2 wireless controller and receiver. I carefully removed the receiver circuit board from its case using a Dremel cutting wheel and remounted it in a 3D printed base. The excellent ps2x_lib code library from Bill Porter was used in the software to interface with the PS2 receiver. Bill’s website has a page for troubleshooting issues if your PS2 doesn’t work right with your Arduino. I made a couple changes to the ps2x_lib library for it to work with my controller – see the bottom of this page for the modifications to see if they could help you in case you’re having trouble.
- a 5000mAh 3S 20C LiPo battery from Hobby King. I happened to have this pack on-hand, but the robot probably would work fine with a smaller mAh capacity and possibly a 2 cell 2S pack instead. If a 2S battery is used, some minor changes will need to be made to the battery voltage monitor in the code.
I also used two 7×15 hole perfboards as servo headers, and a 9×17 hole perfboard for the LED status display board. There are just a handful of discrete components besides this. See the complete parts list and schematics below.
- Tripod: a group of 3 legs moves forward while the other 3 legs provide support
- Wave: legs move forward one at a time while the other 5 legs provide support
- Ripple: left legs move forward rear-to-front while right also do the same, but right side is offset so the right rear starts midway through the left middle stroke
- Tetrapod: right front and left rear legs move forward together, then right rear and left middle, and finally right middle and left front legs move
When walking, the robot uses the remote joystick inputs – x and y from the right joystick and rotation from the left joystick – to tell the body which way to move. The gait engines compute the individual foot tip positions required to accomplish the desired movement. Then the IK calculation is applied to each leg’s foot tip coordinate to tell the individual servos where to go to position the legs as requested by the gait engine.
There are also modes programmed to stand in-place and translate or rotate the body. The translation is just a simple addition of an x, y, or z offset to the coordinate system. Body rotation is more involved, but is derived as shown in below where the x, y, and z offsets are computed using matrix multiplication.
ps2x_lib files (mine are installed in the path Documents\Arduino\libraries\PS2X_lib) as shown in red below:
1. In “PS2X_lib.h” change these lines:
#define CTRL_CLK 4
#define CTRL_BYTE_DELAY 3
#define CTRL_CLK 16
#define CTRL_BYTE_DELAY 16
2. In “PS2X_lib.cpp” change these lines:
digitalWrite(dat, HIGH); //enable pull-up
//digitalWrite(dat, HIGH); //enable pull-up
The picture below shows the mapping of the modes and controls to the buttons on the remote.
Here’s a list of the rest of the parts needed to make this hexapod, and the hardware (screws) usage to connect the parts:
Finally, here is the complete operational software source for this robot: