Published 2026-04-17
This guide provides the exact formula to calculate the duty cycle for anyservomotor, enabling precise angular positioning. Using standard PWM (Pulse Width Modulation) signals, the duty cycle determines theservo's shaft angle. Below, you will find the verified formula, step-by-step calculation methods, and real-world examples—no brand names, only engineering fundamentals.
The duty cycle for aservois derived from the required pulse width and the fixed PWM period:
Duty Cycle (%) = (Pulse Width (ms) / PWM Period (ms)) × 100%
For standard analog and digital servos, the PWM period is20 milliseconds (ms), corresponding to a frequency of 50 Hz.
These values are industry-standard for the vast majority of hobby and industrial servos.
If you need an angle θ between 0° and 180°,the pulse width is calculated using linear interpolation:
Pulse Width (ms) = 0.5 + (θ / 180) × 2.0
Then apply the duty cycle formula.
Pulse width = 0.5 + (45/180) × 2.0 = 0.5 + 0.25 × 2.0 = 0.5 + 0.5 =1.0 ms
Duty cycle = (1.0 ms / 20 ms) × 100% =5.0%
Pulse width = 0.5 + (135/180) × 2.0 = 0.5 + 0.75 × 2.0 = 0.5 + 1.5 =2.0 ms
Duty cycle = (2.0 ms / 20 ms) × 100% =10.0%
Pulse width = 1.5 ms (direct from table)
Duty cycle = (1.5 ms / 20 ms) × 100% =7.5%
Combine both steps into one formula:
Duty Cycle (%) = [0.5 + (θ × 2.0 / 180)] / 20 × 100
Simplified:
Duty Cycle (%) = 2.5 + (θ × 10 / 180)orDuty Cycle (%) = 2.5 + (θ / 18)
Verification:
At 0°: 2.5% → (0.5 ms /20 ms)=2.5% ✓
At 90°: 2.5 + 5 = 7.5% ✓
At 180°: 2.5 + 10 = 12.5% → (2.5 ms/20 ms)=12.5% ✓
Standard servos(0°–180°): Use the formulas above.
Continuous rotation servos: Duty cycle controls speed and direction, not angle. A 7.5% duty cycle typically means stop; values below or above cause rotation in opposite directions.
Extended range servos(e.g., 0°–270°): Adjust the pulse width range accordingly (commonly 0.5 ms to 3.0 ms for 270°). Recalculate the linear mapping.
Digital servos: Accept the same PWM signals but can operate at higher frequencies (e.g., 200–333 Hz). Always check the servo datasheet; if not specified, default to 50 Hz.
1. Using the wrong period: A 20 ms period (50 Hz) is standard. Using 10 ms (100 Hz) will cut all duty cycle values in half, resulting in incorrect angles.
2. Miscalculating pulse width limits: Never send pulse widths below 0.5 ms or above 2.5 ms for standard servos. This can cause jitter, overheating, or mechanical damage.
3. Inverting the formula: Duty cycle is (pulse width / period), not (period / pulse width). The latter would give a value >100% and is invalid.
4. Forgetting to convert units: Ensure both pulse width and period are in the same unit (both ms or both µs). 20 ms = 20,000 µs.
1. Verify your servo’s specifications– Locate the datasheet or measure the minimum and maximum pulse widths using an oscilloscope or a servo tester. Do not assume 0.5–2.5 ms without confirmation.
2. Calculate your target duty cycleusing the direct formula: Duty (%) = 2.5 + (desired angle / 18).
3. Implement in code– For example, using Arduino’sanalogWrite()orservo.write(), but for low-level PWM control, compute the compare register value:OCR = (duty_cycle / 100) × timer_top.
4. Test at neutral (90°)first. If the servo does not center at 7.5% duty cycle, adjust the offset in your formula.
5. Gradually test extreme angles– Command 0° and 180° while listening for stalling or buzzing, which indicates pulse width limits are exceeded.
The relationship between servo angle and duty cycle is linear and governed by a single equation:Duty Cycle (%) = (Pulse Width in ms / 20) × 100, where Pulse Width = 0.5 + (θ × 2/180). For quick field calculations, useDuty (%) = 2.5 + (θ / 18). Always confirm your servo’s specific pulse range before deployment. Apply this formula to achieve precise, repeatable angular positioning in robotics, automation, and control systems.
Update Time:2026-04-17
Contact Kpower's product specialist to recommend suitable motor or gearbox for your product.