This robot is my first legged robot. He has six servo motors, one for each hip, knee, and ankle. For balance I am using a new chip, the Analog Devices ADXL202E. This is an x-y accelerometer, and is actually a micro-machined mass and spring to detect true acceleration. It has excellent resolution, and is easy to interface to a microprocessor.
I designed he main circuit board to be a multi-purpose 'bot board, that I could stick on to any mechanical platform, wheeled, legged, whatever. This is the first platform I have tried it on, and I am very happy with the results. Here are the features of my robot control board:
2 Microcontrollers: a PIC16F876, and a PIC16F84, Microchip flash memory controllers.
8-channel Servo (performed by the PIC16F84)
14-pin LCD Connector
On-board battery level monitoring (motor and CPU voltages)
On-board X-Y Acceleration sensor (ADXL202)
Wireless RF serial Link, transmitter, receiver, and antenna switcher (433MHz)
2 In-Circuit programming ports (RJ-11 modular connectors)
Serial Port (same RJ-11 as programming port)
2 I2C bus connectors for expansion
4 Analog or Digital ports for sensors or expansion
2 additional dedicated Digital ports for expansion
Any of the 8 servo channels can also serve as a digital input or output
Separate motor and CPU power connectors and voltage regulators
For a picture of the trace layout of the board, click here.
The body is simply a battery pack (4 AA for the sevos and 1 9V for the micros) attached to the PCB. The servos are standard Futaba 3003 servos. Attached to the bottom of the body is an angled aluminum piece attached to the hip servo. The legs are made from sheet aluminum, drilled to allow attachment to the servo bodies and control horns. The feet are simple platforms glued to the ankle servos, with two cartoon-like toes in front.
I designed the legs to allow motion from completely collapsed crouch to almost straight-legged standing position. The tall standing position is not very stable, so like a bird, the legs are normally in a half-standing position. The knees are also inverted like a bird's, for the same reason - I wanted the normal position to be half-bent, and it just seemed more natural for that to be in the inverted position.
The middle-height position of each leg allows for plenty of room to extend or retract as needed for balance. If it is tilting forward or back, the ankles flex and the knees extend. If it is tilting left or right, all three joints on each leg are adjusted to make the right leg longer or shorter than the left leg. These actions work together in the case of both sideways and front/back disturbances. When left alone, it twitches now and then, sometimes rocking forward or back, or side to side, actively compensating for tilt. It really looks alive when it's doing this.
If you set him down on an uneven surface, for example a two-inch thick book under one leg, he will immediately shorten that leg to arrive at a level position. The same for an angle surface, in any direction. All of this is done using just one sensor.
If you want to take a look at the source code, click here.