BrainiBiped uses 4 microservos. I had a bag full of microservos and wondered what was the cheapest, quickest, easiest walker I could build: minimum legs, minimum DOF.

(I don't like the name BrainiBiped but it will do for the moment.)

The microservos are E-sky EK2-0500 and are pretty good. They have a torque of and a weight of 8g. That torque may seem puny compared to full-sized servos but they're small and light and don't take much current. That means the whole robot can be small and light. The overall result is that the servos have more than twice as much torque as they need for this particular robot design.

A typical 4-servo biped uses two of the servos to raise and lower the legs and two servos to twist the feet. There are a few different places the servo bodies can be placed: on the robot chassis, on the legs or on the feet. SteadyMan by Dave Steadman, Loki by David Buckley, 4s-1 on and Toe-Jammer by Dan Michaels show different servo placements. Brainibiped has the foot-twister servo on the body and the leg-raising servo on the leg.


The feet are made of a single piece of 1mm thick aluminium sheet bent so as to produce 4 "spurs". The tips of the spurs form an approximate rectangle 4cm x 5cm. The legs are made of the same aluminium sheet and are simple brackets to hold the servos. The bent shape of the bracket is rather more complex than it needs to be. Each complete leg is 12g of aluminium plus 2x8g for the servos. The trickiest part of the construction was finding screws small enough to screw into the tiny holes in the servo horns.

The chassis is the main pcb of the controller. It's made of "Tripad" stripboard. Proper glass-fibre pcb would be better. The body is stiffened by having the tops of the servo bodies glued to the battery box. The battery box hold 4xAAA NiMH which last for a few hours.

The total weight including batteries is 170g. The total height is 7cm. The aluminium and pcb both weigh around 0.25g per sqcm. The centres of the legs are 6cm apart so that's an ankle-torque of around well within the 1.3kg-cm the servos can give.

It has two sensors each of which acts as both an IR obstacle sensor and an ambient-light sensor.

The controller uses a PIC16F628. It drives the servos directly. A PIC16F628 can't self program and has only 128 bytes of flash. But I thought I would be clever. I added a few resistors so I could use the RS232 port of the pc to make an on-board PIC programmer (rather like the very cheap JDM programmer). I set aside 1k of the PIC's memory to use for the interpreted "user program". Of course, I wasn't really being clever. I should just have used a 16F87.

The servos run on 6V unstabilised straight from the battery. The PIC runs on stabilised 5V.

The controller talks to a program on the PC. Comms is via thin varnished-copper-wires which don't significantly load the robot.

Programming Language

You can download a copy of the programming system.

As you can see, the "user programming language" contains IF-THEN and GOTO and vectors of 4 numbers: the servo positions. There are only 6 instructions in the instruction set:

The user's program is held in program-flash memory along with the PIC hex instructions.

The user's program is a table of records. Each record contains 4 bytes. The table is located immediately after the PIC hex instructions.

The user's program is a table of records with the following format:

Command A B C D
Sleep 1 time 0 0
Stop 2 0 0 0
Goto 3 addr 0 0
ifLeftObstacle 4 x addr 0 if LeftObstacle > x then goto addr
ifRightObstacle 5 x addr 0 if RightObstacle > x then goto addr
Beep 6 freq len 0
move servos $80+a $80+b $80+c $80+d

Other instructions will be added for detecting light levels. The Beep and Sleep instructions are not currently implemented on the PC.

Each instruction is 4 bytes long. They are held in the PIC's program memory, not the user-memory - it's too small. (In the above example, the "L" and "R" instructions represent standard servo postions for left-foot-forward and right-foot-forward.)

The PC-program acts as a teach-and-replay sequencer. You press buttons (on the left of the screen above) to move the servos then, when you have a position you like, press Append to add it to the "user program". The PIC does't send the new servo position to the servo immediately: the servo pulses are ramped-up or ramped-down so the servo moves at constant speed (which is less than the servo's maximum speed). When all the servos have reached their new target positions, the PIC tells the PC and the PC sends the next set of positions in the sequence.

You can single-step the "user program" and the Run button sends the "user program" to the robot.

Once you have a good program, it can be downloaded into the PIC and can be run stand-alone. It's a slick system and it took around 10 minutes to get the robot to walk. I would always recommend using a system like that.

Here is an early drawing from calculations of the robot's CoG. The robot tilts its body over one foot and, at the same time, uses a spur of the other foot to ensure that it doesn't topple over until the CoG is well inside the foot.

The PIC measures the current used by the servos. Each servo controls its motor with PWM pulses. The "ground" pin of all the servos goes through a 1ohm resistor to PIC ground. That produces a 0.5V pulse on the servo ground pins. The PIC measures the width of the pulses and so can tell how hard the servos are working. The PIC waits until the PWM pulse for one sero has finished before it sends the control pulse for the next servo. If any servo exceeds a threshold (for N consectutive motor pulses), all the servos are switched off. In that way, they are not damaged if the feet jam. (It all sounds complicated but the servo code only takes 70 instructions on the PIC.)

In the current "user program", when the robot senses an obstacle, it executes a new servo sequence to back-up and turn away. The sensor is only checked when both feet are down. There are different back-up and turn sequences depending on which foot is forward and which detector has seen the obstacle.


Questions or comments ? E-mail me at

No part of this web page may be reproduced in any form or by any means, including photocopying and recording, for any purpose without the express written permission of Analogue Information Systems Ltd.

This web page is copyright © 2008 Analogue Information Systems Ltd., 1 Warrender Park Crescent, Edinburgh EH9 1DX, Scotland, UK, Tel: +44 (0) 131 228 6008. All Rights Reserved