DevTools Logo

PWM Duty Cycle & Motor RPM Calculator

PWM Duty Cycle & Motor RPM Calculator

PWM duty, motor speed, RC filtre ve timer register hesaplarını tarayıcıda yapın

PWM ve motor parametreleri

RC filtre

Timer register

About

Client-side PWM calculator: duty cycle is clamped to 0–100%, average voltage uses VCC × duty, motor speed uses an explicit linear no-load approximation, and timer frequency uses clock/(prescaler × (ARR + 1)).

Examples

Half-speed 12 V motor

Input
calculatePwmDutyCycleMotor({ ..., dutyPercent: 50, vccVolts: 12, maxRpm: 3000 })
Output
{ averageVoltage: 6, estimatedRpm: 1500, onTimeUs: 500 @1kHz }

Linear scaling halves both voltage and RPM at 50% duty with a 500 µs on-time.

AVR-style 400 Hz timer

Input
calculateTimer(16_000_000, 64, 624)
Output
{ frequencyHz: 400, resolutionBits: 9 }

16 MHz / (64 × 625 counts) is exactly 400 Hz with 625 steps of resolution.

About this tool

PWM Duty Cycle Motor models drive signals with calculatePwmDutyCycleMotor({ pwmFrequencyHz, dutyPercent, vccVolts, maxRpm, resistanceOhms, capacitanceFarads, clockHz, prescaler, arr }): duty clamps to 0–100, averageVoltage and estimatedRpm scale linearly, on/off times derive from the period, and rcCutoffHz = 1/(2πRC) judges filter ripple. Timer helpers use calculateTimer(clockHz, prescaler, arr) with frequency = clock / (prescaler × (ARR + 1)).

Timer detail is explicit: timer reports the selected prescaler/ARR pair while timerOptions sweeps [1, 8, 64, 256, 1024] at the same ARR, each with resolutionBits = floor(log2(ARR + 1)). A 16 MHz clock with prescaler 64 and ARR 624 yields exactly 400 Hz at 9-bit resolution.

Invalid numerics fall back safely (zero/NaN clock → 16 MHz, unclamped duty → clamped), and the rippleNote flags good filtering when fc is below one-tenth of the PWM rate.

How to use this tool

  1. Set PWM and duty

    Enter pwmFrequencyHz and dutyPercent — 50% at 12 V averages 6 V and half the max RPM.

  2. Size the filter

    Enter resistanceOhms and capacitanceFarads, then compare rcCutoffHz against the PWM rate.

  3. Solve the timer

    Enter clockHz, prescaler, and arr; read frequencyHz plus resolutionBits from timer.

  4. Compare prescalers

    Scan timerOptions across 1/8/64/256/1024 to trade frequency against resolution.

Use cases

Driving DC motors

Predict average voltage and RPM from duty before wiring an H-bridge.

Filtering PWM into analog

Push the RC cutoff a decade below the PWM rate for smooth DAC-like output.

Configuring MCU timers

Pick prescaler/ARR pairs that hit a target frequency with usable resolution.

Common mistakes

Mistake:Forgetting ARR is zero-indexed.

Fix:Frequency divides by ARR + 1 counts, not ARR — ARR 624 means 625 steps.

Mistake:Filtering with fc near the PWM rate.

Fix:Raise R or C until fc sits below PWM/10, or ripple rides through into the motor or analog output.

Mistake:Expecting zero clock to throw.

Fix:Non-positive clocks fall back to 16 MHz — pass an explicit clockHz instead of relying on the default.

Frequently asked questions

What does this tool do?

It models PWM drives with calculatePwmDutyCycleMotor: clamped duty, on/off times, linear average voltage and RPM, RC cutoff with ripple note, plus calculateTimer prescaler/ARR solving with a five-option comparison table.

What does 50% duty give, or 16 MHz / 64 / ARR 624?

50% duty halves supply voltage and max RPM (12 V → 6 V, 3000 → 1500 RPM). The 16 MHz / 64 / 624 timer gives exactly 400 Hz at 9-bit resolution.

Is my motor setup uploaded or stored?

No. Duty scaling, filter math, and timer solving run entirely in your browser.

Why is ripple high, or why did my clock fall back?

Ripple rises when the RC cutoff nears the PWM rate — push fc below PWM/10. Zero or non-finite clocks fall back to 16 MHz instead of throwing, so pass clockHz explicitly.

References & standards