Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: Zondartul on December 08, 2010, 04:48:54 AM

Title: Axon PWM / Servo question
Post by: Zondartul on December 08, 2010, 04:48:54 AM
Hey, this is probably a silly question, but the Axon I page says it can control up to 29 servos... yet it can only support 9 PWM channels.

I am confused. Isn't controlling a servo = constantly supplying a PWM signal, or else it will go limp? Does it mean out of 29, only 9 can be on at once, or does it mean there are actually 29 PWM channels?

Can I use Axon to change the angle for 24-27 servos simultaneously?
Title: Re: Axon PWM / Servo question
Post by: Webbot on December 08, 2010, 02:20:49 PM
The number of hardware PWM channels is fixed by the ATMega640 (and not all of them have got header pins on the Axon - unlike the Axon II).

The reference to 29 comes about because of the number of header pins that also provide the battery voltage - ie they are 'potential' pins that can be used for servos.

How do you drive a greater number of servos? Well - you simulate the PWM in software by using timers to generate pulses on whatever pins you want.

If you are daunted by writing the code to do that then WebbotLib (http://webbot.org.uk (http://webbot.org.uk)) is a library that will do it for you.
Title: Re: Axon PWM / Servo question
Post by: Admin on December 08, 2010, 03:37:06 PM
What Webbot is eluding to is there is Software-based PWM, and Hardware-based PWM.

In hardware PWM, it's a 'set and forget' type of thing. In this sense it is better, but there are only a small number of hardware PWM pins (as you have realized).

In software PWM, the software pulses a pin really fast - just like code to turn a LED on and off. The disadvantage is that this takes up some processing power, but you can use any pin to do this.

This is why the Axon II has 2x as many hardware pins.

The WebbotLib Project Designer lets you use one or the other, or both at the same time, and is really easy to set up.