PWM & Servo Calculator – Frequency, Duty Cycle, Servo Pulse Width, ESC Throttle
Frequency
Duty Cycle
PWM & Servo Calculator — Frequency, Duty Cycle, Servo Angle, and ESC Throttle
This tool calculates PWM (Pulse Width Modulation) signal parameters for embedded systems, servo motors, and ESC (Electronic Speed Controller) control — all in your browser without sending any data to a server. Three modes cover the most common use cases in embedded development and robotics: PWM Frequency to compute period and high/low times from frequency and duty cycle; Servo Angle to convert a target angle into the exact pulse width your servo expects; and ESC / Throttle to map a throttle percentage to the correct pulse-width range for your speed controller.
All formulas are based on established electrical engineering definitions and the RC industry standards that have defined servo and ESC interfaces for decades. There are no empirical approximations or heuristics — every result is exact for the parameters you enter. The only input-dependent judgment the tool makes is flagging values outside safe operating ranges (such as servo frequency above 333 Hz or ESC pulse width below the standard arming threshold).
Typical users include: embedded firmware developers configuring STM32 or ESP32 PWM timers; drone builders calibrating ESCs and flight controllers; robotics engineers mapping servo travel ranges; and students learning PWM fundamentals interactively.
How to Use — Step by Step
PWM Frequency Mode
- Enter your target frequency (e.g. 50 Hz for a servo, 8000 Hz for an STM32 default)
- Adjust the duty cycle slider or type a percentage (e.g. 50% for symmetric waveform)
- Read Period, High Time, and Low Time — these map directly to timer register values
Example — STM32 timer at 1 MHz clock for servo control:
- Frequency: 50 Hz → Period: 20.000 ms → ARR = 20000
- Center position (1500 µs) → CCR = 1500
- Full range: CCR = 1000 (min) to CCR = 2000 (max)
Servo Angle Mode
- Check your servo datasheet for min/max pulse width (standard: 1000–2000 µs; wide-range: 500–2500 µs)
- Enter those values in the Min Pulse and Max Pulse fields
- Drag the angle slider or type your target angle (0–180°)
- Pulse Width is the value to pass to servo.writeMicroseconds() or the equivalent register
Example — Servo at 45°, standard range 1000–2000 µs:
pulse = 1000 + (45 / 180) × (2000 − 1000) = 1000 + 250 = 1250 µs
Duty cycle at 50 Hz: 1250 / 20000 × 100 = 6.25%
ESC / Throttle Mode
- Run ESC calibration on your hardware first to determine its min/max pulse range
- Enter those calibrated values (typically 1000–2000 µs) and the control frequency (typically 50 Hz)
- Set throttle percentage to verify the pulse width at each operating point
- Use Pulse Width to verify against an oscilloscope or logic analyzer during debugging
PWM Fundamentals — Period, Frequency, and Duty Cycle
A PWM signal alternates between a HIGH state and a LOW state at a fixed frequency. The period (T) is the time for one complete cycle: T = 1 / f. The duty cycle defines what fraction of that period the signal stays HIGH. A 50 Hz signal at 50% duty cycle has a 20 ms period with 10 ms HIGH and 10 ms LOW.
Key formulas:
Period [ms] = 1000 / frequency [Hz]High time [µs] = period [µs] × duty_cycle / 100Low time [µs] = period [µs] × (1 − duty_cycle / 100)Duty cycle [%] = high_time [µs] / period [µs] × 100
Common PWM frequencies by application — knowing the right frequency before starting firmware configuration saves significant debugging time:
| Frequency | Period | Application |
|---|---|---|
| 50 Hz | 20 ms | Standard analog servo, traditional ESC (RC car/boat/drone) |
| 100–333 Hz | 3–10 ms | Digital servo (Futaba, Hitec D-series, Savöx), FPV flight controller servo output |
| 490 Hz | 2.04 ms | Arduino Uno default (pins 3, 11) — too fast for analog servos, use Servo.h instead |
| 1 kHz | 1 ms | Oneshot125 ESC protocol (analog PWM variant) |
| 8 kHz | 125 µs | STM32 TIMx default, motor driver PWM carrier, LED dimming |
| 20–100 kHz | 10–50 µs | BLDC motor driver switching (not signal control), DC-DC converter |
Servo Pulse Width — 1000 µs to 2000 µs Standard
Hobby and industrial RC servos use a 50 Hz PWM signal where the pulse width (high time) encodes the commanded angle, not the frequency or duty cycle percentage. This standard was established by the RC industry in the 1970s and has remained unchanged, making it one of the most durable hardware interfaces in electronics.
Standard angle-to-pulse mapping:
1000 µs → 0° (full left / minimum)1500 µs → 90° (center / neutral)2000 µs → 180° (full right / maximum)
Formula: pulse [µs] = min_pulse + (angle / 180°) × (max_pulse − min_pulse)
Common servo pulse ranges — check your datasheet:
| Servo Type | Min Pulse | Max Pulse | Max Freq | Example Models |
|---|---|---|---|---|
| Standard analog | 1000 µs | 2000 µs | 50 Hz | Tower Pro MG996R, Futaba S3003 |
| Wide-range analog | 500 µs | 2500 µs | 50 Hz | Hitec HS-5685MH, many industrial servos |
| Digital high-speed | 1000 µs | 2000 µs | 333 Hz | Futaba BLS173SV, Hitec D-series |
| Arduino Servo.h default | 544 µs | 2400 µs | 50 Hz | Servo.h: write(0°)=544 µs, write(180°)=2400 µs |
The tool highlights the pulse width in orange when it falls outside the 500–2500 µs safe operating band, which indicates the commanded angle is approaching the hardware's mechanical limits.
ESC Throttle and PWM — Calibration and Mapping
Electronic Speed Controllers (ESCs) for brushless motors use the same 50 Hz PWM standard inherited from RC servos, where pulse width controls motor speed instead of angle. The key practical difference is that ESCs require calibration before use: the ESC must learn what pulse widths your transmitter or flight controller sends for 0% and 100% throttle.
ESC throttle mapping:
1000 µs → 0% throttle (motor stopped / arm signal)1500 µs → 50% throttle2000 µs → 100% throttle (full power)
Formula: pulse [µs] = min_pulse + (throttle% / 100) × (max_pulse − min_pulse)
The ESC/Throttle tab warns when the computed pulse drops below 900 µs (risk of invalid signal / damage) or exceeds 2100 µs (out of standard range). Most ESCs arm by holding the min pulse for 2+ seconds at power-on.
Modern digital ESC protocols (DSHOT150/300/600/1200, Oneshot125) bypass PWM timing entirely and transmit digital throttle values over the same wire. They are immune to timing noise and require no calibration, but they need compatible firmware on both the flight controller and ESC. For classic robots, RC vehicles, and any hardware without DSHOT support, standard 50 Hz PWM remains the universal interface.
Embedded Systems — Timer Configuration for STM32 and Arduino
Translating PWM calculator results into hardware timer register values is the most common embedded use case. The process is the same across all ARM Cortex-M MCUs:
STM32 TIM register mapping (1 MHz timer clock, servo at 50 Hz):
- ARR (auto-reload register) = Period [µs] − 1 = 20000 − 1 = 19999
- CCR for 0° (1000 µs) = 1000
- CCR for 90° (1500 µs) = 1500
- CCR for 180° (2000 µs) = 2000
- Prescaler = SystemCoreClock / 1,000,000 − 1 (to get 1 MHz tick)
Arduino Servo.h vs. bare PWM:
servo.writeMicroseconds(pulse_us)— use Pulse Width directly from this toolservo.write(angle)— maps 0–180° to 544–2400 µs internally (not 1000–2000 µs)- For precise control, always use
writeMicroseconds()with the pulse value from the Servo Angle tab - Arduino analogWrite() on standard pins operates at 490 Hz — do NOT use it for servos
For ESP32, use the LEDC peripheral (ledc_set_duty) with duty resolution 16-bit and frequency 50 Hz. The duty value = pulse_us × 65536 / period_us. For Raspberry Pi Pico (RP2040), use the PWM slice with wrap = 20000 and level = pulse_us (at 1 MHz tick rate).
Frequently Asked Questions
What PWM frequency should I use for a servo?
50 Hz for standard analog servos. Digital servos can accept 100–333 Hz for faster response. Check your servo datasheet — exceeding the rated control frequency overheats the servo's internal driver circuit and can cause permanent damage. If you do not have a datasheet, use 50 Hz.
Why does my servo only move to ~170° instead of 180°?
Most servos have mechanical end-stops slightly inside the theoretical range to protect the gears. Additionally, 180° assumes exactly 1000–2000 µs range; if your servo's true neutral is not at 1500 µs, the effective travel shifts. Carefully widen the range to 900–2100 µs, 1° at a time, but never force the servo against a mechanical stop — you will strip the gears.
What is the difference between servo PWM and DSHOT?
Standard PWM encodes throttle as pulse width (1000–2000 µs) and requires hardware timer precision and ESC calibration. DSHOT is a fully digital protocol that sends an 11-bit throttle value as serial data — no timing calibration needed, immune to electrical noise, and carries telemetry. DSHOT is now standard for FPV drones (Betaflight) but requires compatible ESCs. For robotics servos and RC vehicles, standard PWM remains the universal interface.
My ESC doesn't respond or won't arm — what should I check?
First verify PWM frequency: most ESCs require exactly 50 Hz. Then check the pulse width — if the signal is outside the ESC's calibrated range (usually 1000–2000 µs), it will not arm. Most ESCs need to see the minimum pulse (1000 µs) for at least 2 seconds at power-on to arm. Use the ESC/Throttle tab to confirm the pulse width at 0% throttle matches your ESC's specifications.
Can I use this calculator for STM32 or Arduino timer setup?
Yes. Use PWM Frequency mode. The Period result gives you the ARR (auto-reload register) value basis in microseconds. The High Time result gives you the CCR (capture-compare register) value at your target duty cycle. Multiply both by your timer clock frequency in MHz to get the exact register values. For servo control, set frequency to 50 Hz and read the ARR and CCR values directly.
What is the duty cycle for a standard servo at center position?
At 50 Hz (20 ms period), the center pulse (1500 µs) corresponds to a duty cycle of 1500 / 20000 × 100 = 7.5%. The full range is 5.0% (1000 µs, 0°) to 10.0% (2000 µs, 180°). This is why you should not describe servo position as a percentage duty cycle — the numbers are ambiguous without specifying frequency. Always use pulse width in microseconds when setting up servo hardware.
How do I set SERVO_MIN / SERVO_MAX in ArduPilot or Betaflight?
In ArduPilot, SERVO_MIN and SERVO_MAX parameters map directly to the Min Pulse and Max Pulse values in the Servo Angle tab (in microseconds). RC_TRIM is the neutral pulse (typically 1500 µs). In Betaflight, min_throttle and max_throttle CLI variables correspond to the ESC min/max pulse in the ESC/Throttle tab. Enter your hardware's calibrated range here and copy the result values directly into the firmware.
Why does the Servo Angle tab assume 50 Hz for duty cycle calculation?
The Duty Cycle (at 50 Hz) result in the Servo Angle tab is a reference value for comparison and datasheet verification. Servo duty cycle is conventionally expressed at 50 Hz to make values comparable across different servo specifications. The Pulse Width value is what actually matters for hardware setup — it is frequency-independent and is the value you pass to servo.writeMicroseconds() or the timer CCR register.
Related Tools
- UART Calculator — Calculate UART frame timing (bit period, frame duration, throughput) and baud rate error (UBRR register value, actual vs target baud) for 22 standard baud rates across 24 MCU clock presets. Supports 8×/16× oversampling modes. Runs in your browser.
- Drone Calculator — Calculate drone thrust, TWR, hover throttle, flight time, and battery C-rating safety. Compare up to 4 motor/battery/propeller configurations side by side.
- I2C Calculator — Calculate I2C SCL timing parameters (t_HIGH, t_LOW, t_r, t_f) for Standard, Fast, Fast-plus, and High-speed modes. Compute AVR TWBR register value, actual SCL frequency, and error% for all 4 I2C speed modes with prescaler selection. Runs in your browser.
- Bit Mask Calculator — Build bitmasks visually on an 8/16/32/64-bit grid, generate C #define macros, and apply SET, CLEAR, TOGGLE, or READ operations to register values with bit layout visualization and C code output.
- LLM Token Calculator — Free AI token calculator for GPT, Claude, Gemini, and custom models. Count prompt tokens, compare context window usage, estimate API cost, and keep text in your browser.