PCA9685_ServoDrv.zip (5409Bytes)
+++ UPDATE (12-march-2014): Rename title as "Biped Howto".
Hi, I will try to explain, in a very simplistic manner, the way in which servo motors can be controlled.
Servo motors are controlled by a PWM signal, in which the active part of the signal (known as duty cycle) define the amount of degrees the servo will rotate.
PWM signals use to have a period between 15ms and 25ms. In my case, this period is 20ms. Depending on the servo type, and after a bit of calibration, a proportional relation between the target angle and the PWM duty cycle can be found.
Once this relation is found, I can program a macro conversion between both variables:
The main problem controlling this kind of robots, is the high number of servos. In my case there are 10 degrees of freedom, which implies 10 servo motors. By default, a single microprocessor doesn’t have enough peripherals to manage all these servos, and you must use an external driver. In my case, I found the part PCA9685 in Adafruit (https://www.adafruit.com/products/815).
This controller can manage up to 16 PWM channels independently through an I2C bus channel… a perfect solution!
You can download the attached file <PCA9685_ServoDrv.rar> with the source code of this driver. You can use it with your mbed board or port it to your own platform.