Introduction: Lego Quadruped Robot

View the robot trailer video here or view the robots full video from my website in the robot section, source code also available in this section.
http://www.itsalmostgenius.com

Having completed a simple Arduino based car within weeks it was time for another Arduino project.

After having discussed ideas with Paul and Rodney the two nutters it was chosen to go for a very ambitious Arduino based walking robot, similar to hexapods found in youtube but with less servos while still maintaining full control. The key criteria for this project was a fully functional robot wirelessly controlled capable of proportional forward reverse speeds and steering.

In the initial stages Rodney, Paul and I discussed the code to operate a single servo 0-180, the various mechanical ideas behind making the leg walk were discussed over many weeks, and parts to use: 9G servos, lego technic for the chassis and legs.

The circuitboard shown is a DFRobot V5.0 expansion board which is plugged ontop of an Arduino Uno R3. In addition a 4x AA battery pack which was upgraded in later builds. Throughout the course of the prototype the battery pack and the circuitboard are held on by elastic bands. The servo and chassis have been fixed to each other by hot glue gun.

To date I have tested Tower Pro & Turnigy servos I find Turnigy servos to be quite durable and fairly priced.

Step 1: Variations on a Theme


Step 2: Components Required

We now move onto the required components I haven't totalled prices but  a rough estimate,, I believe this would set you back upwards of $180,,  however no higher than $300.

_________________________________________________________________________________________________
Tools you will need:
8mm Hot glue gun x1 + 10-20 glue sticks
Soldering iron x1 + solder
_________________________________________________________________________________________________
Lego Technic components (robot unit chassis + legs):
(Would highly recommend buying spares for all lego items if you are looking to improvise your own design).

Blocks:
Item no. SC702 x  (10 main chassis foundation blocks)

Thin strips:
Item no. SC8a x (4 central chassis support blocks)

Connectors:
Item no. SC804 x (6+6 front/rear chassis block connection) (5 +5 rear legs) (3+3 front legs) + Advised to get 10 spares.
Item no. SC802 x (7 central chassis connection) (1+1 front legs) + Advised to get 6 spares.
Item no. AD33 x (2+2 front legs) (4+4 rear legs)

Leg pieces:
Item no. LV01 x (1+1 front legs)
Item no. LV09 x (2+2 front legs) (3+3 rear legs)
Item no. LV14 x (2+2 front legs) (2+2 rear legs)
Item no. LV26 x (1+1 front legs) (2+2 rear legs)

_________________________________________________________________________________________________
Electronic components (robot unit stack):
Circuit board stack:
Xbee Series 1 x 1(Topmost item) This unit plugs into the v5.0 expansion board
DFRobot V5.0 expansion board  x 1 (Top item) To this unit all servos and power will attach
Arduino Uno R3 x 1(bottom item) + Advised to get 1 spare


Components required by above circuit boards:
Tower Pro  OR Turnigy TGY -50090M 9G servos  x (2+2 front legs) (2+2 rear legs) + advised to get 4-6 spares. (attached to v5.0 expansion board)
Turnigy 8A - 15A UBEC (6-12.6VDC to DC 5 OR 6V converter) x 1 + advised to get 1 spare. (Connects to battery, and feeds to Arduino Uno)
Lithium 800mah 7.4v 25c battery x 1 (connects to Turnigy 8A- 15A UBEC via an optional SPST switch)


_________________________________________________________________________________________________
Electronic components (Remote unit stack):

Spark fun Joystick Kit DEV-09760 x 1  (Top most Joystick Board 1/2 has buttons and joystick)
Xbee Series 1 x 1 (This connects to Joystick board 2/2)
Joystick Kit (Middle Joystick board 2/2 connects to the above Xbee, the below Arduino and through to Joystick Board 1/2 above)
Arduino Uno R3 x 1(bottom most board)
9V Battery x 1 OR (Go for rechargeables + a charger)
9V DC Battery snap x 1


Step 3: Program Your Arduino Boards

Please feel free to download the source files from my website in the robot section:
http://www.itsalmostgenius.com

Take one of the Arduinos and program it with the code contained in the 'Joystick'.

If you are new to the Arduino rather than reinvent the wheel here are two links which explain how to program your board:

Link 1
Link 2

The second Arduino can then be programmed with the code contained within 'Robot'.

Be sure to make a note of which Arduino contains which code, may be the easiest solution to keep going ahead and create the remote in instructable step 4.

Step 4: Program Your Xbees

It may be necessary to read up a little more on Xbees.

My Xbees were series 1, they were reportedly pre-programmed to communicate to each other out of the box however I programmed them anyway. From what I have seen on the web series 2 aren't pre-programmed.

To start with go to the Digi website here.
Download a suitable set of drivers under the dropdown section Drivers
Also download a suitable utility under the dropdown section Diagnostics, Utilities, MIBs

After having installed both, run the X-CTU program.
Then connect your Xbee to the PC via the Xbee programmer (refer to the picture to see the programmer board).

_________________________________________________________________________________________________
:>>>>>>>>>>>>>>>>>Transmitter<<<<<<<<<<<<<<<<<
>>Click Test query (retrieves basic info on current xbee)
eg

Modem type XB24
Modem Firmware: 10E6
Serial: 13A200406bEE3E This serial matches the below (Receiver) Destination high/low fields

GO to Modem config
Click read

Adjust Pan ID (subnet mask)
3332 >> 1111 (changed)

Adjust scan channels
1FFE >> 15

Baud: 9600

Set Destination address high
13A200

Set Destination address low
406BE224

***These two above correspond to the Serial number high/low fields of the receiver device refer to the Serial for the second device below.


SET CE =1
(COORINATOR/TRANSMITTER).

Hit write

_________________________________________________________________________________________________
:>>>>>>>>>>>>>>>>>Receiver<<<<<<<<<<<<<<<<<
>>Click Test query (retrieves basic info on current Xbee)
eg

Modem typ XB24
Modem Firmware: 10E6
Serial: 13A200406BE224 *** This serial matches the above (Trasmitter)  Destination high/low fields

GO to Modem config
Click read

Adjust Pan ID (subnet mask)
3332 >> 1111 (changed)

Adjust scan channels
1FFE >> 15

Baud: 9600

Set Destination address high
13A200

Set Destination address low
406bEE3E

These two above correspond to the Serial number high/low fields of the transmitter device.

SET CE =0
(End device/Receiver).
(COORINATOR/TRANSMITTER).

Hit write

Step 5: Build Your Remote

**Prior to beginning this please ensure you have programmed your Arduino boards as per step 2, and you are surely connecting the correct board to this spark fun kit.

*** Note, if programming the remote, you need to remove the entire Sparkfun Joystick shield kit prior programming the Arduino board or there will be errors.


Start with the Arduino picture 1

Stack on the Joystick shield Xbee board picture 2

Stack on the XBee picture 3

Stack on the Joystick shield button board picture 4

Attach your 9V battery to the arduino picture 5

- Complete

Step 6: Test for Wireless Serial Comms

With the remote fully built and programmed the next step I would recommend would be to test for serial comms.

Picture 1 shows the serial monitor function which is very handy for this.
Ideally your setup would be:
One Arduino remote fully built (step 4) if no 9V battery available connect it to your computer just for the power.
One Arduino Quadruped side circuit (Arduino + DFRobot V5.0 expansion board + Xbee) must be connected to the computer.

Ensure when running the Arduino compiler you have selected the correct 'Serial port' referring to the Arduino Quadruped board.
Then select serial monitor and observe serial monitor while you control with  the remote.
*** Ensure baud rate matches what you have set on your Xbees.


The C code file contained in Remote_12_4_13 works in the following manner:

If button2 == 0 (Where 0 = pressed/closed button)
It will perform the xloc function which will yield a number between 100 & 120.

if button2 == 1 (Where 1 = unpressed/open button)
It will perform the yloc function which will yield a number between 0-20.

Step 7: Build Your Chassis 1/2

This build is the most efficient one I have found through trial and error but I have no doubts there are engineers whom I envy who could do some calculations and improve it greatly. My background is only Technical college, so this entire design has not been engineered but judged by eye, and improvised on continuously.

First picture shows the end components we will need to glue together forming the Servo chassis. Note that on the right handside we have an odd Dark grey lego piece, we only need a single SC8a block here.

_________________________________________________________________________________________________
Step 1,  refer to picture two, build the center chassis block,


Use: 4 x SC702 blocks put together length wise.
Use: 7 x SC802 connectors to interlock the four pieces in the manner shown in the picture.
Use 4 x SC8a strips to fit support to the bottom of this 4 block unit.

(where Black lines represents a 3 width stretch of an SC802 connector).
(where red rectangles represents SC8a strips underneath)
_________________________________________________________________________________________________
Step 2, refer to picture three, build both the intermediate front and intermediate rear chassis blocks both are identical in composition.

Use: 2 x SC702 blocks put together length wise.
Use: 7 x SC804 connectors to interlock the two pieces in the manner shown in the picture.

(where Black lines represents a 2 width stretch of an SC804 connector).
_________________________________________________________________________________________________

Both the front and rear 'bumpers' are single SC702 blocks.
Now refer back to the first picture, very important to note the orientation of servos here, as you can see some face back to front.

Step 8: Build Your Chassis 2/2

We now move on to glueing your servo chassis together,,, from the previous step you should have 8 x 9g servos, a center chassis block, 2 x identical F/R intermediate blocks, and 2x bumpers F/R.

_________________________________________________________________________________________________
Refer to the first picture for the finished product,

*You will need to clip off the servo mounts off 4 of the servos using the side cutters.
*Pay close attention to the orientation of the servo drivers in relation to each other.
*Pay close attention to the offset of the first pack of 4 servos vs the second pack of 4 servos.

_________________________________________________________________________________________________
Refer to the second picture to see where the clippings have been done and a close up comparison of the servo offset, where the red line shows comparative offset and green marking shows the missing servo mounts on one servo.

Step 9: Qudruped Front Leg Pair

Front leg composition as per the pictures.

Per leg:

Leg pieces
Item no. LV01 x 1
Item no. LV09 x 2
Item no. LV14 x 2
Item no. LV26 x 1

Connectors:
Item no. SC804 x 3
Item no. SC802 x 1
Item no. AD33 x 2  (the beige coloured connector can be replaced with a blue one).

_________________________________________________________________________________________________
Use the glue gun to mount the green rubber seen at the end of the claw. In this picture though it isn't so well seen a regular rubber
band has been cut into several equal length strips and these strips have been glues.

**Handy tips for mounting the strips:
-At either end of a given strip, ensure that there not only remains glue between the plastic leg and the underneath surface of the stip. Also add glue which will be ontop of the strip and running onto the plastic. The idea is that your strip is covered in glue so it is held in place from all over.
_________________________________________________________________________________________________
Use the glue gun to mount the servo horns on the right and the left.

**Handy tips for mounting the servo horns:
-Ensure the correct orientation of the servo horn.

-Ensure that the servo horn screw hole is aligned to the center of the hole in the leg piece it is glued to.

-When glueing, apply sparingly around the servo horn screw hole. If excessive glue is used here it will likely plug up the area where the screw would be.

-The objective is when looking at the leg piece and the servo, they are 90 degrees to each other:
The servo horn looks like this <=O, the O (screw hole) has sparingly applied glue as above. However apply excessive glue throughout the length of the horn <= the idea here is the glue must actually raise the horn part such that the servo horn runs adjacent, and is inline with the leg piece.
^^^^The above paragraph is best explained by referring to picture 3.

-Add excessive glue over the horn, and onto the outside of the leg piece this enhances strength and durability.

Step 10: Quadruped Rear Leg Pair

Rear leg composition as per the pictures.

Per leg:

Leg pieces:
Item no. LV26 x2
Item no. LV14 x2
Item no. LV09 x3

Connectors:
Item no. AD33 x 4 (the beige coloured connector can be replaced with a blue one).
Item no. SC804 x 5

As per previous instructions the same applies, mount the rubber and the servo horns.
_________________________________________________________________________________________________
Use the glue gun to mount the green rubber seen at the end of the claw. In this picture though it isn't so well seen a regular rubber
band has been cut into several equal length strips and these strips have been glues.

**Handy tips for mounting the strips:
-At either end of a given strip, ensure that the not only remain between the plastic leg and the underneath surface of the stip. Also add glue which will be ontop of the strip and running onto the plastic. The idea is that at either end of the strip you will have glue which is holding on the strip also from the outer edge.
_________________________________________________________________________________________________
Use the glue gun to mount the green rubber seen at the end of the claw. In this picture though it isn't so well seen a regular rubber
band has been cut into several equal length strips and these strips have been glues.

**Handy tips for mounting the strips:
-At either end of a given strip, ensure that there not only remains glue between the plastic leg and the underneath surface of the stip. Also add glue which will be ontop of the strip and running onto the plastic. The idea is that your strip is covered in glue so it is held in place from all over.
_________________________________________________________________________________________________
Use the glue gun to mount the servo horns on the right and the left.

**Handy tips for mounting the servo horns:
-Ensure the correct orientation of the servo horn.

-Ensure that the servo horn screw hole is aligned to the center of the hole in the leg piece it is glued to.

-When glueing, apply sparingly around the servo horn screw hole. If excessive glue is used here it will likely plug up the area where the screw would be.

-The objective is when looking at the leg piece and the servo, they are 90 degrees to each other:
The servo horn looks like this <=O, the O (screw hole) has sparingly applied glue as above. However apply excessive glue throughout the length of the horn <= the idea here is the glue must actually raise the horn part such that the servo horn runs adjacent, and is inline with the leg piece.
^^^^The above paragraph is best explained by referring to picture 3.

-Add excessive glue over the horn, and onto the outside of the leg piece this enhances strength and durability.

Step 11: Quadruped Circuitry

Let's just start with a thank god for the Arduino, wiring is relatively simple thanks to the stacking system and modern electronics.

*********************ENSURE your UBEC is set to 5V before powering on the circuits*********************

***Note, if programming the Quadruped arduino, ensure that you remove the Xbee from the DFRobot V5.0 expansion board. (servo connections and power are usually okay to remain connected).

**Prior to beginning this please ensure you have programmed your Arduino boards as per step 2, and you surely are working with the Quadruped programmed Arduino board.

Picture 1, starting with the battery and power circuit follow the directions in the first picture.

Picture 2, Start with the Arduino

Picture 3, disregarding the other connections, fit your DFRobot v5.0 expansion board to the Arduino

Picture 4, disregarding the other connections, fit your Xbee to the DFRobot 5.0 expansion board.

Picture 5, fit your power connections from the UBEC to the DFRobot v5.0 expansion board.

Picture 6, your circuitry can be mounted using an elastic band.

*********************ENSURE your UBEC is set to 5V before powering on the circuits*********************

Step 12: Wiring Your Servos

>>>>>>>>>>>> A big congratulations for coming this far,,, you're very close to completion.<<<<<<<<<<<<

Picture 1 shows servo wiring.

Servo LEGEND
  F=Front
  L=Left
  R=Rear OR Right
  M=Main pivot for claw
  S=Secondary, assisting servo action
 
           Forward
             ^^^^
     -|FLS      C     FRS|-
___| |        H         | |___
'    -|FLM     A      FRM|-    '
      |        S         |
      |        S         |
     -|RLM     I      RRM|-
___| |        S         | |___
'    -|RLS            RRS|-    '
             \/\/\/\/
            Reverse

Step 13: Assemble Your Quadruped Robot

Now you have a wired servo chassis and legs.

You'll need to power on the Robot for at around 5 seconds so that all servos are directed to their default positions (you can then power off the robot) the friction in the gearboxes should be enough for the servos to hold their positions while you fit the legs, however. If you find a servo has lost it's position simply turn the robot on again for a period of 5 seconds again maybe even leave it on.

*You may need to clean out the holes within your leg pieces where the servo horn screws go if there is glue obstructing the screws path.

Referring to picture 1 & 2 note the rear legs go onto the servos which stick further out of the chassis.

Picture 3 shows how the rear right leg should be fitted,
Picture 4 the right front.
Picture 5 the rear left
picture 6 the front left.

Step 14: Good Luck!

At this point if you have jumped all the hurdles your robot should be doing some kind of walk. Perhaps the lego team need to give it a tune..

You will find there is a fair bit of tinkering to do, fine tuning to make it walk the way you like.

To power on the Remote I'm assuming most people will be using the 9V battery which can simply be plugged in.

To power on the robot, ensure you have your battery connected.
Both the optional SPST switch is turned on (to power the UBEC)
and that the UBECS additional switch is powered on to pass power to the DFRobot V5.0 expansion board.

_________________________________________________________________________________________________
If running the recommended UBEC you should find LEDs turn on to indicate it has power.
2 Red and 2 green (this is normal) for a fully charged battery (assuming you're running the recommended 2 cell battery).
During operation one of two green LED may flicker which is normal due to voltage fluctuation.
When getting to low battery there will be one remaining green LED and this will flicker when operating the robot.
_________________________________________________________________________________________________

Controls

Hold the control horizontally and you then have your joystick on your left.

X & Y axis:
Y axis is read by default,, you have proportional control over the robots speed, forward and reverse
Due to program design the robots ability to change speed/direction isn't as timely as other R/C devices. It takes a little more time.

If you would like to steer, press and hold down the bottommost button (You must already have the robot moving for this to work) this will set steering mode:
While holding the button and only while holding the button, the remote is  reading the X axis and you can steer. The robot will continue to operate in the last known direction and speed.

_________________________________________________________________________________________________



Please feel free to download the source files from my website in the robot section:
http://www.itsalmostgenius.com