Let's Make Robots!

The way we walk...

Walks straight ahead
FourServoWalker-080617a.zip65.31 KB

This is an attempt to build a walking biped with only 4 servos, since that's what I have left right now. Since I don't have any video recording equipment right now, I'll try to describe how it walks. It start by tilting left to put all the wight on the left foot and lift the right foot. This is done by turning the left foot servo to the left, while turning the right foot to the right to support the robot as far as possible in the tilt, like this:


When the left servo turns further to the left, the weight will be on the left foot and the right leg will be lifted:


After the leg has been lifted, the robot will use the other two servos to move it forward. At this point, I always reach out for it, because it looks like it's going to fall:



Next step might be to add a gyro or acceleratometer, so it might adjust itself, if it's going to fall.

The "brain" is an Arduino that is mounted on a perf board. Only port 0-7 are connected because, the Arduino designers have, in their infinite wisdom placed the connector for port 8-13 half a unit from the 0-7 connector, so it won't fit on a standard perf board.

Perf board with connectors

I'll add a video next week, when I get my hands on a camera that can record video (no, there is no camera in my phone and my webcam doesn't work)


UPDATE: Video available.

Comment viewing options

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

I like this little bipod robot.

hi Jesper,

can u send me the modified servo library. the link on the first page seems to be broken.

hey, nice.  that was what my origional design was, but i liked the more humaniod look better, personally.


love the autonomy!

Hi, I am new to robotics. I have a Arduino and some servos. Could anyone please explain me in detail that how do you control 4 servos with the Arduino. Please give me diagram, source code etc whatever is possible and you think a new comer like me will need. Thank You.

Hello! i made a code that can control 5 servos with 5 potentiometers. I wrote the program for my robot arm.

// By Will Staffan 1/30/12

// Controls 5 servos using potentiometers.

// based on the tutorial sketch


#include <Servo.h>


Servo myservo1;  // create servo object to control the first servo

Servo myservo2;  // create servo object to control the second servo

Servo myservo3;  // create servo object to control the third servo

Servo myservo4;  // create servo object to control the fourth servo

Servo myservo5;  // create servo object to control the fifth servo


int potpin1 = 0;  // analog pin used to connect the first potentiometer

int val1;    // variable to read the value from the first analog pin

int potpin2 = 1;  // analog pin used to connect the second potentiometer

int val2;    // variable to read the value from the second analog pin

int potpin3 = 2;

int val3;

int potpin4 = 3;

int val4;

int potpin5 = 4;

int val5;


void setup()


  myservo1.attach(9);  // attaches the first servo on pin 9 to the servo object

  myservo2.attach(3);  // attaches the second servo on pin 11 to the servo object







void loop()


  val1 = analogRead(potpin1);            // reads the value of the first potentiometer (value between 0 and 1023)

  val1 = map(val1, 0, 1023, 0, 179);     // scale it to use it with the first servo (value between 0 and 180)

  myservo1.write(val1);                  // sets the first servos position according to the scaled value



  val2 = analogRead(potpin2);            // reads the value of the second potentiometer value between 0 and 1023

  val2 = map(val2, 0, 1023, 0, 179);     // scale it to use it with the second servo (value between 0 and 180)

  myservo2.write(val2);                  // sets the second servos position according to the scaled value



 val3 = analogRead(potpin3);

 val3 = map(val3, 0, 1023, 0, 179);




 val4 = analogRead(potpin4);

 val4 = map(val4, 0, 1023, 0, 179);




 val5 = analogRead(potpin5);

 val5 = map(val5, 0, 1023, 0, 179);





Pressed "post" twice... Deleted the copy


I haven't looked at this for some time and I'm not sure that I have the sourcecode any more. But take a look at the arduino servo library: http://www.arduino.cc/en/Reference/Servo. After version 017, it should be able to control up to 12 servos. I haven't had a chance to test this. Otherwise, look at the servo lib I used: http://www.arduino.cc/playground/ComponentLib/Servo.

Good luck

tried that butto no avail :(
What errors do you get? I must admit it's been a long while since I played with that code and the walker is just lying in a shoebox right now.
the main one is error:'refresh' is not a member of 'servo'