Intro: Arduino Quadruped Robot
Latest Hexapod: https://www.instructables.com/id/Arduino-Mega-Hexa...
This is my first robot that relies on calculations to position the servos vs. relying on pre-programmed sequences. I chose a quadruped to help keep the cost down.
Build Time 8 weeks
Weight 2 Pounds 14 Oz.
Dimensions 8 inches, 8 inches, 7 inches (L:W:H)
Run Time 15-30 minutes
Programing Language Arduino IDE
Control Method Blue-tooth Remote
1x 7.4V 1650Mah 2S LipPo
I am powering everything using a 2S LIPO & Turnigy 15A UBEC (Ultimate battery elimination circuit). I love the UBEC and will definitely be the regulator of choice for future robot projects.
The body's roll, pitch & yaw are calculated using a rotation matrix. That in turn feeds into the Inverse Kinematics equations that position the legs. I am using a ripple gait for walking although I am still fine tuning that portion of the code. A few modes exists, 1: Body Translation/Body Position 2:Walking Mode 3:Accelerometer Mode. The first two modes are pretty self explanatory; accelerometer mode takes the x-axis & y-axis from the accelerometer, maps the values to (-20, 20), then use those values as the body's pitch & roll respectively. This allows the robot to stay level on uneven surfaces.
It has been some time since I have been enrolled in a math class. I also don't believe in re-inviting the wheel; I used the rotation matrix & inverse kinematics from NUKE (Nearly Universal Kinematic Engine). I am not using the micro-controller is was designed for so I could not use their python tools to generate the code I borrowed from. Instead they had an already completed sketch for a quad which is what I modeled my program after. A big thanks to the people that put that tool together, it was true to its name! Also big thanks to "tom_chang79" his discussion, "Let's Discuss Kinematics, Shall We?" was very helpful. Thanks, & thanks for your email responses!
I have built a blue-tooth remote control which has worked great so far. As I continue to progress I intend to build more functionality into my remote and robot. I found some 3-funtion joysticks at servo city that will replace the parallax joysticks I have now.
Here is the link to the ideal joysticks from servocity:
Controller/CPU: Arduino MegaMini 2560, Lynxmotion SSC-32
The Arduino Mega handles all of the computation along with taking input from the accelerometer & blue-tooth. Once all the calculations are complete it sends the appropriate commands to the SSC-32 servo sequencer. I love the SSC-32 it is super great!
Triple Axis Accelerometer (ADXL335)
When I started off I thought that I would need a 3-axis gyroscope in addition to the accelerometer. My thought was that I would need to mesh the data together using a Kalman filter. I have worked with IMU's (Inertial measurement unit) in the past and needed to use directional cosine matrix's to mesh the accelerometer, gyroscope and compass readings together. This creates very stable orientation data and outputs a single yaw, pitch & roll that doesn't drift. In the end I was able to get the data I needed from just the accelerometer. This is good thing, I would most likely need another MCU to process all that data.
I am using HS-422 servo's; I have been very impressed with all the HITEC Servos. At some point I will replace the HS-422 servos with HS-465MG servos which have more torque and metal gears instead of composite.
Step 1: Acquire Parts
Robot Body (Qty. 1) Price: $19.95
Aluminum Femur Pair (Qty. 2) Price: $16.95 (each)
Tibia Pair (Legs )(Qty. 2) Price: $19.95 (each)
Arduino Mega Platform(Qty. 1) Price: $8.99
HS-422 Servos (Qty. 12) Price: $9.99 (each)
Lynxmotion SSC-32 Servo Controller: (Qty. 1) Price: 39.95
MegaMini 2560 (Qty. 1) Price: $42.00
Triple Axis Accelerometer ADXL245: (Qty. 1) Price: $27.95
Parallax Xbee Wireless Pack(Qty. 1) Price: $79.99
Battery & Regulator For Robot:
1300mAh 2S 7.4V 20C Li-Po, 13 AWG EC2 (Qty. 1) Price:18.99
TURNIGY 8-15A UBEC for Lipoly (Qty. 1) Price: 15.40
Remote Control Part List:
Black Plastic Project Box (Qty. 1)
Circuit Board (Qty. 1) Price: $4.49
Arduino Nano (Qty. 1) Price: $34.95
Parallax LCD (Qty. 1) Price: $29.99
Joysticks (Qty. 2) Price: $3.99
5 Cell 6V 1600mAh NiMH Battery(Qty. 1) Price:17.49
Total Cost For Robot : ~$540
Phillips Head Screw Driver
Hex Screw Drivers
Small Philips & Flat Head Screwdrivers
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:
Serial.println("#0P1500T100 #1P1500T100 #2P1500T100");
I used one of my batteries to power everything; The same thing is done when attaching the legs to the body to assure that everything is centered correctly. If you don't get it exactly right don't panic because you can always re-adjust things later if needed.
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 move to step 5 and attach the legs to the body.
Step 5: Attaching Legs to Body
Note: Sorry for the bad picture quality.
When connecting the legs to the body I would suggest a friend hold the body while you attach the leg. All of the servos are being centered while I attached the legs to the body. If you are confused as to how I am centering the servos please refer to step 3.
You will want to attach each of the coxa (hip) servos at a 45 degree angle to the body.
Step 6: Preparing Arduino Mini
At his point you will want to go ahead and solder some pin headers onto the Arduino Mini 2560 as seen in the picture above. This makes it easier to disconnect things later if needed.
The pins that needs headers are listed below
VIN, GND (The Arduino gets power from the 5V, GND on the ssc-32 which is also used to power the servos)
18 (Connects to SSC-32 RX Pin)
GND (Accelerometer Gnd)
3.3V (Accelerometer Power)
5V, GND (Xbee Power)
17 (Connects to Dout from Xbee)
GND (Connects to GND on SSC-32)
A0, A1, A2 (Accelerometer X, Y, Z respectfully)
Step 7: Preparing SSC-32
There is very little that you will need to do concerning the SSC-32. Firstly you will want to make sure the corrected baud rate is selected on the SSC-32. There are 6 sets of pins in the middle of the board; they are labled "BAUD" & "ABCD". You will want to make sure that there are jumpers on both of the BAUD Pins and no jumpers on A,B,C,D.
You will also want to remove the jumpers on the RX, TX Pins down below the Serial Connector. This is because will will attach a wire to the GND & RX pins that will run to the Arduino. This is how the SSC-32 gets it's commands from the Arduino.
Step 8: Install Electronics Onto Body
The arduino mega is installed on a plate that sits above the SSC-32 pictured above. I mounted the SSC-32 upside down to make the wiring cleaner, it really helped to do it this way. The xbee radio is also attached above the servo sequencer; I used jumper wires to make the necessary connections between the boards. This way it is easier to change things later on without having all the connections be permanent.
The layout of things is not set in stone you can deviate from what I have done. If you have a different look in mind you can change the layout just keep in mind that you will need space for your battery. In my case the battery and UBEC are installed inside of the body. That is also why I installed most of my electronics on top; so I could easily access the battery.
I suggest removing the battery while charging; if something went wrong things could melt or worse. I used Velcro tape to secure my battery to the robot.
Step 9: Assemble Remote Control
This is how I decided to layout my remote you can change it if you want it to look different. At some point I will change the joysticks used on this remote with ones with potentiometers at the top. The plan would be to used the extra potentiometer to adjust the height of the robot. I will have to create a schematic for the remote; although for the most part it is pretty basic.
I got a plastic enclosure box from Frys electronics here in Austin to install the electronics in. To make everything stay in place I have installed a sock behind the board that keeps everything in place. There is a USB cord that connects to the li-po charger and fits through an opening in the back of the plastic box.
Step 10: Upload Source Code
The code for the robot & remote are available through github at the following URL: