Biped Howto: Moving servos

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.

servo_pulse_width.jpg

PWM signals use to have a period between 15ms and 25ms. In my case, this period is 20msDepending on the servo type, and after a bit of calibrationproportional 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:


degree_pwm.jpg

 

The main problem controlling this kind of robots, is the high number of servos. In my case there are 10 degrees of freedomwhich implies 10 servo motorsBy 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. 

 


Comeon guys you’re being a

Comeon guys you’re being a little picky aren’t you. Anyone who has the money for digital servos should also have the wits to figure out they are controlled different to analog servos.
I don’t see any problem describing the signal conditioning for them as pwm. Google servo control and your going to get whacked with a gazillion sites describing it as pwm. Just because your duty doesn’t cover from 0-100 percent in a servo doesn’t mean it isn’t pwm.
The unfortunate part is a lot of microcontrollers can’t use the hardware pwm correctly to drive servos so the signal is bitbanged using timers plus there’s never enough hardware pwm pins.
And this is why I believe lord_bot has stated that they cannot drive enough servos. I can’t see a controller that’s driving 48 servos or even 16 servos having much time for anything else.
It’s a personal choice in the end, use an extra microcontroller as a servo controller or buy a chip like the PCA9685.

Yes, all of you ate right.
Yes, all of you ate right. But I’ve just only want to tell the way in which I solve the way to drive those 10 servos in a simplistic manner just using one I2C channel, available in common microcontrollers.