Build your own (needlessly tech) servomotor-driven 4-leg walker robot!
First, a warning: This bot is basically a microcontroller-brain version of the classic BEAM 4-legged walker. The BEAM 4-legger may be easier for you to make if you aren't already set up for microcontroller programming and just want to build a walker.
On the other hand, if you're getting started with microprocessor programming and have a couple servos kicking around, this here's your ideal project! You get to play with walker mechanics without having to worry about the fussy analog BEAM microcore tweaking.
So although this isn't really a BEAM bot, the following two webpages are great resources for any 4-legged walker:
Bram van Zoelen's 4-legged walker tutorial has a good overview of the mechanics and theory.
I took my leg design off his website.
Chiu-Yuan Fang's walker site is also pretty good for BEAM stuff and some more-advanced walker designs.
Done reading? Ready to get building?
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Gather Parts, Measure, Plan a Bit
Making a 4-legged servowalker is pretty simple, parts-wise. Basically, you need two motors, legs, a battery, something to make the motors go back and forth, and a frame to hold them all.
2x Tower Hobbies TS-53 Servos
20in heavy copper wire: 12in for front legs, 8in for rear. I had 10-gauge. 12-gauge should work, but I'm guessing.
Battery is a 3.6v NiMH that was selling for cheap online.
The microcontroller brain is an AVR ATMega 8.
The frame is Sintra, which is hella cool. It's a plastic foamboard that bends when you heat it up in boiling water. You can cut it, drill it, matte-knife it, and then bend it to shape. I got mine at Solarbotics.
Drilled project board for the circuit
Snap-off headers (male and female) for the servo and battery connections
A 28-pin socket for the ATMega
Soldering iron and solder, wire
Some tiny bolts to hold the motors on
Here, you see me measuring out the parts, making a sketch for the frame, and then grabbing a ruler to make a paper template. I used the template as a guide to mark with a pen where I'd drill holes in the Sintra.
Step 2: Build Frame, Fit Motors
First I drilled holes on the corners of the two motor cutouts, then scored along the edge of a ruler from hole to hole with a matte knife. It takes like 20 passes with the knife to get through the Sintra. I got lazy and snapped it after cutting about 1/2 way through.
After cutting out the holes, I test-fit the motors just to see how it worked. (A little too wide, but I got the length just right.)
Step 3: Bend Frame, Attach Motors.
Unfortunately, I didn't have enough hands to photograph myself bending the Sintra, but here's how it went down:
1) Boiled small pot of water on stove
2) Held Sintra underwater for a minute or two with a wooden spoon (Sintra floats)
3) Pulled it out, and with hot mitts and something flat, held it bent at the right angle until it cooled.
For the classic "Miller" walker design, you want about a 30-degree angle on the front legs.
Drilled screw-holes and bolted the motors on.
Step 4: Attach Legs to Star-shaped Servo Motor Horns
I cut a 12" and 8" section of thick copper wire with tinsnips to make the front and back legs, respectively. Then I bent them at an angle to attach to the servo horns.
A classic BEAM trick when you need to attach things is to tie them with hookup wire wire. In this case, I stripped some hookup wire, ran it through the horns and around the legs, and twisted it up a lot. Some people solder the wire solid at this point. Mine's still holding tight without. Feel free to trim off the excess and bend the twisted parts down.
Step 5: Attach Legs to Body, Bend Them Just Right
Screw the servo stars (with the legs on) back on to the motors, then get bending.
Symmetry is key here. A tip to keep the sides even is to bend in only one direction at a time, so that it's easier to eyeball it if you're doing too much on one side or the other.
That said, I've bent and re-bent mine many times now, and you can re-start from straight again if you get too far off track later on after tweaking it once too many times. Copper's great that way.
Have a look at the webpages I listed for further tips here, or just wing it. I don't think it's really all that critical, at least in terms of getting it walking. You'll be tuning it later.
The only critical bit is to get the center of gravity enough in the middle so that it walks right. Ideally, when one front leg is in the air, the back legs turning will tip the bot forward onto the high/forward front leg, which will then do the walking. You'll see what I mean in a video or two coming up.
Step 6: Brains!
The brainboard is pretty darn simple, so you're gonna have to pardon my sketchy circuit diagram.
Beacuse it uses servos, there's no need for complicated motor drivers or what-have-you. Simply hook up +3.6 volts and ground (straight from the battery) to run the motors, and hit them with a pulse-width modulated signal from the microcontroller to tell them where to go.
(See the wikipedia servo page if you're new to using servomotors.)
I cut up a piece of drilled blank pcb stuff, and super-glued headers onto it. Two 3-pin headers for the servos, one 2-pin header for the battery, one 5-pin header for my AVR programmer (which I should make an instructable for someday), and the 28-pin socket for the ATMega 8 chip.
Once all the sockets and headers were glued on, I soldered them up. Most of the wiring is on the underside of the board. It's really just a few wires.
Step 7: Program the Chip
Programming can be done with as sophisticated a setup as you've got. Myself, that's just the (pictured) ghetto-programmer -- just some wires soldered to a parallel port plug.
This instructable details the programmer and software you need to get it all running.
Do Not! Do Not! Do not use this programming cable with any devices that even get near to voltages above 5v. The voltage could run up the cable and fry your computer's parallel port, ruining your computer. More elegant designs have limiting resistors and/or diodes. For this project, ghetto is fine. It's only a 3.6v battery onboard. But be careful.
The code I use is attached here. Mostly, it's overkill for just getting two motors to swing back and forth, but I was having fun.
The gist of it is that the servos need pulses every 20ms or so. The length of the pulse tells the servo where to turn the legs. 1.5ms is around the center, and the range is from 1ms to 2ms approximately.
The code uses the built-in 16-bit pulse generator for both the signal pulse and the 20ms delay, and gives microsecond resolution at the stock speed. The servo's resolution is somewhere near 5-10 microseconds, so 16-bits is plenty.
Does there need to be an microcontroller-programming instructable? I'll have to get on that. Let me know in the comments.
Step 8: Baby's First Steps!
I got the front legs swinging about 40 degrees either way, and the back legs about 20 degrees. See the first video for an example of the gait from underneath.
(Note the nice couple-second delay when I press the reset button. Very handy when re-programming it to have it sit still for a couple seconds with the power on. Also, it's convenient to center the legs for when you're done playing and you just want it to stand up.)
It walked on the first try! See the 2nd video.
In the vid, watch the way the front leg raises up, then the back legs turn to make it fall forward onto the front leg. That's walking! Play with your center of gravity and leg bends until you get that motion.
I noticed that it was turning to one side a lot, even though I was pretty sure that I'd centered the motors mechanically and in the code. Turned out to be due to a sharp edge on one of the feet.
So I made robo-booties. Is there nothing heat-shrink tubing can't do?!
Step 9: Tweaking
So it walks ok. I'm still playing around with the gait and the shape of the legs and the timing to see how fast I can make it go in a straight line and how high I can make it climb.
For climbing, the front leg bend just before the feet is crucial -- it helps it keep from getting caught on edges. Instead, the leg rides up over the obstacle if it hits below the "knee." I tried to make the feet hit at about the same 30-degree angle as the frame.
So how high can it climb?
Step 10: So How High Can It Climb?
Just about 1 inch right now, which beats most simple wheeled robots I've made, so I'm not complaining. Watch the video to see it in action.
It doesn't ever just leap straight over. It'll take a couple tries to get both front legs up and over. Honestly, it looks like a traction issue more than anything.
Or the center of gravity may be a little high for the long front leg swing. You can see it almost lose it as the front leg pushed the body up into the air. A hint of things to come...
Step 11: So What Can't It Climb?
So far, I have been unable get it to Master the Art of French Cooking (volume 2) reliably. It looks like 1 1/2 inches is the current limit to how high it can go.
Maybe reducing the front leg rotation will help? Maybe lowering the body to the ground a bit?
Watch the video. Witness the agony of defeat. Damn you Julia Child!