Go Down

Topic: Servos and steppers on an Arduino Mega (Read 764 times) previous topic - next topic

Luis de Morais


what sort of limitations should I expect by trying to control servo motors and stepper motors with the same Arduino Mega board?

From the Servo library intructions: "The Servo library supports up to 12 motors on most Arduino boards and 48 on the Arduino Mega." Is the number 48 impacted if I also use the Stepper library?



Hi Luis,

you posted the question twice in this subsection , once with a half title, could you please remove it?

The most important thing is that the servos should have a separate power supply, especially if you want to connect 48. Connect the GND from the Arduin to the GND of the other power supplies and it should work. Furthermore keep in mind that servo's need serious time to get their position but you should build your application logic so that you don't wait for servo 1 reached its destintion angle before applying commands to the next.

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Luis de Morais

Thanks Rob. The other "half post" has been removed!

My question is more about the hardware resources that libraries servo and stepper use. Like timers. From my experience I know that if you use library servo (which uses timer1) you lose the possibility of having PWM on certain pins. Therefore if I want to keep all "PWM" capabilities I can not control all servos with a Mega that I otherwise would be able to.

"On the Mega, up to 12 servos can be used without interfering with PWM functionality; use of 12 to 23 motors will disable PWM on pins 11 and 12. "

Are there any similar issues if I want to control a stepper (instead of a DC motor)? Trying to be more objective, how many servos will I still be able to control with a Mega if I'm already controlling a stepper? Is the number 48 still valid?


Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131