Let's Make Robots!

Arduino Quadruped Walking Robot

walks on four legs
walking_gait_theory.zip1.34 MB

UPDATE 24.April 2011: New video! :) I implemented automatic resetting of the legs positions before changing from forward/backward walking to left/right walking. This is to ensure proper leg offsets. Previously I had to press the Z button on the nunchuk to reset, now it happens automatically, so one step closer to becoming autonomous. In this video the gait is the same for walking and turning (trot gait) only the duty factor is higher for turning (beta = 0.75) which means the leg stays on the ground for three quarters of the leg walk cycle time and only one quarter in the air. 

I'm not sure if I'll go with this sort of automatic position resetting (right now all the hips and knees just move to their center positions (because that is a suitable start position for both walking and turning with the trot gait) but I'm thinking it would probably be better to step the legs to center if they are further away from center than some threshold. So if the leg1's hip is at 51%  and knee at 40% let's say it will just move the hip for 1% and knee for 10% down, while if the leg2's hip is at 90% and knee at 100% let's say (that means the leg is extended to the front and is touching the ground) it would probably be better to step to 50% - like so: lift knee to 0% and then move hip to 50% and then put knee down to 50%, so it won't move the body when it starts to move leg2. I don't know maybe it's not such a good idea, I guess I'll see when I try it :)  

I'll probably use the trot gait for faster walking, while the crawl gait is more suited for slower walking (better stability). Very soon I will start with adding sensors and working on the autonomous mode.


UPDATE 23.April 2011: New video that shows robot walking with crawl gait (creeping) and turning with a 2/2 gait (trot gait but with the same duty factor as for the crawl gait (bigger duty factor for turning than in the previous trot example (the one with the wireless nunchuk and forward/backward motion only) for increased stability -> beta = 0.75, this means that 3 quarters of the leg cycle are 'spent' on the floor, while only one quarter in the air, check attached .zip file for more details on the theory)). However I have some problems. First problem is that I have real stability issues. When turning it trips over very easily (especially when going slow or really fast) and it turns much better to the right than to the left (stability wise) and I think this is mainly due to the fact that my legs are all handcut, glued together and screwed on the body so there's a lot of little mistakes that add up :) I think the problem is mainly with one leg being a bit too big and being a bit angled so the length of the leg changes with the hip move... I have to fix that, but I think maybe it's better to make a 3d model with the prototype's dimensions in Sketchup or something and then have it machined somewhere so the legs are really the same. Also I'm thinking of maybe building a new leg design, just to try out how it performs... I was thinking of something like this: http://www.youtube.com/watch?v=NAHo8eEbJCE&feature=related , I see here http://www.youtube.com/watch?v=msaWXY3OuQQ they're all using a very similar design just that it's 3dof. I think they wouldn't look as cool on a quadruped :) but maybe it is a better leg design, I don't know. I will have to throw something together to test someday (when I'll feel like making 4 new legs :)). Also the weight distribution is not ok and I think this amplifies the balance/trip-over issues. Tomorrow I'll buy some 2-battery holders and try to distribute it more evenly along the body's length. The second problem is that (as you'll see in the video) I have to reset the legs positions before I go into turn. That is to ensure the right offsets between legs positions and set the phases of the legs (I decided to split (mentally and in code) the leg walk cycle into 2 phases: step phase (when the leg is in the air) and pull phase (when the leg is on the ground)). This mandatory resetting is not optimal at all, because that means I will have to program the same behaviour in the autonomous mode, which by itself (implementing the auto-position-reset) is not really difficult, just that it's not pretty and natural, organic if you will :) There has to be a more elegant solution, probably mathematically more complex (I hope not too complex for arduino or for me ;)), but I am afraid I will have to rewrite most of the code (which wouldn't be such a tragedy, I don't have that much anyway and still full of bugs :), if only I had a good solution to the problem).  I'm searching for some cool ideas/solutions for this problem, if anybody has any. Is the IK (inverse kinematics) only option here, what do you think? Also I was thinking how it could walk on curved paths, like arc or something, and came to the conclusion I would have to implement the system like in servo controllers (eg. ssc-32), so I could specify the time in which to arrive to the destination, because now I am solely relying on all the legs being identical (as in all having the same servo travel, so all hips have let's say travel of 100 degrees, while knees have travel of 50). So to keep the gait regular and symmetric while turning I would have to adjust the speed for the timing to match up, so if the hips' travel on the left side of the robot let's say (if walking and turning left at the same time) should be shorter than on the right side.

Tomorrow I'll hopefully test, shoot and upload the video of trot gait for walking and turning (but with different duty factors maybe?) and try some other stuff to solve the gait transitioning problem and also check if I can improve the balance and weight distribution.


Hello everyone, I am new to this site (at least as a member), but I've been lurking around for a while looking for some cool ideas and I must say the site is really awesome.
I have to say this is my first robot and it was inspired by KatteJuice's SC-QR-1 robot, big up to him for showing what can be done with some hot glue and 8 cheap servos! I definitely wouldn't try and make a four legged robot as my first robot otherwise, mainly because you always see all those high grade servos and brackets and special controllers and whatnot when looking for hexapods and quadrupeds. Don't get me wrong, I would immediately fork out for dynamixels and aluminium brackets if I had the dough :). I see that when you actually try to build something like this, you find that in the long run you would probably be better off (quality and durability wise), but I learned alot and that's why it's better to start with nothing and build upon experience I think. Also I'm not much of a handyman, never been, so I neither have the tools nor the patience to make anything complicated (or anything where precision is key, like 4 identical legs) and so construction was the most difficult part for me. I am slowly getting into it though.

I started with the leg prototype, very similar to kattejuice's leg design, because I saw how well it works. The first material I used for the legs was plastic from cd casings, because I knew that I wanted at least prove the concept and have some sort of walking gait working without legs having to actually support anything, before I go and make all 4 legs. I searched google for info on walking gaits and robots. I found some book that had a preview chapter on google books, and it was just what I needed. Not too deep, only the basics, just enough to get me started. I can't remember the title, but I made screenshots :), and I can attach the files, if anyone is interested. The first tests went very well, so I made 4 of them and tried to walk, (just for fun, I knew they're too weak). Then I made legs v2, that were more solid, because I bent them 90deg to make them stronger. The plastic was still the same. Not good enough! :) So I went and made legs out of 3mm thick plastic 90 deg angled piece (dimensions: 30 mm x 30mm x 3mm x 1200mm). I chose an angled piece only because with my previous prototypes I had to do quite a lot of heat bending the plastic to make it more rigid, so I decided it's easier, better looking and stronger if I start with a piece of plastic that already has an angle and use it to my advantage.  

Leg (last version)

Also the last version has knee servo horn directly screwed and glued to one of the connecting pieces (upper), instead of transfering the force via the lever (?? not sure if this is clear?) like in the previous prototypes, it gives much less play, the movement is more immediate.


3 cm width wasn't enough to make hip brackets, so I had to improvise and hot glued 2 L pieces together to form a U piece that was 4cm or so high. Not so optimal solution but it works. I'll have to try and find some wider plastic and preferebly U-shaped for the hip brackets.


But I still needed better support for the hip joints (so the legs wouldn't splay that much in the hip), I had to make some sort of pivot shaft at the bottom of the servo. I made a hole in the bottom side of the hip bracket and screwed in a screw through the bottom part of the knee bracket and it worked out nicely. (It looks like it's screwed in, but the hole is big enough so it can rotate freely.)


quadruped robot without cover

For now I am powering everything from 5 NiMh AA rechargables, but I am strongly thinking of going to 2s LiPo battery instead. Mainly because it would probably make for a lighter robot, and also I guess the weight distribution should be better if I choose a low profile flat battery that fits in the body better. Question: Does anybody know of a BEC capable of supplying around 6A give or take (8 x 750mA for hxt900)? Or will I have to have 2-4 of them? Or do I just put some diodes to lower the voltage to 6V for servos? If so, how do I make sure not to overdrain the LiPo then? Any suggestions?

Currently I am using a wii nunchuk (wired and wireless) as an input device, mainly because it's convenient to be able to control the movement or the speed of movement - it's easier to figure out stuff if you can slow down things let's say, and it's also so cool :) Wired nunchuk works like a charm, but sadly the wireless version has some issues. The first problem was figuring out how to sync the controller to the receiver :) I tried holding down sync button on the controller, and the FC button(??) on the receiver. To no avail. Then I remembered I have a Wiimote from a couple years ago (used it for WiimoteWhiteboard with my homemade IR pen and for drumming (sample triggering with Wiinstrument) and for snes arcade emulator control :) ) So I connected it to the wiimote, then bound the wiimote to the computer, and guess what, the controller paired almost instantly, no holding down the sync button necessary, just a touch :) So back to Arduino. I noticed that the LED on the controller was brighter when connected to the wiimote than when I had it connected to 3.3V on Arduino. So I thought maybe the voltage is not high enough. I plugged it in 5V and it was brighter and it worked, but only after I removed all the resistors from the Data and Clock lines. So I figured it out, hooray! But here's another problem. Now that everything works, I see the bloody thing only outputs a series of 9 equal values ?? WTF!? After googling around I see others have the same issue. Great! I thought maybe if I decrease the polling delay (it was 100 ms) I can live with 10 times lower sampling frequency. Well I thought wrong! You can't go faster than 80 ms or so, maybe 50, but then the errors increase as well. So I am stuck with lame sampling frequency that makes controlling anything really laggy and not enjoyable. Also it loses sync every couple of minutes, you can see it at the end of the video. At the time of writing I can't even sync them together again. I will try to fix the issues, but in the worst case scenario I will just use wired nunchuk for developing and programming, while the crude wireless chuck will be used for basic control if anything goes wrong with the autonomous code (non-existing yet :) ).

As for the programming part goes, I wrote some classes so I can reuse stuff easily. So for example I have a Hip and Knee classes (I will extract them to Joint class, because they're basically the same, only the naming is different (eg. knee.up() vs. hip.forth()), which together make a Leg object. Four legs then form a Quadruped class that has functions like forward(), backwards() etc., so you can have very simple loop function like { if (speed > 0) quad.forward(speed); })  I'm not sure how I will implement smooth transitioning between gaits, e.g. I want to have a trotting gait (I think it's called that way) for forward/back motion let's say, but have wave gait (crawl/creeping) for turning maybe... They have different leg timings and positions and when controlled with a nunchuk you have to be able to convert from one to another at any point in time. Definitely I will have to rewrite some code to make it better (it's very buggy and crude), because at the moment I have nothing that would recalibrate legs at specific points (if this is even the way it's done??) in time or position so they eventually go out of optimal timing, even more so if I change directions of walking and walk very fast). If anyone has experience in programming walking gaits and has any valuable knowledge to share on how to go about programming such thing, I would be very grateful!

When I'm done with implemeting the walking, turning etc. I will add some sensors to it  (oh yeah and a piezo speaker for sound fx! I have one ready waiting to be mounted) and make it (more) autonomous. I'm thinking a PIR sensor for starters, only because I already have one, and have never used one. Probably I will use it as a motion detector, to put a robot to "sleep" when there's no activity in the room.

Built with:
8x hextronik hxt900 (9g) servos (actually 7, one was replaced by tower pro sg90, because the gears broke, I think it was my fault :) ),
Arduino Uno,
selfmade arduino servo breakout shield,
wii wireless nunchuk (Sweex brand),
5x 1.2V rechargable AA batteries,
1 project box,
homemade servo brackets (3mm plastic),
couple of screws, nails and some hot glue

Cost to build: Around 100 € (for now)

I'm sorry for the low quality video, it was recorded on a phone, then compressed when emailed to myself and compressed again on youtube. I have a bunch of the older ones (first prototypes, the wired control etc.), I can upload some more if you want. I will upload some photos of details as well.
Sorry for the long essay without head and tail. I hope somebody got through all that mess. :)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Thank you for the compliments. I think sharing is cool! :)

Thanks again! 

ahem.. a lil' story of me a few moments ago:

..and there i was.. browsing lots of projects since i havent been here in a while.. and i see this!

im like, hey that kinda looks like the robot i made! :D


i click it and scroll down to see if this guy has added some videos and more pictures. and he had! respect for that, also!

i start reading the text, but it seems like one big chunk of text that'll hit me like a wall, so i just read it through fast. but while doing this... i see my "name", Kattejuice, and im like.. WOAh! :D this guy's having something about me.

I read the whole thing and i think its awesome! very nice control with the wii chuck and all ;)

also: you just made my day! :D awesome!

Thank you for making SC-QR-1 that inspired me to make this robot! I'm glad you like it. And also much thanks for showing the details on how you make those joints with nails in your youtube vid (how to make a gripper)... it was very helpful. I'm glad I made your day :), you made mine too with your comment! :D





Thanks again and hope to see more cool robots from you. 




very nice robot. The gait is great for a 2dof.
Any chance you might share your arduino code? I start a similar robot and need some inspiration :-)