I learned in school that typical servos use a simple PWM system to control a servo. To do this, we would generate a 1000ms pulse to put the servo at 0 degrees and 2000ms pulse to set it at 180 degrees. Simple basics, right?

I recently tried configuring my HS-311 with these values and I found the servo moving less than 90 degrees. I switched to the Servo.h library and it worked fine. I peeked at Servo.h file and found the following:

#define MIN_PULSE_WIDTH       544     // the shortest pulse sent to a servo  
#define MAX_PULSE_WIDTH      2400     // the longest pulse sent to a servo 
#define DEFAULT_PULSE_WIDTH  1500     // default pulse width when servo is attached

544? 2400? Where are these numbers coming from?

I looked at an old datasheet for this servo and found


A bit hard to tell what does numbers mean but they are definitely not 1000 to 2000!

Then I took a look at the specs on servocity.com and I see:

Max PWM Signal Range    575-2460μsec

This matches up with the Servo.h source code!

What's going on here? Do manufacturers normally move outside of the 1000us-2000us range? These values that I see far exceed what I'd think are acceptable tolerances. Please help me figure out where these numbers came from!

  • 1
    IIRC the first models of such servos were available in the 70s, about 50 years ago. At least one manufacturer used low pulses in contrast to other brands. The pulse width range was not standardized, too. So these variations can be historically necessary, or by the inevitable different quality of products, or simply trying to go to the limits. But since I'm no expert, this is just a comment, not an actual answer... You might want to start a research on the matter. ;-) Jun 13 at 13:02
  • 1
    You may want to change this to "Why does Servo..." or something to that effect. Most of the people reading the current title will probably think that it's about analogWrite().
    – timemage
    Jun 13 at 16:27


Your Answer

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

Browse other questions tagged or ask your own question.