I'm using an Arduino Mega Sensor Shield on a Mega 2560 board and so far I have 12 servos attached to it from PWM pins 2 to 13.

I want to add 5 more servos but there are no more PWM pins.

So which pins do I do I use for these.

  • Since the HW peripherals are finished, I think you have to implement a software timer to control them. This should (never tested, though) be doable with the Arduino Servo library (formerly MegaServo). From the notes, "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. ". So it appears that you can use any digital pin using the default library. Did you try? – frarugi87 Mar 19 '18 at 17:08

There seems to be a library called

According to this Answer you have some possibilities:

  • Using ShiftPWM library
  • Using a timer with a generic GPIO
  • I'm using the MegaServo.h library. I can control the existing 12 servos but which pins do I use to add further servos. It says that the Mega Sensor Shield can support up to 48 servos. I've tried from pin 22 but it does not work. – Malcolm Palmer Mar 19 '18 at 13:22
  • I think the library name is missing. @MalcolmPalmer the MegaServo library was renamed to Servo; so my suggestion is to avoid using an older version – frarugi87 Mar 19 '18 at 17:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.