I have 12 servos connected on mega with no problem. However, when I try to add up to 14 or 16 servos, at least 2 of servos are not working. I am not sure if it only support certain amount of servo or something?
I have found this one:
but not sure if this is only way. Currently I am using <servo.h>.
Even tried this MegaServo library but still the same...T_T
But this part here:
This library uses a 16 bit timer for each group of 12 servos so PWM output with analogWrite() for pins associated with these timers are disabled when the first servo is attached to the timer. For example on a standard Arduino board, Timer1 is used, so once you attach a servo, analogWrite on pins 9 and 10 are disabled.
Here is a table of PWM pin usage on the Mega board:
seems pretty explicit about not using certain pins depending on how many servos you run. To run 16, it will use timers 1&5 and you can't use pins 11, 12, 44, 45 or 46. My guess is that you might have servos on 11 and 12 that you need to relocate to other pins when you go past 12 servos.
Hum... Which means when I use up to 16 I can't use pin 11,12,4,45,46. Yeah I did use 11 & 12. which might cause the problem. Gonna try again tonight! Thanks for point it out~
I have tried to avoid those pins, still not moving. Seems like not many people use that many servos?
Besindes the servos, I mean.
Also, are you just not getting the new ones to move or does adding them break everything?
It was acting funny. I have servo1~servo12 connected with pin2~7 and pin14~19; this setting works perfectly. But when I tried to add servo13,14 to pin 20,21; Servo13 works but is 14 not working, also the original Servo7 which connect to pin2 is not working but with the power to remain it's own position thou. I have no clue why it act like that.
Thanks for your inpot buddy~ I have been search on net whole day and only found one guy has same problem like me with no solution. Some people suggest move to SSC-32 but I don't wanna give up that early yet.
I would be tempted to move them all into the upper range of pins, like between 24 & 40. You may find additional hardware is needed though. The Arduino has a lot of upside in having so much in the library that takes care of details with the processor, but the way its resources (particularly timers) are allocated makes it easy for conflicts to occur. Going to a Mega sidesteps a lot of them (soft serial on the base models limits you to 2 servos) and often the high pins have the least trouble.
Arrr..... Same result. I am gonna dig for more info. wish me luck.
Oh yeah, what about power? Are you using an external power source for the servos' 5v (or 6v). I suspect VCC would have dried up well before a dozen servos, but I figured I should ask.
I have use external power with UBEC to reduce 7.4V to 6V. Without external power Arduino won't take over 3~4 servos.
my rough PDE files