# Servo Library MAX/MIN Pulse Widths

**URL:** <https://forum.arduino.cc/t/servo-library-max-min-pulse-widths/986863>\
**Category:** Libraries\
**Created:** [April 30, 2022, 12:30pm UTC](https://forum.arduino.cc/t/servo-library-max-min-pulse-widths/986863 "2022-04-30T12:30:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![abg1984](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@abg1984](https://forum.arduino.cc/u/abg1984)\
**Post date:** [April 30, 2022, 12:30pm UTC](https://forum.arduino.cc/t/servo-library-max-min-pulse-widths/986863/1 "2022-04-30T12:30:48Z")

</div>

Hello Arduino Fellows,

I've been experimenting with the Servo Library using a SG92R servo motor and after looking into the code, printing the pulse width with the method "Servo::readMicroseconds()", I've noticed that 0 degrees corresponds to a pulse width of 544 us and 180 degrees to 2400 us. I thought that a servo requires a PWM pulse width of 1 to 2 ms to drive the servo to 0 to 180 degrees with a 20 ms period. So I am confused right now. Would be glad for clarification. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![MicroBahner](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/microbahner/32/238923_2.png) [@MicroBahner](https://forum.arduino.cc/u/MicroBahner)\
**Post date:** [April 30, 2022, 12:57pm UTC](https://forum.arduino.cc/t/servo-library-max-min-pulse-widths/986863/2 "2022-04-30T12:57:11Z")

</div>

> [@abg1984](#):
>
> I thought that a servo requires a PWM pulse width of 1 to 2 ms to drive the servo to 0 to 180 degrees

1 to 2 ms is the nominal value. Many servos also react correctly to pulse widths a little bit shorter or longer. And not all servos have a real moving range of 0...180 degree.  
You can adjust the pulsewidths for 0 and 180 degree in the [servo lib](https://www.arduino.cc/reference/en/libraries/servo/attach/) to your needs.

---

<div class="post-metadata">

**Author:** ![anon73444976](https://avatars.discourse-cdn.com/v4/letter/a/439d5e/32.png) [@anon73444976](https://forum.arduino.cc/u/anon73444976)\
**Post date:** [April 30, 2022, 1:45pm UTC](https://forum.arduino.cc/t/servo-library-max-min-pulse-widths/986863/3 "2022-04-30T13:45:05Z")

</div>

You can change the default minimum and maximum pulse widths in the attach function.

---

<div class="post-metadata">

**Author:** ![abg1984](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@abg1984](https://forum.arduino.cc/u/abg1984)\
**Post date:** [April 30, 2022, 2:10pm UTC](https://forum.arduino.cc/t/servo-library-max-min-pulse-widths/986863/4 "2022-04-30T14:10:22Z")

</div>

Ok, so one may have to find out the limits of the motor by trial and error and drive it accordingly. This would imply that manufacturers of motors in the hobby segment are not strictly following nominal values.

I just programmed Timer1 manually with a 1-2ms pulse and the motor that I have was not rotating fully. But when I used the Servo Lib, it rotated fully with having default values from 544 to 2400us.

---

<div class="post-metadata">

**Author:** ![anon73444976](https://avatars.discourse-cdn.com/v4/letter/a/439d5e/32.png) [@anon73444976](https://forum.arduino.cc/u/anon73444976)\
**Post date:** [April 30, 2022, 2:40pm UTC](https://forum.arduino.cc/t/servo-library-max-min-pulse-widths/986863/5 "2022-04-30T14:40:37Z")

</div>

> [@abg1984](#):
>
> This would imply that manufacturers of motors in the hobby segment are not strictly following nominal values.

Don't forget, a hobby servo is still a man-in-the-loop system.

---

<div class="post-metadata">

**Author:** ![GolamMostafa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/golammostafa/32/239011_2.png) [@GolamMostafa](https://forum.arduino.cc/u/GolamMostafa)\
**Post date:** [April 30, 2022, 4:41pm UTC](https://forum.arduino.cc/t/servo-library-max-min-pulse-widths/986863/6 "2022-04-30T16:41:49Z")

</div>

> [@anon73444976](#):
>
> man-in-the-loop

===\> Human-in-the-loop (HITL)

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [October 27, 2022, 4:41pm UTC](https://forum.arduino.cc/t/servo-library-max-min-pulse-widths/986863/7 "2022-10-27T16:41:49Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
