Servo PWM Angle Calculator: Pulse Width to Degrees
A servo PWM angle calculator converts a PWM (Pulse Width Modulation) pulse width — measured in milliseconds — into a physical rotation angle for hobby and industrial servo motors. The standard RC servo protocol uses a 50 Hz signal (20 ms period) where a pulse between 1.0 ms and 2.0 ms commands the servo horn from 0° to its maximum range (typically 90°, 180°, or 270°). The core formula is: Angle = (Pulse_ms − 1.0) × Range°. Use this calculator when writing microcontroller code (Arduino, Raspberry Pi), calibrating ESCs, debugging servo jitter, or mapping analog inputs to servo positions in robotics and RC projects.
To convert a servo PWM pulse to angle: **Angle = (Pulse_ms − 1.0) × Range°**. Standard RC (1.0–2.0 ms at 50 Hz): 1.0 ms = 0°, 1.5 ms = 90° (center), 2.0 ms = 180°. For a 270° servo with a 1.75 ms pulse: (1.75 − 1.0) × 270 = **202.5°**. In Arduino: `servo.writeMicroseconds(1500)` centers a 180° servo.
When to use this calculator
- Writing Arduino/Raspberry Pi firmware: converting a joystick ADC reading (0–1023) to a PWM pulse width and verifying the expected servo angle before deploying to hardware.
- Robotics arm calibration: confirming that each joint servo receives the correct pulse to reach a target angle (e.g., elbow at 45° requires 1.25 ms on a standard 180° servo).
- RC aircraft/drone setup: mapping aileron, elevator, and rudder trim values (expressed in μs) to exact control surface deflection angles to prevent over-travel damage.
- Pan-tilt camera gimbal programming: calculating pulse widths for both axes so the camera sweeps from −90° to +90° smoothly without hitting mechanical stops.
- Servo ESC calibration: verifying endpoint pulses (1.0 ms = full reverse, 1.5 ms = neutral, 2.0 ms = full forward) on a brushless motor electronic speed controller.
- 3D printer / CNC filament cutter: converting a G-code angle parameter into a servo pulse duration to cut filament at a precise angle.
- Educational electronics labs: teaching students the relationship between duty cycle, pulse width, and mechanical output in PWM-controlled actuators.
Worked example
- Pulse = 1.5 ms, range = 180°
- Angle = (1.5 − 1.0) × 180 = 0.5 × 180 = 90°
- % of range = (1.5 − 1.0) / 1.0 × 100 = 50%
- Result: servo sits at dead center
How it works
3 min readHow to Convert Servo PWM Pulse Width to Angle
The standard RC servo protocol (defined by the original Futaba/JR convention and adopted universally) uses a fixed 50 Hz refresh rate (20 ms frame). The servo horn position is determined solely by the high-pulse duration within that frame.
// Core formula (ms)
Angle (°) = (Pulse_ms - 1.0) × Range°
// Equivalent in microseconds (used in Arduino's writeMicroseconds)
Angle (°) = ((Pulse_µs - 1000) / 1000) × Range°
// Inverse — angle to pulse width
Pulse_ms = 1.0 + (Angle / Range°)
Pulse_µs = 1000 + (Angle / Range°) × 1000
// Standard endpoints:
// Pulse_min = 1.0 ms (1000 µs) → 0°
// Pulse_mid = 1.5 ms (1500 µs) → Range° / 2 (center)
// Pulse_max = 2.0 ms (2000 µs) → Range°Duty cycle (derived value):
Duty_cycle (%) = (Pulse_ms / 20 ms) × 100
// At 1.5 ms: (1.5 / 20) × 100 = 7.5%---
Reference Table: PWM Pulse to Servo Angle
Standard pulse-to-angle mapping for 90°, 180°, and 270° servos (endpoints 1.0–2.0 ms):
| Pulse (ms) | Pulse (µs) | 90° Servo | 180° Servo | 270° Servo | Duty Cycle |
|---|---|---|---|---|---|
| 1.000 | 1000 | 0° | 0° | 0° | 5.00% |
| 1.125 | 1125 | 11.25° | 22.5° | 33.75° | 5.63% |
| 1.250 | 1250 | 22.5° | 45° | 67.5° | 6.25% |
| 1.375 | 1375 | 33.75° | 67.5° | 101.25° | 6.88% |
| 1.500 | 1500 | 45° | 90° | 135° | 7.50% |
| 1.625 | 1625 | 56.25° | 112.5° | 168.75° | 8.13% |
| 1.750 | 1750 | 67.5° | 135° | 202.5° | 8.75% |
| 1.875 | 1875 | 78.75° | 157.5° | 236.25° | 9.38% |
| 2.000 | 2000 | 90° | 180° | 270° | 10.00% |
> Note: Many digital premium servos (Hitec, Savöx) accept extended ranges of 0.5–2.5 ms. Sending pulses outside the rated range forces the servo against its mechanical stop — this can strip gears or burn the driver IC within seconds.
---
Typical Use Cases
Case 1 — Standard 180° servo at center (1.5 ms)
A Tower Pro MG996R commanded with servo.writeMicroseconds(1500) on Arduino:
Case 2 — Extended-range servo (0.5–2.5 ms, 270° travel)
A Hitec HS-785HB winch servo with extended endpoints:
Case 3 — Arduino servo.write(angle) vs writeMicroseconds(µs)
The Arduino Servo library maps write(45) on a 180° servo to ≈ 1250 µs:
servo.attach(pin, 1000, 2000) + writeMicroseconds() instead of write().---
Common Errors When Programming Servos
1. Confusing duty cycle % with pulse width ms — A 7.5% duty cycle at 50 Hz is 1.5 ms, but if someone programs a 7.5 ms pulse (37.5% duty), the servo receives a signal far outside its valid range.
2. Using the wrong frame period — RC servos operate at 50 Hz (20 ms frames). Some digital servos accept up to 333 Hz (3 ms frames). Mixing these periods causes the effective pulse width to be wrong.
3. Ignoring datasheet endpoint variations — Not all servos use 1.0–2.0 ms. Budget servos often clip at 1.1–1.9 ms, giving only 160° of a labeled "180°" servo.
4. Integer truncation in microcontroller code — int pulse = (angle / 180) * 1000 + 1000 with angle = 45 yields 0 in integer math → 1000 µs → 0° instead of 45°. Always cast to float first.
5. Forgetting the horn offset — Even at the mathematically correct pulse, a horn mounted off-center by one spline tooth introduces ±9–18° error (24-spline = 15° increments). The formula gives electrical angle, not mechanical angle.
---
Related Calculators
Frequently asked questions
What is the formula to convert servo PWM pulse width to angle?
The standard formula is: Angle (°) = (Pulse_ms − 1.0) × Range°. For a 180° servo at standard endpoints (1.0–2.0 ms): 1.0 ms = 0°, 1.5 ms = 90°, 2.0 ms = 180°. In microseconds: Angle = ((Pulse_µs − 1000) / 1000) × Range°. Inverse (angle to pulse): Pulse_ms = 1.0 + (Angle / Range°).
What is the standard PWM pulse range for RC servos?
The universally accepted standard is 1.0 ms to 2.0 ms at a 50 Hz refresh rate (20 ms frame period), with 1.5 ms as the center/neutral position. This convention originated with Futaba and JR RC radio systems. Some manufacturers use a wider range of 0.5–2.5 ms for extended travel — always verify in the datasheet before sending pulses outside 1.0–2.0 ms.
Why does the Arduino Servo library sometimes not reach the full 180°?
The Arduino Servo.write(angle) function maps 0–180° to approximately 544–2400 µs by default — not the strict 1000–2000 µs range. Fix this by using servo.attach(pin, 1000, 2000) to explicitly set min/max microseconds, or use servo.writeMicroseconds() directly with your calculated pulse for exact control.
How do I calculate the pulse width for a specific angle?
Use the inverse formula: Pulse_ms = 1.0 + (Angle / Range°). Example: to command 60° on a 180° servo — Pulse = 1.0 + (60/180) = 1.0 + 0.333 = 1.333 ms (1333 µs). In Arduino code: int us = 1000 + (float(angle) / 180.0) * 1000; then servo.writeMicroseconds(us);
What is the difference between an analog and a digital servo for PWM control?
Both receive the same 1.0–2.0 ms PWM command signal. The difference is internal: analog servos read the pulse once per 20 ms frame; digital servos use an internal processor at 300–400 Hz, delivering faster response, higher holding torque, and less jitter. Digital servos can also accept command updates at up to 333 Hz. The angle formula is identical for both types.
What happens if I send a pulse wider than 2.0 ms to a standard servo?
The servo will attempt to rotate beyond its mechanical end-stop, stalling its DC motor against the physical limit. A stalled hobby servo typically draws 500 mA to over 1 A (vs. ~5–10 mA at no load), which can overheat motor windings, strip plastic gears, and burn the H-bridge driver IC within seconds. Never command a pulse outside the servo's rated range.
Can I use this formula for continuous rotation servos?
No. Continuous rotation (CR) servos have their internal feedback pot removed or bypassed, so the PWM pulse maps to speed and direction instead of angle: 1.5 ms = stop, 1.0 ms = full speed one direction, 2.0 ms = full speed the other. The angle formula is physically meaningless for CR servos.
How accurate is the linear PWM-to-angle relationship in practice?
The relationship is approximately linear across the middle 60–70% of travel but can show up to ±3–5° of non-linearity near the endpoints due to the potentiometer taper curve inside the servo's feedback mechanism. High-quality servos (Savöx, Hitec Karbonite) use linear-taper pots or contactless magnetic encoders to achieve ±1° linearity. For precision applications, calibrate the actual angle at 5+ reference pulses and build a lookup table.
What oscilloscope settings should I use to verify my servo PWM signal?
Set the time base to 5 ms/div (so the full 20 ms frame fits in ~4 divisions), trigger on rising edge, vertical scale to 3.3 V/div or 5 V/div. Use the cursors to measure the pulse width directly in µs — divide by 1000 to get ms, then apply the formula. A 1.5 ms pulse should appear as 1500 µs wide at logic HIGH, followed by 18.5 ms at logic LOW.