Introduction: Arduino Hexapod (With a Personality)

About: I break things so I can figure out how they're made when I put it back together.

In this instructable you'll learn how to make your own Hexapod!

The robot I've made is based off of Penny and Stomper...two amazing hexapods!!

The neat thing about this robot is I've made the chassis using mostly scrap...old pen tube refils and old mechanno parts!

Some functions the hexapod performs are :

  • Rove around avoiding obstacle autonomously
  • Check its own battery level and shut down if there isn't enough.
  • Stop and wobble happily if someone pets it on the head :p

Hope y'all enjoy this instructable :)......

Step 1: Parts List

Hardware :

  • Arduino Pro Mini (just about any board should do...I used this one due to its small size.)
  • 3 x 1k resistors
  • 1 X 10k resistor
  • Female and Male header pins
  • 2 x White LEDs
  • 1 x Blue LED
  • 3 x Turnigy 9g Servos
  • 1 x 100uf Capacitor
  • 1 x 7.4V LiPo
  • 1 x HC SR04 Ultrasonic Sensor
  • 1 x LDR
  • 1 x NPN Transistor
  • PCB (About 5cm X 5cm)

Chassis :

  • About 15 pen refill tubes.
  • An old plastic case for the body
  • Mechano parts to link the servos with the legs
  • 2 x 40mm Aluminium Hex Standoffs
  • 4 x 16mm Aluminium Hex Standoffs
  • 4 x m3 nuts and screws
  • Black tape

Misc Tools :

  • Soldering Iron and Solder wire
  • Glue Gun

Note : I recommend using this parts list as a reference and to not follow it strictly....the parts I've used may not be available everywhere....so don't be afraid to improvise!!

Step 2: Building the Chassis...

Start off by drawing a rough sketch of where you want to place the servo motors on the hexapod body.This will depend on a lot of factors like where you'll want to place the electronics,dimensions of the body,etc.

I won't go into specific measurements as each chassis wont be the same but make sure you stick to these basic points :

  • The servo that tilts the hexapod is located at the centre of mass of the robot.
  • Make sure you're aware of the weight each servo can carry.
  • Align the right and left legs properly
  • Make the legs for the servo in the center a bit shorter than the other legs...this makes it easier to tilt the hexapod.

Start by taking 2 pen refill tubes and make holes through them.This is where the metal wire will go through and hold them together to give a strong support for the legs.

Next twist the wire all the way down to the end of the tubes and cover the legs with black tape.The black tape gives the legs a carbon-fibre look..well kind off.Now its time to connect the leg to the mechanno piece using hot glue.(The pictures will serve as a better guide :p)

Repeat these steps for all the legs...I've included pictures of all the completed leg pieces.

Once you have all the legs made connect them to the servo horns using some hot glue and screws.

Now on to connecting the head...

Step 3: Making the Head...

For the head I've used an HC SR04 ultrasonic distance sensor..This is housed in a nifty little shell I scavenged from an old torch....makes the head look a bit like Wall-E's head. :D

I've also added a blue backlight to the head....makes the robot look a bit more alive!!

There's also an LDR on the top of the head to measure the light intensity of the surroundings...and also a way for the robot to know when its being petted. :D

Again I'll let the pictures do the explaining..

Step 4: The Electronics...

For controlling the servo's I've used an Arduino pro mini due to its small footprint.

The 7.4V LiPo powers the Arduino and the servos.

Note : The battery input is given to a 5V regulator and then fed to the servos..DO NOT CONNECT 7.4V TO THE SERVOS!!

Here's a list of the sensors and LEDs connected to the Arduino :

  • HCSR04 ultrasonic sensor : TRIG--->Pin 8,ECHO---->Pin 7.
  • LDR ----->Analog Pin 0 (A0)
  • Headlight LEDs------->Pin 4 via a NPN transistor
  • Blue LED------>Pin 3
  • Battery Voltage detection----->Analog Pin 2 (A2)

The Servos are connected to the following pins :

  • Left Servo----->Pin 9
  • Right Servo----->Pin 11
  • Center Servo----->Pin 10

The circuit diagrams for the LEDs,LDR and Battery voltage detection circuit are in the pictures.

Step 5: Putting Everything Together....

I've mounted the head on a tiny piece of PCB using female headers....this board is then connected to the main controller board via wires....duh :D

The two headlights are hot glued on both sides of the head in the front end.

The main controller board and battery are on the bottom of the chassis.....held together with some double sided tape.

Neatly zip tie all the wires coming out of the main controller board.

Now on to the code....

Step 6: The Code...

Here's a basic rundown of the code :

It starts off by initializing pins,setting the servos to their center position andtaking ambient light readings from the LDR.

The first thing the main loop does is check the battery level....because no one is going anywhere without battery :p

If the battery is above the minimum value the loop will continue forward...otherwise the hexapod will detach all servos and rapidly flash it's blue LED, indicating a change of batteries is needed.

It then checks the light reading over the head....to see if the robot is being petted or not.If all's well the robot goes into the obstacle avoider mode and starts walking around.

If you pet the robot on the head (gently)....its LDR will sense the change in light intensity and the robot will happily wobble under your hand.

You can watch all these functions in the video!!

Step 7: It's Alive!!!

After uploading the code on to the Arduino....connect the batteries and watch your hexapod take its first steps. (You'll probably have to do a little debugging first though.)

If you've enjoyed this instructable please vote for it!! (Big orange button on the top-right :D)

Cheers!!