# What is the proper calculation of duty cycle range for the sg90 servo?

In all specs of this servo that I can find there is a range of 1000-2000ms of duty cycle, for 50 Hz frequency, for the full range of motion. For example:

This should give us a range of 5-10% when sending pulse with:

dc = 5 #[5 - 10]
pwm = GPIO.PWM(pin, 50)
pwm.start(dc)


Why? Because:

dc duration = second in microseconds/frequency*dc percentage


So for example:

1000000/50*0.1 = 2000
1000000/50*0.05 = 1000


Which defines our range. However in practice it's not true. The real dc range is 2.5 - 12.5 and that would translate to:

1000000/50*0.125 = 2500
1000000/50*0.025 = 500


Which can be tested and is even quoted in many places like here:

https://www.raspberrypi.org/forums/viewtopic.php?t=240558#p1468558

So the question is - where am I wrong in my calculations? Why is there a difference?

The servo angle is determined by the pulse width in a 50 Hz PWM signal.

Most servos move to 0 when they receive a pulse 1500 µs long. Generally it is safe to send a servo a pulse in the range 1000 µs to 2000 µs. Generally a 10 µs change in pulse width results in a 1 degree change in angle.

At some point you will reach the limit of rotation. That limit varies between different makes and models of servos. If you try to force a servo beyond its limits it will get very hot (possibly to destruction) and may strip its gears.

The small 9g servos generally have an extended angle range, 180 degrees or more. Typically they accept pulse widths in the range 500 µs to 2500 µs.

Determine a servos limits carefully by experiment.

• So are all these mentioned sources simply wrong by stating that the range 1000-2000µs corresponds to -90 - +90 rotation for this specific servo? Would be fair to say that it is a widespread mistake? Jan 3, 2020 at 10:46
• E.g: ee.ic.ac.uk/pcheung/teaching/DE1_EE/stores/sg90_datasheet.pdf however some other sources seem to be correct, e.g.: servodatabase.com/servo/towerpro/sg90 which describes pulse width range as 500-2400 µs . Jan 3, 2020 at 10:53
• I don't know if it's a mistake at all. I don't own those models of servos so can not check. All I can say is that the unbranded 9g servos I use seem to have an extended range.
– joan
Jan 3, 2020 at 11:52
• The mistake I meant is that a lot of sources claim the already extended range to be 1000-2000, but in reality only half of that range lies there. I tested and only the range of 90 degree lies in the range of 1000-2000 µs, which contradicts like half of datasheets available for that servo. Or maybe are you suggesting that the actual variation between individual units can be as big? I'm just trying to understand this vast difference. Jan 3, 2020 at 12:16
• I don't have those models of servos so I can't comment on their specs. I would not expect the variation between individual servos to be greater then a few degrees and a few tens of microseconds.
– joan
Jan 3, 2020 at 13:09