Introduction: Arduino Mega Hexapod


Second Video (pretty much the same thing, except faster hand movements):

https://www.youtube.com/watch?v=zepHB4h5JS4&featu...

This is my Hexapod, it's based around Lynxmotion's Phoenix hexapod and is running a modified version of KurtE's phoenix's code base.

Generic Pheonix Build Instructions:

http://www.lynxmotion.com/images/html/build131.htm

KurtE's Github Page:

https://github.com/KurtE

The robot is controlled using a wireless PS2 controller, the base code allows for the robot to walk in any direction, individual leg selection, & body shifting. There were a couple changes that I needed to make in order to work with my configuration. In addition to those changes, I wanted the robot to be able to track different objects, but wanted to be able to turn tracking on and off, so I re-purposed the "Triangle" button to enable tracking mode.

Power is supplied to the robot with two LiPo batteries and two UBEC's (Ultimate Battery Eliminator Circuit). One LiPo and UBEC power the Arduino Mega, PS2 Receiver, Pixy Camera, and Pixy MCU.

Initially I used 18 HS-422 Servos on this robot, and while that does work, the HS-645MG servos at 3X the cost are much stronger. For the robot in the video I used 12 HS-422's and 6 HS-645MG's. I used the 12 HS-422's for the Coxas (Hips) and Feet. I am using the HS-645MG's for the Tibia's because they seem to take a lot of the weight of the robot.

The second LiPo & UBEC power the SSC-32 & Servo's. Each UBEC can handle 8A and bursts up to 15A which is plenty of juice to run this robot. The servo's create a lot of electrical noise and this is why there are separate power supplies, the noise from the servos interferes with the radio receiver on the PS2 remote.

The Pixy Camera is mounted to the front of the robot, and is an optional attachment, that allows the robot to track objects, the camera can be trained to follow different objects/colors with the press of a button on the camera itself.

In case anyone is interested in the camera module, here is the URL:

http://charmedlabs.com/default/pixy-cmucam5/

Step 1: Parts

Mechanical Parts:

Lynxmotion Phoenix Chassis Kit - Price $39.95

http://www.robotshop.com/en/lynxmotion-phoenix-ch...

Aluminum Femur Pair (Qty. 3) - Price: $16.95 (each)
http://www.robotshop.com/lynxmotion-3-aluminum-fe...

Tibia Pair (Legs )(Qty. 3) Price: $19.95 (each)

http://www.robotshop.com/lynxmotion-robot-leg-rl-...

PS2 Receiver & Battery Platform(Qty. 1) Price: $8.99

http://www.robotshop.com/lynxmotion-robot-leg-rl-...

Lynxmotion Phillips Head Tapping Screws - 1/4" x #2 (100) (Qty. 1) Price: 11.95

http://www.robotshop.com/en/lynxmotion-phillips-ta...


Electronics:

Arduino MEGA 2560 (Qty. 1) - Price: 36.99

http://www.robotshop.com/en/arduino-mega-2560-micr...

HS-422 Servos (Qty. 12) - Price: $9.99 (each)

http://www.robotshop.com/productinfo.aspx?pc=RB-Hi...

HS-645MG Servos (Qty. 6) - Price $28.89 (each)

http://www.robotshop.com/en/hitec-hs645mg-servo-mo...

Lynxmotion SSC-32 Servo Controller: (Qty. 1) - Price: 39.95

http://www.robotshop.com/productinfo.aspx?pc=RB-Hi...

Lynxmotion PS2 Controller V4 (Qty. 1) - Price: 23.85

http://www.robotshop.com/en/lynxmotion-ps2-control...

Pixy CMUcam5 Image Sensor (Qty. 1) - Price: $69.00

http://www.robotshop.com/en/pixy-cmucam5-image-sen...

Arduino Nano (Qty. 1) - Price: $34.99

http://www.robotshop.com/en/arduino-nan-v-3.html

Servo Extension Cable 150mm (Qty. 6) - Price: $0.60

http://www.robotshop.com/en/servo-extension-cable-...


Battery & Regulator For Robot:

1300mAh 2S 7.4V 20C Li-Po, 13 AWG EC2 (Qty. 1) - Price:18.99

http://www.hobbytown.com/Shop/1300mAh-2S-7-4V-20C...

1350mAh 3S 11.1V 30C LiPo (Qty. 1) - Price: 30.99

https://www.hobbytown.com/Shop/EFLB13503S30-E-Flit...

TURNIGY 8-15A UBEC for Lipoly (Qty. 2) - Price: 15.40

http://www.hobbytown.com/Shop/1300mAh-2S-7-4V-20C...

Approximate total without shipping: $750.00


Tools Required:
Phillips Head Screw Driver

Soldering Iron

Solder

Hex Screw Drivers

Small Philips & Flat Head Screwdrivers

Pliers

Zip Ties

3M Double sided foam tape

Double sided Velcro tape

Step 2: Build Front Left Leg

Note: Pay close attention to the orientation of each part; the left
& right legs will look a little different. All of the screws and plastic servo retainers come with the parts and for the most part is pretty self explanatory. When building the legs I connected all of the servos for one leg into ports 0, 1, 2 on the SSC-32. Afterward I uploaded the following sketch to the arduino to center all of the motors on those ports:

void setup()

{

Serial.begin(115200);

}

void loop()

{

Serial.println("#0P1500T100 #1P1500T100 #2P1500T100");

delay(500);

}

I used one of my batteries to power everything along with one UBEC set for 6V.

Step 3: Build Right Front Leg

Note: Pay close attention to the orientation of each part
The build process for the right leg is the same as the left leg; the only difference being the orientation of the parts.

Step 4: Completed Legs

This is how the front two legs should look when finished; this is also how the rear legs will also look when finished.

You will want to go ahead and build the rear legs which will also look exactly like the front two legs. Once that is complete you can begin to attach the legs to the body.

Step 5: Attach Legs to Body

At this point you will want to go ahead and attach the completed legs to the body of the robot. Fine tuning of the legs positions can be addressed after you have everything wired up.

I would suggest not attaching the SSC-32 or Arduino Mega to the frame until you have temporarily wired things up to make sure all your connections are good, refer to steps 6, 7 for wiring.

Afterward verifying your wiring you can attach the SSC-32 & MEGA to the frame.

Step 6: Arduino Mega Wiring

PS2 Receiver Connections:

PS2 | MEGA

DAT - PIN 5

CMD - PIN 6

ATT - PIN 7

CLK - PIN 8

5V - 5V

GND - GND

SSC-32 Servo Sequencer:

SSC32 | MEGA

RX - PIN 19

TX - PIN 18

GND - GND

Beeper:

+ (Pos) Beeper - Pin 22

- (Neg) Beeper - GND

Pixy Camera Arduino Nano Serial Interface: (*Only if you want object tracking*)

NANO | MEGA

TX - PIN 15

VIN - 5V

GND - GND

Arduino Mega Power Connection:

VIN - UBEC POSITIVE WIRE

GND - UBEC NEGATIVE WIRE

Step 7: SSC-32 Wiring

You should match your jumpers to the picture above, the only exception to that is area 14.

Go ahead and remove the two jumpers from area 14. Next connect TX to Pin 18 of the Mega, then connect RX to Pin 19. Afterwards connect GND to GND on the Mega.

Connect each Leg's Servos to the SSC-32 using this list:


#define cRRCoxaPin 0 //Rear Right leg Hip Horizontal

#define cRRFemurPin 1 //Rear Right leg Hip Vertical

#define cRRTibiaPin 2 //Rear Right leg Knee

#define cRMCoxaPin 4 //Middle Right leg Hip Horizontal

#define cRMFemurPin 5 //Middle Right leg Hip Vertical

#define cRMTibiaPin 6 //Middle Right leg Knee

#define cRFCoxaPin 8 //Front Right leg Hip Horizontal

#define cRFFemurPin 9 //Front Right leg Hip Vertical

#define cRFTibiaPin 10 //Front Right leg Knee

#define cLRCoxaPin 16 //Rear Left leg Hip Horizontal

#define cLRFemurPin 17 //Rear Left leg Hip Vertical

#define cLRTibiaPin 18 //Rear Left leg Knee

#define cLMCoxaPin 20 //Middle Left leg Hip Horizontal

#define cLMFemurPin 21 //Middle Left leg Hip Vertical

#define cLMTibiaPin 22 //Middle Left leg Knee

#define cLFCoxaPin 24 //Front Left leg Hip Horizontal

#define cLFFemurPin 25 //Front Left leg Hip Vertical

#define cLFTibiaPin 26 //Front Left leg Knee

Step 8: Arduino Nano / Pixy Camera Wiring (Optional)

In the case you want to track objects you will need to attach an Arduino Nano and Pixy Camera to the robot. The robot will work without these and there is code in my repository that omits the tracking.

Step 9: Code

All the code for the robot is available at:

https://github.com/davidhend/Hexapod

Please read "readme" on GitHub, it will explain what code is what.