Hey guys, well im building from scratch a quadraped robot which will have 3 DOF per leg. Using an arduino would be ideal because I could easily program different gaits or positions but I`ve read on these forums and from various searches that the arduino doesnt handle lots of servos very well.
I have seen other atmel chip based controllers driving lots of servos at once, why cant the arduino? Is it just something to do with the servo libraries or the hardware timers? Will I just have to fork over for a dedicated servo controller?
hi ezekiel, It is certainly possible to drive multiple servos using the arduino. I posted some code that drives up to eight servos using the timer2 interrupt. You can find the source code starting from this post http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1204020386/60#74
As mem says, you can certainly drive many servos at once with the Arduino, but it requires clever programming, which in turn requires a good understanding of how to effectively use the mega168's timers and their interrupts. The more performance you want, the cleverer you need to be.
For example, if you want to guarantee that the servo pulse outputs to have 1 us accuracy, you have to do some fancy stuff to make sure that interrupts don't align in such a way as to extend your pulses. Most professionally made servo controllers on the market take things like this into account to ensure a very high level of performance (well, at least ours do, and I would hope that others do too).
Also note that dedicated servo controllers don't have to waste processing time doing anything else, so they have a lot of free resources. If you want to use your Arduino as both a servo controller and the brains of a robot, for example, the processing power you can devote to controlling servos is much more limited. One main reason people use dedicated servo controllers is to offload the processor intensive servo-control routines onto something else.
Thanks for the helpful replies :) mem I`ll check out that library and try getting like a proof of concept platform running on 8 servos first, but is it possible to modify that code to run up to 12 servos?
ben that was my original idea, leave the arduino as a motion controller and using I2C interface to another arduino or even wiring board to run higher level brain/sensor/personality functions. I may end up going "screw it" and getting a commercially made one anyway.
... is it possible to modify that code to run up to 12 servos?
ben that was my original idea, leave the arduino as a motion controller and using I2C interface to another arduino or even wiring board to run higher level brain/sensor/personality functions. I may end up going "screw it" and getting a commercially made one anyway.
That code uses timer2 and that can't easily support more than 8 servos. I have been thinking about supporting up to 16 servos using timer1, but I have not had time or need to do so, and not sure when I could get around to tackling it. I would be happy to help someone else write and test the code if there are any volunteers with some experience using timer interrupts. In the mean time, do have a look at the commercial products as per Bens suggestion.
Or, you could use two arduinos connected via i2c. I am working on a library that should make it relatively easy to pass servo commands to a slave arduino if you wanted to distribute servo control across two or more boards.