loading

Meet Stompy, the Arduino quadruped robot.

Most of the quadrupeds I’ve seen use “insect” type legs, but I wanted to try one with “mammal” type legs. The result was Stompy, a quadruped using eight servos, with each leg consisting of a hip joint and an ankle joint (no knee). Stompy uses a “trot” type gait where the front right leg is synchronized with the back left leg and these two limbs move in antiphase with the other two limbs. The result is a stomping type of walk, but it gets the job done. Controlling all the servos requires eight PWM pins and standard Arduinos only have six, so I decided to use an Arduino Mega. Stompy uses an IR distance sensor to keep from bumping into things and is capable of autonomous movement.

Step 1: List of Materials

Step 2: Robot Construction

Leg assembly is illustrated in the photos above. For the robot to move properly, the servos need to be centered. Information on how to center the servos that I used is available here. The side bracket mounting kits I used came with two plastic plates. The larger of these worked perfectly as a foot for the robot. I placed four small adhesive rubber tabs in each corner of the plate to improve traction. These rubber tabs also provided clearance for the nuts and bolts that hold the foot in place. The four legs are then attached symmetrically to the large plastic platform that forms the body of the robot. The servo cables are passed through holes in the plastic platform and attached to the Arduino. The Arduino itself is also bolted to the plastic platform. An IR distance sensor attached to a micro servo forms the head of the robot. This allows Stompy to roam free range.

Step 3: Forward Movement

In the Arduino code given below, the movement of the limbs is controlled by the variable flex1, which sets the angle at which a limb is bent. I have it set to 45, but it can be increased or decreased to lengthen or shorten the stride. In the setup section of the code I initially position Stompy with the front left and back right legs set forward and the front right and back left legs set rearward. Writing a value between 0 and 90 to the hip servos corresponds to a forward position and a value between 90 and 180 corresponds to a rearward position. Since the ankle servos are aligned 180 degrees opposite to the hip servos, writing the same value to both the hip and ankle servos will result in the foot being parallel to the floor. The setup section ends with a 5 second pause to allow time to position the robot.

The loop section of the code contains the walking algorithm. First, I straighten the front left and back right legs. The variable smoothnessDelay controls the speed and smoothness of this motion. With the front left and back right legs now straight, the front right and back left legs are off the ground in the rearward position. I bring these legs forward in three steps. First, I flex the ankles all the way forward to get them as far off the ground as possible. Next I swing the hips forward, during which time Stompy's heels will skip the ground. Last, I level the ankles so that they are ready to hit the ground. Now, the front left and back right legs are moved to the rearward position. After this motion, Stompy is half way through one complete walking cycle. I now repeat the process with commands to diagonal pairs of legs switched.

Step 4: Left Turn, Right Turn, Reverse

Stompy is somewhat less graceful when turning. Basically, to make Stompy turn, I make the stride on one side of his body shorter than the other. For example, to turn left I make the stride on the left side of the body one third as long as the stride on the right side of the body. The variable multiplier in the code controls this. It is a little awkward looking, but it gets Stompy from point A to point B. A right turn is accomplished in a similar manner. Reverse is a straightforward modification of the forward walking algorithm. The code for all three is contained in the attached files.

Step 5: Autonomous Movement

The four gait files given in the previous two steps, along with some distance sensor code, can be combined into one file to allow for autonomous obstacle avoiding movement. I use an IR distance sensor to measure the distance to obstacles in front of Stompy. If the distance is below a set tolerance, Stompy stops, looks to the left and right to take two more distance measurements, and then continues in the direction of the clearer path. Since Stompy cannot turn on a dime, the change in direction is accomplished by first backing up 3 steps and then turning in the clear direction for 5 steps. Stompy then continues forward in a straight line until encountering another obstacle. The number of steps in the change of direction sequence are controlled by the variables reverseTime and turnTime. I use a laser to indicate the direction in which Stompy is looking.

Could you use an arduino uno instead of the mega
<p>I'm not sure. The 8 servos for the legs need to be controlled by PWM pins on the Arduino, but there are only 6 PWM pins on an Uno (pins 3, 5, 6, 9, 10 and 11). I think there might be ways to extend PWM capability to other pins on an Uno, but unfortunately I don't know how to do it.</p>
<p>you do not need PWM for servo control</p>
<p>This is SO AWESOME. We love Stompy! :D</p>
<p>Thanks!</p>
<p>can u show the wiring diagram ,btween the adruino mega and servos and everything else </p>
<p>The image below shows how the servos are connected. I didn't have room for them all, so I just put in two representative ones. Just make sure to use different power supplies for the arduino and the servos since the Arduino pins cannot supply enough current to run the servos. The two power supplies do need to share the same ground connection.</p>
<p>woaahh thats an incredable work u did there bro ,... i want to makeone tooo ..</p>
<p>Thanks! Glad you liked it!</p>
<p>i am noobie and i have a doubt ..i see that u have separate program codes for forward left turn right turn reverse etc .. cant it all made one ?? .</p>
<p>Yes! The file containing all of them is given in Step 5. That file also contains code to process information from a IR distance sensor. When Stompy gets too close to a wall he stops, looks to the left and right to take distance measurements, and then continues in the direction of the clearer path.</p>
can you share a video ?
<p>There are more videos in Steps 4 and 5 of the instructable.</p>
<p>Thanks for the board concept </p>
<p>Glad you liked it!</p>
<p>Can it turn?</p>
<p>It's a little clumsy, but it can turn. There is a video of it turning in step 4.</p>

About This Instructable

6,974views

116favorites

License:

More by joesinstructables:Snake Robot Arduino Quadruped Robot Arduino Laser Pinball 
Add instructable to: