Hexapod

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 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 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

The six legs are assembled identically, and the build steps are shown below. Everything is held together with 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: the servos need to be ‘centered’ (i.e. set to 90 degrees) before they are attached and assembled into the leg parts.

The electronics used include:

  • 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.
  • 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.
  • 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.

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.

The LED board displays the battery voltage level as well as the various mode selections. It’s made from a 9×17 hole perfboard, some bi-color LEDs and 8 resistors. It plugs into the row of discrete I/O pins 22 to 52 (even) of the Mega 2560 board. The LED board is shown as part of the schematic above.

When turning power on to the robot, the servos will move to indeterminate positions and then return to the ‘home’ position as commanded by the processor after it has started up.  For this reason, it’s important to hold the robot in the air when turning it on so the legs don’t smash into the floor and possibly break the PLA parts or the gears within the servos.  Here are a few photos of the whole thing:

The robot works using inverse kinematic (IK) calculations – that is, the servo positions are computed based on the desired x,y,z coordinates of the tip of each foot. Knowing a few constants – the tibia, femur, and coxa lengths and the offset angles between the axis of the servos and the structure – permits the desired servo angles for all possible x,y,z coordinates to be calculated. Each leg is mounted at a different angle and the offsets of each leg from the center of the body is different, so the computed coxa angle varies for each leg.

The gaits I have programmed for the robot include tripod, wave, ripple, and tetrapod variants:

  • 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.

The robot’s remote control is a standard PS2 wireless controller as I mentioned earlier. 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:

Parts List

Hardware Usage

Finally, here is the complete software source for this robot:

Hexapod Software

Comments are closed.