Skip to content
Omnikalc

Servo pulse width calculator: which pulse sets which angle?

Enter the target angle, the servo's travel and pulse range and the signal frequency to get the pulse width, duty cycle, timer value and move time.

Updated on
Your inputs
°

Value out of range

°

Value out of range

°

Value out of range

µs

Value out of range

µs

Value out of range

Hz

Value out of range

s

Value out of range

Results

Pulse width to send

1,500 µs

The pulse is inside the servo's range
Duty cycle
7.50%
Compare value for a 16-bit timer at that frequency
4,915
Angle change per microsecond of pulse
0.180 °/µs
Time for the move
0.225 s
Signal period
20.0 ms

A hobby servo moves to the angle encoded in the width of a short pulse, repeated about fifty times a second. To aim it, you need the pulse width in microseconds for the angle you want, and often the matching duty cycle or timer compare value for the microcontroller. This calculator converts a target angle into all three, and estimates how long the move takes.

How the calculation works

  • Pulse width = minimum pulse + angle ÷ full travel × (maximum pulse − minimum pulse)
  • Duty cycle = pulse width ÷ signal period × 100
  • 16-bit compare value = duty cycle × 65,535
  • Resolution = full travel ÷ (maximum pulse − minimum pulse), in degrees per microsecond
  • Move time = angle change ÷ 60° × seconds per 60°

Example

A servo with 180° of travel and a 1,000 to 2,000 µs pulse range is sent to 90° at 50 Hz. The pulse is 1,500 µs, the duty cycle 7.5 % of the 20 ms period, and a 16-bit timer needs a compare value of about 4,915. One microsecond moves the horn 0.18°. Moving from 0° to 90° at 0.15 s per 60° takes 0.225 s.

Why it matters

A wrong pulse range is the most common cause of a jittery or stalled servo. Working out the pulse for each angle lets you set the limits in your code, avoid the end stops and move smoothly between positions. Knowing the move time also tells you how long to wait before the next command in a robot arm or a pan-and-tilt mount.

Good to know

Cheap servos vary from one unit to the next, so the 1,000 and 2,000 µs limits are typical but not guaranteed. Digital servos may accept higher refresh rates, such as 200 or 333 Hz. A servo holding a load draws more current than one at rest, so give it a power supply that is separate from the microcontroller. This tool is for education.

The PWM duty cycle calculator converts a duty cycle into average voltage, the 555 timer calculator sets a pulse width with a resistor and capacitor, and the stepper motor steps calculator handles open-loop positioning.

Frequently asked questions

How does a hobby servo read its position?

A hobby servo reads the width of a pulse that repeats about 50 times a second. A pulse of about 1 ms points to one end of its travel, 1.5 ms to the middle and 2 ms to the other end. The servo's electronics move the horn until its position matches the pulse.

Why does my servo buzz or hit its stops?

Servos differ: some accept 500 to 2,500 µs, others only 1,000 to 2,000 µs. If you send a pulse outside the real range, the servo pushes against its mechanical stop. Find the safe minimum and maximum by moving slowly, then enter them here.

What timer value gives the pulse I need?

The compare value is the share of the period that the signal stays high, multiplied by the timer's top value. For a 16-bit timer that counts to 65,535 over one 20 ms period, 1,500 µs is 7.5 % of the period, or about 4,915 counts.

How long does a move take?

Datasheets give the speed as the time for a 60° turn, typically 0.1 to 0.2 seconds. A 90° move at 0.15 s per 60° takes about 0.225 s. Under load the real time is longer, so leave a margin before the next command.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.