· 4 min read
How to Convert Servo Angle to Pulse Width
Manesh Jayawardhana
CIO & Co-founder
A hobby servo takes a repeating pulse and moves to the position that pulse width commands. Roughly 1000 microseconds sends it to one end, 2000 to the other, 1500 to the middle.
The word “roughly” is doing real work in that sentence, and so is the choice of microseconds rather than duty cycle.
Pulse width, not duty cycle
The servo measures the high time of the pulse. That’s it. It doesn’t care how often the pulse repeats, within a fairly wide tolerance.
Duty cycle is the ratio of high time to period. At a 50 Hz frame — a 20 ms period — a 1500 µs pulse is a 7.5% duty cycle. At 100 Hz, the same 1500 µs pulse is 15% duty cycle, and the servo goes to exactly the same position.
Which is why any library or controller worth using works in microseconds. Configure a PWM peripheral in duty cycle terms and change the frame rate, and every commanded position silently shifts — a bug that presents as a servo that used to work.
pulse = min + (angle ÷ range) × (max − min)
For 45° on a 0-180° servo mapped to 1000-2000 µs: 1000 + (45/180) × 1000 = 1250 µs.
The range isn’t standard
1000-2000 µs over 180° is a convention, not a specification.
Many servos accept a wider range — 500 to 2500 µs is common — and travel further. Some digital servos have configurable endpoints. Continuous rotation servos reinterpret the signal entirely: 1500 µs means stop, and values either side mean rotate in a direction at a speed.
So the mapping depends on the specific servo. Check the datasheet, and if there isn’t one, find the mechanical limits carefully by approaching them in small steps.
| Pulse width | Standard servo | Continuous rotation |
|---|---|---|
| 1000 µs | One extreme | Full speed one way |
| 1500 µs | Centre | Stop |
| 2000 µs | Other extreme | Full speed other way |
| Beyond range | Stalls at the stop | Usually saturates |
Stalling is what kills servos
Command a position past the mechanical limit and the servo drives against its end stop. The control loop sees a position error it can’t reduce, so it keeps applying full current.
The motor heats, the gears take the full stall torque continuously, and a plastic gear train can strip in seconds. Even metal gears and a healthy motor won’t survive being held there.
Two protections worth building in. Enforce limits in software — clamp commanded values to a tested safe range rather than trusting the caller. And detach or de-energise the servo when it doesn’t need to hold position, which also removes the buzzing that comes from a servo hunting around its setpoint.
Common mistakes to avoid
- Configuring in duty cycle, then changing the frame rate.
- Assuming every servo uses 1000-2000 µs.
- Finding the mechanical limits by commanding extremes at full range.
- Powering servos from a microcontroller’s regulator — a servo’s stall current will brown out most boards.
- Leaving a servo energised and loaded at a position it can’t quite reach.
How to do it with Servo Pulse Calculator
The Servo Pulse Calculator converts angle to pulse width and timer counts.
- Enter the target angle and the servo’s actual pulse range.
- Read the pulse width in microseconds — that’s what the servo responds to.
- Use the timer count output if you’re configuring a PWM peripheral directly.
- Clamp your commanded range in software, safely inside the mechanical limits.
Other electronics calculators are in the tools directory.
Frequently asked questions
Why does pulse width matter rather than duty cycle?
Because the servo measures the high time of the pulse directly. Change the frame rate and the duty cycle changes while the commanded position doesn’t, which is why controllers work in microseconds.
Do all servos use 1000-2000 µs?
No. It’s the common convention, but many servos accept a wider range and some digital servos differ. Check the datasheet, and find the mechanical limits carefully.
What happens if I command past the limit?
The servo drives against its mechanical stop, drawing high current and heating up. Held there it will strip gears or burn out, so limits should be enforced in software.
Final thought
Work in microseconds and clamp the range in code. Both take a line, and between them they prevent the two failure modes that kill hobby servos.