Stock Software Servo library ... how many can it support.

The servo library that is included with the IDE has a restriction of 12 servos per timer.

What is the reason for this limit ??

I am stuck with a 328P which (as far as I can tell) only has 1x 16bit timer.

This is going to be used on a very lightly loaded system.

TIA
Dave

Can you do I2C?
AliExpress has servo shields for under $2US
Adafruit has a shield too

Multiple shields allow for many many servos.

yes... aliexpress :smiley:
it's just like a robot shopping center for me.
servo shield or even a lovely controller for 32 servo is available for very cheap price and even u can bargain if u have time.

*buy arduino, buy servo, buy servo controller, buy DC controller, buy sensor shield, buy incredibly long wires
**even u can buy a nice cheap DC 200W motor for $30 :smiley:

This will be a reference to US based circumstances and points of view, so I apologize in advance to the forum members in other parts of the world.

AliExpress is similar to shopping at Harbor Freight. (discount tool store)
I know that the tools are not going to be the same quality as the name brand tools.
But golly, they sure are cheap!!!

And the items at AliExpress are so cheap, I tell my buddies that you just need to consider them free.
I am not rich but I have a certain budget for this electronics hobby. When you divide the cost of most items at AliExpress by my budget, the result approaches zero.

Edit: More apologies for taking this off topic. To go back on topic, SERVOS! (hint, they are super cheap there, too)

Sadly I2C is NOT an option.

If I could squeeze an extra 3 servos into the library it would solve my immediate problem, and the next pass could use a mega2560

Regards,
Dave

Sorted!!

There is a very good reason for the limit of 12 --- it seems that the stock servo library generates a pulse for each servo in sequence and then starts over and the whole sequence has to fit into a 20mSec slot (a requirement of the servos). What tends to happen if all 12 channels approach the max pulse width the 20mSec period gets stretched. Not very desirable. You'd probably get away with 12 most of the time but 8 would be safer.

After a bit of a struggle I got the "SoftwareServo" library working - it starts the pulse for all channels at the same time thus neatly avoiding the 12 limit. Admitedly, the 20mSec slot is not as accurate but the servos seem reasonably tolerant even with 16 being driven.

Clearly some thought is required in choosing which to use - there are advantages to both. I have learned a lot the past couple of days.

Thanks for the help,
Dave