Hand gesture control Biped Robot

The one-foot- high biped robot is designed to mimic human walk, detect obstacles, and be controlled with hand gestures. The project was inspired by the recent Atlas robot developed at Boston Dynamics with the capability to walk and do backflips. I worked on this project with my friend Arthur Mayer and presented it at the CS Department Annual Innovation Fair.

The Design:

The robot’s mechanical design is based on a simplified human leg, so only uses five servos. It has two “hips” and two “ankles”. The fifth servo is attached to an arm that acts as a counterbalance to help stabilize the robot. The robot has an ultrasonic sensor on its head to detect objects (e.g. wall) to avoid collision. The Raspberry Pi is mounted on the back of the robot and is connected to a fully wired breadboard.

The robot is controlled via an accelerometer. Depending on the angle and direction the accelerometer is tilted, the robot will move in certain ways. We wanted the accelerometer to be mounted on a glove that the operator could wear, allowing for simple and intuitive control of the robot.

Front and Back of Robot

The skeleton of the robot is made of acrylic and screws, with metal and acrylic brackets to secure the servos. The feet are wide to provide better stability at each step, and the robot has an acrylic plate on the back to support the Pi. The biped robot  has sensors hooked up or the Raspberry Pi on the back. The servos are connected to the Pi, which is on the table, and the counterbalancing arm attached to the top servo. The arm is made of a plastic servo horn attached to a gear and flat piece of metal by using screws. The end of that flat piece has a second, identical piece taped to the end, and a rechargeable battery taped to the end of that.

Figuring how to control Five High-Torque MG996R Digital Servo

The servos were used to control the joints of the robot. Pulse Width Modulation (PWM) process sends precisely timed bursts of power to a receiver like a servo. The five servos used in this project run at the frequency of 50 Hz, meaning that a pulse was sent every 20 milliseconds. The duration of the pulse (the amount of time a signal is being sent) compared to the total time of one cycle is called the duty cycle. In other words, the duty cycle is the percentage of time that pin is sending output per cycle. The servos operate at 50Hz, so every cycle is 20ms. A duty cycle of 50 would mean that 50% of the cycle is output, which corresponds to 10ms. A duty cycle of 12.5 means 12.5% of those 20 milliseconds is output, or 2.5ms. The output is always the first part of a cycle. The duty cycle controls the amount the servo has rotated, and therefore the angle of each joint. A pulse of duration 0.5ms, sent every 20ms, sends the servo counterclockwise. A pulse of
duration 2.5ms sends it clockwise. For example, this snippet code below shows how to send signal to the
servo via one of the Pi’s GPIO pins.

While True:
p.ChangeDutyCycle (7.5)
time.sleep (1)
p.ChangeDutyCycle (7.5)
time.sleep (1)
p.ChangeDutyCycle (2.5)
time.sleep (1)


The most challenging part about this project is figuring how to control the servos with pulse width modulation and coordinating all five servos to make the biped robot walk without falling. There was a lot of trial and error to make the robot stay upright at each step. A further challenge was presented when the Raspberry Pi was mounted to the back of the robot. The addition of the Pi shifted the center of mass back, and the angles of the servos had to be adjusted slightly to compensate, which was a whole other round of trial and error. As if this wasn’t challenging enough, the repeated testing made some screws come loose at times, and the feet would be offset slightly, causing them to catch on each other as the robot took steps, making it fall more often. Finally, the ability of the robot to walk was very dependent upon the surface it stood on. During the coding and testing process, the robot was moved several times, and each new location had a different surface which made the robot behave differently.

Progress so far:

The robot successfully walks without falling. A video of demonstration can be seen at https://www.youtube.com/watch?v=x_H9rrJlNtc. If the hand points downward, the robot moves forward. If the hand gesture moves left, it turns left, and vice versa. When the ultrasonic sensor detects an object, the robot stops immediately and the piezo then makes an alerting sound. All the servos work well together, thus enabling the walking pattern.

Wiring guide:

Both L/R ground and 5v go to rail on the side

Ultrasonic (left side) – Vcc to power rail, GND to ground rail, trig to pin 16, echo to blank. From echo’s blank, 1K Ohm resistor to blank rail. On that rail, a wire from that to pin 13, and a 2K Ohm resistor from that to ground rail.

Robot (right side):

brown = ground, red = power, orange = data

all power connected to power, ground connected to ground

L hip = 1

R hip = 3

L ankle =2

R ankle = 4

Top counterbalance = 5

connect the data pins to pin [20+servo number]

Piezo (left) – 1 to pin 17, 1 to left 3.3v

Accelerometer (different breadboard, left)

Put accelerometer parallel to ground/power rail so it is on 6 blank rails

GND diretly to ground

3.3v to 3.3v

SDA – 330 Ohm resistance to Pi-Wedge SDA

SCL – 330 Ohm resistance to Pi-Wedge SCL


Posted on

December 4, 2017