using 20 and more servos and motors with controllers on the mega

Hi!

I'm pretty new here and I am trying to set up my arduino mega with lots of servos and motors.
I've had a look at the servo library - it is mentioned that pins 11 and 12 will loose PWM-functionality if I use 12-23 motors. Why is this the case and what does this mean for me? So I can't use those two pins for any servos if I have more than 11? And what happens if I use more than 23 motors (it should support 48 on the mega). Can I just use any of the digital pins to connect to those 48 servos?

Sorry for asking stupid questions. I just didn't find any satisfying answers to this questions anywhere :confused:

Regards,
squatina

Why is this the case and what does this mean for me?

It is because the servo library uses the internal timer that is used to generate PWM signals on those two pins.
It is important if you want to use PWM in addition to using servos.

So I can't use those two pins for any servos if I have more than 11?

No that is not what it said. Servos are not PWM.

Can I just use any of the digital pins to connect to those 48 servos

Yes.

Be aware that servos take a lot of current and generate a lot of interference so you will need a good external supply with good supply decoupling.

Thank you very much for your reply! This helps a lot! :slight_smile:

I know that I will need an external supply for the servos and motors, I already run a few tests, but only with 2 servos. And even then I needed one.

I do have another question: I also found the MegaServo library on this site and it was mentioned that it was renamed to the Servo library. Do those two libraries have the same properties? In this library, it is also mentioned, that pins 44,45,46 won't have any PWM functionality when using the library. And it is mentioned which pins will loose this functionality when using more than 23 servos. Is this also the case for the Servo library?

Thanks a lot! :slight_smile:

There are many libraries for servos, so any for any restrictions you should see the documentation in the library file.

I would like to use the standard servo library as it supports those 48 servos. But I can't find any more documentation concerning my questions than mentioned here: http://arduino.cc/en/Reference/Servo.
Is there any further more detailed documentation?
Sorry if I overlooked it...

I don't know but the simple way it to try it.
You don't have to have all the servos actually connected to try the software. These will put out the servo PPM signal whether there is a servo connected or not. Then you can see the effects on these other pins yourself.