Does anyone know if Arduino Mega support up to 16 servos?

Hi all,

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?

IMAG0954.jpg

 

https://www.youtube.com/watch?v=a0Jj7qjlTeY

I have found this

I have found this one:

http://www.arduino.cc/playground/Code/MegaServo

but not sure if this is only way. Currently I am using <servo.h>.

update:

Even tried this MegaServo library but still the same…T_T

OK, the doc is a bit confusing

 

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:

Servos analogWrite Pins Timers used
1 - 12 not pins 44,45,46 Timer 5
13 - 24 not pins 11,12,44,45,46 Timers 1 & 5
24 - 36 not pins 6,7,8,11,12,44,45,46 Timers 1,4 & 5
37 - 48 not pins 2,3,5,6,7,8,11,12,44,45,46 Timers 1,3,4 & 5

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

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~

**Nice robot **

Nice robot 

I have tried to avoid those

I have tried to avoid those pins, still not moving. Seems like not many people use that many servos?

Sigh, just the looking. I

Sigh, just the looking. I try to add 2 hand for better balance but servos are not working if more than 12…

What else are you using?

Besindes the servos, I mean.

Also, are you just not getting the new ones to move or does adding them break everything?

Oh yeah, what about power?

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.

It was acting funny. I have

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.

Yep!

IMG_0960.jpg

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

I would be tempted to move

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

Arrr… Same result. I am gonna dig for more info. wish me luck.

As a last resort you might

As a last resort you might find the TLC5940 IC interesting, although it is only 12-bit.

I have give up Arduino Mega

I have give up Arduino Mega for now since it’s not working properly no matter which method I tried and end up using “Renbotics ServoShield” to operate it.

http://www.youtube.com/watch?v=KeEyaHUgBUc

However I don’t really feel comfortable with this shield because:

(There are chinese characters because I ask the same question in other forum as well.)

 

Thanks for everyone who helps me here~ :)

I guess you need to get a

I guess you need to get a Eleven board or a SB-Freeduino board, or a SeeedStudio board, all use the small USB connector.

Ah~ Sweet! I didn’t know the

Ah~ Sweet! I didn’t know the first two exists. Thanks for the info.