Introduction: Make a Real (cheap) Hexapod !

About: retired mechanical engineer

Have you ever drooled over those cool, dancing hexapods ?  Gotta have it – right?
Then you looked at the price and …well…maybe… not so cool?

Well, read on and you can make it real – a real hexapod for less than a hundred bucks.  It uses only three hobby servos, a battery, and a microcontroller of your choice.  Construction is mostly wood and glue.  It moves forward and backwards and turns left and right.

Here is a video of my hexapod crawler, which I call “Walkin Sticks”. 
http://www.youtube.com/watch?v=5eQiegKdlzc

Step 1: Two Ways to Build, or Why CAD Programs Are So Useful.

One of my objectives in this project was to create a walking gait in which the “footprints” of all the legs fall in a straight line and not in an arc, as an oar in a row boat traces on the water surface.  To do this, I used a 2D CAD program to test out some ideas as shown in the photo above.  My apologies for the black background.  I spent several hours trying to remove it but no joy.

This “in-line” method allows walking on carpet without drag and strain on the servos.  If you plan to only operate on smooth surfaces and do not need this feature, you could greatly simplify the construction.

Step 2: A Parts View

Here is a view of all the major components looking from the bottom.  The green PCB is a Basic Stamp Homework board.  Any other microcontroller will work just as well.  The swing servos are standard hobby servos and the lift (or rocker) servo is a "quarter scale" servo.  The batteries are recycled lithiums.

Step 3: Tools and Stuff You Will Need

Here are some of the things you will be using:

1. A simple microcontroller like an Arduino, PIC, Pololu Servo Controller, etc.  I used a Parallax Basic Stamp 2 in this version.

2. Two standard  hobby servos.  I used Tower Hobbies System 2000 BB servos.

3. One “quarter scale” servo of at least 180 in-oz. of torque.  I used a Hitec HS-765HB.

4. About 24 feet of ¼ inch (8mm) square, knot free, wooden sticks.  I ripped mine out of  a 2x4 spruce stud.

5. 1/8 inch OD brass tubing, two pieces 12” long.

6. 3/32 inch OD brass tubing, one piece 12” long.

7. Two Lithium batteries in series, 1600 MAh or greater.

8. Wood screws, scraps of 1/8 inch plywood, wood glue or crazy glue, solder, wire as required.

9. Basic woodworking and soldering tools.

Step 4: How It Goes Together

This will  not be a step by step instructable showing how to cut and glue part A to part B, since you may decide to use other materials or hardware.  The photos show the dimensions that I used plus the details.  Basic operation is a follows. 

Walkin Sticks uses a tripod gait for walking.  This means the two front and rear feet on one side and the middle foot on the opposite are down at the same time.  While they are down, the other three feet are lifted and swung  to the front (or rear as required ) and lowered.  You can observe this in the YouTube video noted in the introduction above.

The joint bearings consist of 1/8” brass tubing press fitted into the wood arms.  Where inner axles are needed,  3/32” tubing (which slips inside of the 1/8” tubing) is used.  Because there are so many joints, friction can quickly add up, so make sure all joints move freely without binding.

The legs are self locking when in the down position and I added some blue rubber bands to make sure that they lock consistently.  The two side rails were left long deliberately in case I wanted to add a camera or other devices.  Above are drawings of the basic geometry

Step 5: Coding the Controller

The code shown below is for a Basic Stamp Two controller. It is the code used in the video.  If you choose to use a different controller, you will have to write your own code.  Basically the walking sequence is as follows.

1. Start: Large servo down, left servo aft, right servo forward
2. Large servo up, left servo forward, right servo aft.
3. Repeat.

Here is the code in italics:

'{$STAMP BS2}
'{$PBASIC 2.5}
‘wakes up by moving legs then walks fwd, back, and turns left and right for a programmed number of times
'NOTE!! Servo must be powered from source other than Vdd (+5VDC)
'USB port is forward. black leg (left front leg) is used to reference positions. See below
' leg swing: 900=fwd, 750=mid, 600=back – rocker servo  lift: 927=up, 777 neutral/static 627=down

counter VAR Word 'used as index in for/next loops
Paces   VAR Nib  'used as index in repeated loops
delay   VAR Word 'ms between pulses. Min~8. Weird >50. Normal = 20
reps    VAR Word 'number of times to repeat pulse in loop.
Speed   VAR Byte 'This is effective walking speed, 20=hi speed, 1=lowest speed
LongSteps VAR Nib 'note limit of 16 steps
march     VAR Nib 'number of times to march in place at start
OutPinRedServo    VAR Nib
OutPinGreenServo  VAR Nib
OutPinLiftServo   VAR Nib
OutPinLiftServo =  12 'connect lift servo signal line to this pin
OutPinGreenServo = 10 'connect green servo signal line to this pin
OutPinRedServo =   11 'connect red servo signal line to this pin
reps =  150
Speed = 4
LongSteps = 3

'********* waking up and shaking a leg - just for fun ******************

PAUSE 7000 'time allowed for camera setup, can be deleted
delay=10 ' this will decrease as time progresses simulating waking up

'move from 777 to 927 (up)
FOR counter = 1 TO reps
  PULSOUT OutPinLiftServo,777+counter '777 is horizontal position of crank arm, we want to end at 927
  PAUSE delay
NEXT 'finish at 927

FOR march=1 TO 4

  'hold position 927
  FOR counter = 1 TO reps*2 STEP 4
    PULSOUT OutPinLiftServo,927 'hold at 927
    PAUSE delay
  NEXT

  'move from 927 to 627
  FOR counter=1 TO (reps*2) 'move lift servo only
    PULSOUT OutPinLiftServo,(927-counter) 'want to end at 627
    PAUSE delay
  NEXT 'finish at 627

  'hold position at 627
  FOR counter = 1 TO reps*2 STEP 4
    PULSOUT OutPinLiftServo,627
    PAUSE delay
  NEXT

  'move from 627 to 927 (up)
  FOR counter=1 TO (reps*2) 'move lift servo only
    PULSOUT OutPinLiftServo,(627 +counter) 'want to end at 927
    PAUSE delay
  NEXT 'finish at 927
  delay = delay/2 'speed up slowly to simulate waking up - delay goes to zero

NEXT

'move from 927 to 777 (static)
FOR counter=1 TO (reps) 'move lift servo only
  PULSOUT OutPinLiftServo,(927 - counter) 'want to end at 777
NEXT 'finish at 900 fwd and 777 static

PAUSE 1000 'crank will settle to 777 static position due to load

'************* shake three legs **********************
delay = 32
'move from 777 to 927 (up)
FOR counter=1 TO (reps) 'move lift servo only
  PULSOUT OutPinLiftServo,(777 + counter) 'want to end at 927 up
  PAUSE 10
NEXT

'swing from 750 to 900 position (forward)
FOR counter =1 TO (reps) STEP Speed 'move legs servo & update lift servo
  PULSOUT OutPinLiftServo,927 'hold 627 note that 777 is neutral on Hitec 765HB lift servo
  PULSOUT OutPinRedServo,(750 + counter) 'end at 900 position (forward) fwd
  PULSOUT OutPinGreenServo,(750 + counter) 'end at 900
  PAUSE delay
NEXT  ' finish at 900 fwd and 927 up

FOR Paces = 1 TO 3
'swing back from 900 to 600 position
  FOR counter =1 TO (reps*2) STEP Speed 'move legs servo & update lift servo
    PULSOUT OutPinLiftServo,927 'hold 627 down- note that 777 is neutral on Hitec 765HB lift servo
    PULSOUT OutPinRedServo,(900 - counter) 'end at 600 back
    PULSOUT OutPinGreenServo,(900 - counter) 'end at 600
    PAUSE delay
  NEXT 'finish at 600 back and 627 down

  'swing forward from 600 to 900 position
  FOR counter =1 TO (reps*2) STEP Speed 'move legs servo & update lift servo
    PULSOUT OutPinLiftServo,927 'hold 927 note that 777 is neutral on Hitec 765HB lift servo
    PULSOUT OutPinRedServo,(600 + counter) 'end at 900
    PULSOUT OutPinGreenServo,(600 + counter) 'end at 900
    PAUSE delay
  NEXT 'finish at 900 fwd and 927 up
  delay= delay/2 'speed up for each cycle
NEXT

'swing from 900 to 750 position
FOR counter =1 TO (reps) STEP Speed 'move legs servo & update lift servo
  PULSOUT OutPinLiftServo,927 'hold 627 note that 777 is neutral on Hitec 765HB lift servo
  PULSOUT OutPinRedServo,(900 - counter) 'end at 750
  PULSOUT OutPinGreenServo,(900 - counter) 'end at 750
  PAUSE delay
NEXT

'move from 927 to 777 (static)
FOR counter=1 TO (reps) 'move lift servo only
  PULSOUT OutPinLiftServo,(927 - counter) 'want to end at 777
NEXT 'finish at 900 fwd and 777 static

PAUSE 1000 'settle to static position 777 and 750

'********* end of waking up and shaking a leg -finish at 750 mid and 627 static  ******************

'************** start of go straight forward ********************************

delay=10 'reset and move a little slower

'move from 777 to 927 (up)
FOR counter=1 TO (reps) 'move lift servo only
  PULSOUT OutPinLiftServo,(777 + counter) 'want to end at 927 up
NEXT

'swing from 750 to 900 position (forward)
FOR counter =1 TO (reps) STEP Speed 'move legs servo & update lift servo
  PULSOUT OutPinLiftServo,927 'hold 627 note that 777 is neutral on Hitec 765HB lift servo
  PULSOUT OutPinRedServo,(750 + counter) 'end at 900 position (forward) fwd
  PULSOUT OutPinGreenServo,(750 + counter) 'end at 900
  PAUSE delay
NEXT  ' finish at 900 fwd and 927 up

'move from 927 to 627 (down)
FOR counter=1 TO (reps*2) 'move lift servo only
  PULSOUT OutPinLiftServo,(927 - counter) 'want to end at 627 down
NEXT 'finish at 900 fwd and 627 down

FOR Paces = 1 TO Longsteps 'full swing walking forward for LongSteps cycles

  'swing back from 900 to 600 position
  FOR counter =1 TO (reps*2) STEP Speed 'move legs servo & update lift servo
    PULSOUT OutPinLiftServo,627 'hold 627 down- note that 777 is neutral on Hitec 765HB lift servo
    PULSOUT OutPinRedServo,(900 - counter) 'end at 600 back
    PULSOUT OutPinGreenServo,(900 - counter) 'end at 600
    PAUSE delay
  NEXT 'finish at 600 back and 627 down

  'move from 627 to 927 (up)
  FOR counter=1 TO (reps*2) 'move lift servo only
    PULSOUT OutPinLiftServo,(627 + counter) 'want to end at 927 up
  NEXT 'finish at 600 back and 927 up

  'swing forward from 600 to 900 position
  FOR counter =1 TO (reps*2) STEP Speed 'move legs servo & update lift servo
    PULSOUT OutPinLiftServo,927 'hold 927 note that 777 is neutral on Hitec 765HB lift servo
    PULSOUT OutPinRedServo,(600 + counter) 'end at 900
    PULSOUT OutPinGreenServo,(600 + counter) 'end at 900
    PAUSE delay
  NEXT 'finish at 900 fwd and 927 up

  'move from 927 to 627 (down)
  FOR counter=1 TO (reps*2) 'move lift servo only
    PULSOUT OutPinLiftServo,(927 - counter) 'want to end at 627 down
  NEXT 'finish at 900 fwd and 627 down

NEXT 'end of full forward paces - ends 900 fwd and 627 down

'swing from 900 to 750 position
FOR counter =1 TO (reps) STEP Speed 'move legs servo & update lift servo
  PULSOUT OutPinLiftServo,627 'hold 627 note that 777 is neutral on Hitec 765HB lift servo
  PULSOUT OutPinRedServo,(900 - counter) 'end at 750
  PULSOUT OutPinGreenServo,(900 - counter) 'end at 750
  PAUSE delay
NEXT
PAUSE 1000 'allow time to settle to static position

'*********** end of go straight forward - finish at 750 mid and 627 static *********

'**************** start of go straight backward *****************************************

delay=10
'move from 627 to 927
FOR counter = 1 TO reps
  PULSOUT OutPinLiftServo,(777 + counter) '777 is horizontal position of crank arm, we want to end at 927
NEXT 'finish at 750 and 927 up

'swing from 750 to 600 position
FOR counter =1 TO (reps) STEP Speed 'move legs servo & update lift servo
  PULSOUT OutPinLiftServo,927 'hold 927 note that 777 is neutral on Hitec 765HB lift servo
  PULSOUT OutPinRedServo,(750 - counter) 'end at 600 position (back)
  PULSOUT OutPinGreenServo,(750 - counter) 'end at 600
  PAUSE delay
NEXT 'finish at 600 back and 927 up

'move from 927 to 627 (down)
FOR counter=1 TO (reps*2) 'move lift servo only
  PULSOUT OutPinLiftServo,927-counter 'want to end at 627 down
NEXT 'finish at 600 back and 627 down

FOR Paces = 1 TO LongSteps 'full swing walking forward for LongSteps paces

  'swing forward from 600 to 900 position (forward)
  FOR counter =1 TO (reps*2) STEP Speed 'move legs servo & update lift servo
    PULSOUT OutPinLiftServo,627 'hold 627 note that 777 is neutral on Hitec 765HB lift servo
    PULSOUT OutPinRedServo,(600 + counter) 'end at 900
    PULSOUT OutPinGreenServo,(600 + counter) 'end at 900
    PAUSE delay
  NEXT 'finish at 900 fwd and 627 down

  'move from 627 to 927 (up)
  FOR counter = 1 TO (reps*2)
    PULSOUT OutPinLiftServo,(627 + counter) 'we want to end at 927
  NEXT  'finish at 900 fwd and 927 up

  'swing back from 900 to 600 position
  FOR counter =1 TO (reps*2) STEP Speed 'move legs servo & update lift servo
    PULSOUT OutPinLiftServo,927 'hold 927 note that 777 is neutral on Hitec 765HB lift servo
    PULSOUT OutPinRedServo,(900 - counter) 'end at 600
    PULSOUT OutPinGreenServo,(900 - counter) 'end at 600
    PAUSE delay
  NEXT 'finish at 600 back and 927 up

  'move from 927 to 627 (down)
  FOR counter=1 TO (reps*2) 'move lift servo only
    PULSOUT OutPinLiftServo,927-counter 'want to end at 627 down
  NEXT 'finish at 600 back and 627 down

NEXT 'end of full forward paces with blk leg back at 600 and down at 627

'swing forward from 600 to 750 position
FOR counter =1 TO (reps) STEP Speed 'move legs servo & update lift servo
  PULSOUT OutPinLiftServo,627 'hold 627 note that 777 is neutral on Hitec 765HB lift servo
  PULSOUT OutPinRedServo,(600 + counter) 'end at 750
  PULSOUT OutPinGreenServo,(600 + counter) 'end at 750
  PAUSE delay
NEXT 'finish at 750 mid and 627 down

'************* end of go straight backward - finish at 750 and 627 static ************

'****************** start of forward turn right ********************

'move from 777 to 927 (up)
FOR counter = 1 TO reps
  PULSOUT OutPinLiftServo,(777 + counter) '777 is horizontal position of crank arm, we want to end at 927
  PAUSE delay
NEXT 'finish at 927

'note center left leg actually causes spider to turn to the right here
FOR counter =1 TO (reps) STEP 1 'move legs servo & update lift servo
  PULSOUT OutPinLiftServo,927 'hold 627 note that 777 is neutral on Hitec 765HB lift servo
  PULSOUT OutPinRedServo,(750 + counter) 'end at 900 position (forward) fwd
  PAUSE delay
NEXT 'finish at 900 fwd and 927 up - note that center left leg finishes at 600 back

FOR Paces = 1 TO 4 '4 Paces = 90 degrees

  'move from 927 to 627 (down)
  FOR counter=1 TO (reps*2) 'move lift servo only
  PULSOUT OutPinLiftServo,(927 - counter) 'want to end at 627 down
  NEXT 'finish at 900 fwd and 627 down

'swing back from 900 to 600 position - note green servo does NOT move during turn TO right
  FOR counter =1 TO (reps*2) STEP Speed 'move legs servo & update lift servo
    PULSOUT OutPinLiftServo,627 'hold 627 down- note that 777 is neutral on Hitec 765HB lift servo
    PULSOUT OutPinRedServo,(900 - counter) 'end at 600 back
    PAUSE delay
  NEXT 'finish at 600 back and 627 down  - note that center left leg finishes at 900 fwd

  'move from 627 to 927 (up)
  FOR counter=1 TO (reps*2) 'move lift servo only
    PULSOUT OutPinLiftServo,(627 + counter) 'want to end at 927 up
  NEXT 'finish at 600 back and 927 up

  'swing forward from 600 to 900 position (forward)
  FOR counter =1 TO (reps*2) STEP Speed 'move legs servo & update lift servo
    PULSOUT OutPinLiftServo,927 'hold 927 note that 777 is neutral on Hitec 765HB lift servo
    PULSOUT OutPinRedServo,(600 + counter) 'end at 900
    PAUSE delay
  NEXT 'finish at 900 fwd and 927 up

NEXT

' finish in mid swing and neutral lift - swing black leg back from 900 to 750 mid swing position
  FOR counter =1 TO (reps) STEP Speed 'move legs servo & update lift servo
    PULSOUT OutPinLiftServo,927 'hold 927 down- note that 777 is neutral on Hitec 765HB lift servo
    PULSOUT OutPinRedServo,(900 - counter) 'end at 750 mid position
    PAUSE delay
  NEXT 'finish at 750 and 927 up - note that center left leg finishes at 900 fwd
  PAUSE 1000 'allow lift servo to go to neutral position - finish at 750 mid and 777 neutral

'****************** end of forward turn right - finish at 750 mid and 777 static **************

'******************* start of forwardd turn left ********************************

'move lift servo to lock black leg down to 627 which locks right middle leg down also
FOR counter=1 TO (reps) 'move lift servo only
  PULSOUT OutPinLiftServo,(777 - counter) 'want to end at 627 down
NEXT 'finish at 750 back and 627 down

'swing black leg from 750 to 600 position which also moves right middle leg back causing spider to turn left
FOR counter =1 TO (reps) STEP Speed 'move legs servo & update lift servo
  PULSOUT OutPinLiftServo,627 'hold 927 note that 777 is neutral on Hitec 765HB lift servo
  PULSOUT OutPinGreenServo,(750 - counter) 'end at 600
  PAUSE delay
NEXT 'finish at 600 back and 627 down

FOR Paces = 1 TO 4 '4 Paces = 90 degrees

  'move from 627 to 927 (up)
  FOR counter=1 TO (reps*2) 'move lift servo only
  PULSOUT OutPinLiftServo,(627 + counter) 'want to end at 927 up
  NEXT 'finish at 600 back and 927 up

  'swing forward from 600 to 900 position (forward)
  FOR counter =1 TO (reps*2) STEP Speed 'move legs servo & update lift servo
    PULSOUT OutPinLiftServo,927 'hold 927 note that 777 is neutral on Hitec 765HB lift servo
    PULSOUT OutPinGreenServo,(600 + counter) 'end at 900
    PAUSE delay
  NEXT 'finish at 900 fwd and 927 up

  'move from 927 to 627 (down)
  FOR counter=1 TO (reps*2) 'move lift servo only
    PULSOUT OutPinLiftServo,(927 - counter) 'want to end at 627 down
  NEXT 'finish at 900 fwd and 627 down

  'swing back from 900 to 600 position - note green servo does not move during turn to right
  FOR counter =1 TO (reps*2) STEP Speed 'move legs servo & update lift servo
    PULSOUT OutPinLiftServo,627 'hold 627 down- note that 777 is neutral on Hitec 765HB lift servo
    PULSOUT OutPinGreenServo,(900 - counter) 'end at 600 back
    PAUSE delay
  NEXT 'finish at 600 back and 627 down

NEXT

'move from 627 to 927 (up)
FOR counter = 1 TO (reps*2)
  PULSOUT OutPinLiftServo,(627 + counter) 'we want to end at 927
NEXT  'finish at 600 back and 927 up

'swing from 600 to 750 position
FOR counter =1 TO (reps) STEP Speed 'move legs servo & update lift servo
  PULSOUT OutPinLiftServo,927 'hold 927 note that 777 is neutral on Hitec 765HB lift servo
  PULSOUT OutPinGreenServo,(600 + counter) 'end at 750
  PAUSE delay
NEXT 'finish at 750 mid and 627 down

PAUSE 1000 'allow lift servo to go to neutral position - finish at 750 mid and 777 neutral

' ********* end of forward turn left - finish at 750 mid and 777 static ***************

Step 6: Details and Photos

Here are some additional photos and details that you may find useful.
The first photo is a bottom view showing how the swing servos operate the swing arms and legs.
The second photo shows a detail of a typical swing arm and leg.  All swing arms and legs are identical.
The third  photo is a front view looking at the controller on the bottom and the rocker arms on the top.
The fourth photo is a slightly higher view showing how the rocker arms and shaft run.

Step 7: Complex But Simple

The first photo  is a top view showing total swing of the left legs and showing the right legs in their centered or static position. 
The second photo is another top view showing all legs in a typical walking position.
Some of these photos may vary because they were taken at different times in the development cycle.


In spite of looking very complex, it is actually very simple to build.  I hope that you enjoy building this hexapod crawler. 

If you have any questions, please email me at occamrazr@yahoo.com

Enjoy!

Robot Challenge

Finalist in the
Robot Challenge

Make It Real Challenge

Participated in the
Make It Real Challenge