According to this:

The Servo library supports up to 12 motors on most Arduino boards and 48 on the Arduino Mega. On boards other than the Mega, use of the library disables analogWrite() (PWM) functionality on pins 9 and 10, whether or not there is a Servo on those pins. 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.

However, according to this:

Digital I/O Pins 14 (of which 6 provide PWM output)

So how can the Uno control more than 6 servos if it only has 6 digital I/O pins that can provide PWM output?

1 Answer 1


Although I haven't looked at the source myself, in these types of situations they usually use interrupt timer 1, which in PWM mode would have been associated with pins 9 and 10. This would explain why you can't use pulse width modulation on those pins. In fact, you can use any of the three timers for PWM on any digital pin, although it's not as good as the built in PWM options.

(source: bansky.net)


The above image accurately describes how the signals are sent to the servo motor. Such a waveform is similar to a standard PWM. The servo library can translate a degree to a waveform that the servo's IC will be able to use to adjust the motor's position with it's motor and potentiometer.

  • 1
    So it essentially simulates PWM? What is the point of the digital pins with PWM channels then?
    – user1265
    Apr 30, 2014 at 22:33
  • @user1265 More or less... it's using the timers that drive PWM. As far as the point of PWM, IIRC the ATmega328 has circuitry to make PWM more efficient. Apr 30, 2014 at 22:51
  • 2
    @user1265, hardware PWM is "free", i.e. it does not affect the performance of the rest of your program at all (it just ties up a timer, or at least part thereof). Servicing interrupt routines for emulated PWM is comparatively costly. However, in this case, the PWM frequency is only about 50Hz, so this is not overly tragic (Standard Arduino PWM frequency is 31/62kHz, doing PWM for e.g. lighting applications at 50Hz would probably be rather flickery). May 1, 2014 at 0:38
  • What is the point of the digital pins with PWM channels then? - you can get much higher frequencies (up to 8 MHz) and very precise duty cycles. This isn't possible when you are relying upon an interrupt to do this for you.
    – Nick Gammon
    Jan 19, 2016 at 0:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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