Let's Make Robots!

Simple 12 DOF hexapod

38Khz_IR_receiver_VISHAY.pdf159.61 KB
IRremote.zip23.21 KB
Hexapod_Assembly_Manual.pdf2.93 MB
_12_DOF_Hexapod.zip2.57 KB

Now available from SparkFun! https://www.sparkfun.com/products/11497

Hexapods are a popular robot design but they tend to be either 3 servo or 18 servo. I decided to try a 12 servo hexapod with 2 DOF legs. Although this does not give the same range of motion as 3 DOF legs I found you could still travel in any direction as well as rotate on the spot.

The assembly was very simple using QuadBot legs. The robot could be easily made with chopsticks and polymorph or paint sticks and hotglue.

The hardest part for me was the math. It's been almost 20 years since I have done any trigonometry and with the legs all at 60° from each other I could not cheat like I did with Chopsticks.

After a bit of messing around I finally got some basic code running. My attached sample code controls the robots movement with 3 variables.

Speed and Angle (with Rotate=0) allows the robot to walk in any direction.
Speed, with Rotate set to plus or minus 1 (Angle is ignored) makes the robot rotate clockwise or counter clockwise.
A 4th variable, Stride changes the size of the steps.

This code was originally written for a Spider controller but since a standard Arduino controller can drive 12 servos using the servo library the code could be easily adapted for something like a Uno with a bit of prototype PCB used to mount the servo headers.

I've been lazy and plugged my IR receiver directly into digital pins 10,11 & 12.This saved me making a proper cable. Arduino I/O pins can easily handle the nominal 3mA current draw required for the receiver. See the attached datasheet. D10 is my input. D11 is set to output low (Gnd) and D12 is set to output high (Vcc).




I have added more comments to the code to make it easier to understand as well as an IR test mode that allows you to see what values your TV or DVD remote is generating. Once you know what values your remote buttons are generating you can substitute those values into the code. I was using a Sony TV remote when I wrote the sample code but the IR library will work with other remotes.

I have also attached an updated version of the IR library that will work with Arduino 1.0 as well as the older versions.




I have attached a draft of the assembly manual (Thanks Frits) and the latest sample code which uses the Stride variable to ramp the leg movements up and down when you start / stop the robot. This reduces the strain on the servos and allows to robot to return to a neutral stance when you stop. Detailed comments on most lines explain how the code works.



Now sold by SparkFun:

Good news for anyone who would like to build this robot. SparkFun are now selling this product. The third video shows it featured in the SparkFun 2012 Halloween "New Product Post" all dressed up in it's own halloween costume starting about 8:36 in the video.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.


attempting to try out the spider control board, have all the needed libraries and components.  However, when I attempt to verify the code, Ardiono gives me the following error.

IRrecv irrecv(RECV_PIN);

'IRrecv' does not have a type


Is there a step I am missing?

thank you!

The IR receiver library does not play well with different versions of Arduino. Try using an earlier version like 1.02 or even 0022.

Failing that, if you are happy to use the SONY IR protocol then try this instead. http://letsmakerobots.com/node/39384


Nice robot!


This my hexapod controlled by bluetooth :


You can find more photos and videos here : http://steamcyberpunk.net/2013/05/20/hexapod-telecommande-en-bluetooth-et-infrarouge/

I use this xbee bluetooth module : http://www.seeedstudio.com/wiki/Bluetooth_Bee

This module is very to configure.


Why don't you post it as a robot post here on LMR?

Yep, it's done !!!

The page : http://letsmakerobots.com/node/37256

Thats fantastic news OB1, i watch the friday product updates and had to do a double take and rewind when i saw your "Kit".


I connected 6xNiMh AA batteries in the spider controller, i would like to know if there is a led that blink when all is okay?

When I connect the usb cable in the spider controller, the "D51 knee4" and the "D24 hip4" move.

What is the good procedure to test ?



Servos can move or twitch when you plug in the USB cable or upload new code because the MCU resets and the servos may temporarily get an incorrect signal. This is normal.

The PCB LEDs are:

  • L1 = D13        (If not program is installed then the bootloader will blink this LED)
  • L2 = Power
  • L3 = TX
  • L4 = RX

D51 is also your MOSI pin which is probably twitching as a result of the bootloader checking to see if you are trying to upload code.
D21 is also your SCL line for I2C.

Try moving those servos to different pins.


I have this "IR compound eye" (http://www.dagurobot.com/goods.php?id=9) instead of "IR receiver sensor" (http://www.dagurobot.com/goods.php?id=99). I would like to know if with the "IR compound eye" i can use it with a remote control ?