ECParts Toolkit LogoECParts Toolkit

PWM Low-Pass Filter Calculator

Use this calculator to estimate PWM-to-voltage behavior through a first-order RC low-pass filter, including average voltage, carrier attenuation, exact steady-state ripple, harmonic components, and settling time.

This page is intentionally different from a generic RC low-pass calculator: carrier attenuation is reported separately from exact PWM ripple because PWM is a non-sinusoidal waveform with harmonics.

Engineering tool

PWM Low-Pass Filter Calculator

Analyze filtered PWM average voltage, first-order RC cutoff, carrier attenuation, exact steady-state ripple, settling time, and harmonic components.

Parameter panel

%
1-50

Result console

Average Output
2.5 V
Steady-State Vmin
2.4375 V
Steady-State Vmax
2.5625 V
Ripple p-p
124.974 mV
Ripple / Full Scale
2.499%
Ripple / Average
4.999%
PWM / fc Ratio
62.8319
Carrier Attenuation
35.9647dB
Exact PWM RC ripple steady-state details
Ton50 µsHigh interval duration
Toff50 µsLow interval duration
High decay a0.95122942exp(-Ton/tau)
Low decay b0.95122942exp(-Toff/tau)
Average invariant2.5 VDC gain is unity; this is not assumed from (Vmin+Vmax)/2
PWM harmonic component table
nFrequencyInput PeakFilter GainOutput Peak
110 kHz3.1831 V0.01591350.6542 mV
220 kHz0 V0.0079570 V
330 kHz1.061 V0.0053055.6289 mV
440 kHz0 V0.0039790 V
550 kHz636.6198 mV0.0031832.0264 mV
660 kHz0 V0.0026530 V
770 kHz454.7284 mV0.0022741.0339 mV
880 kHz0 V0.0019890 V
990 kHz353.6777 mV0.0017680.6254 mV
10100 kHz0 V0.0015920 V

Formula reference

PWM RC Low-Pass Formulas

The V1 model uses an ideal two-level PWM source, first-order RC low-pass filter, output across the capacitor, and high-impedance load.

VAVG = D x VH + (1 - D) x VLtau = RCfc = 1 / (2πRC)H(jw) = 1 / (1 + jwRC)|H(f)| = 1 / sqrt(1 + (f/fc)^2)Carrier gain dB = 20log10(|H(fPWM)|)Carrier attenuation = -20log10(|H(fPWM)|)a = exp(-Ton/tau), b = exp(-Toff/tau)Vmin = [VL(1-b) + b VH(1-a)] / (1 - ab)Vmax = VH + (Vmin - VH)aVripple_pp = Vmax - VminSettling time = -tau ln(error fraction)An = 2(VH-VL)|sin(nπD)|/(nπ)

Variable definitions

VH
PWM high voltage
VL
PWM low voltage
D
duty cycle as a 0 to 1 fraction
fPWM
PWM carrier frequency
R
series resistance
C
shunt capacitance
tau
RC
fc
first-order cutoff frequency

PWM Low-Pass Formula Audit

PWM low-pass formula audit
PWM Average FormulaVAVG = D x VH + (1 - D) x VL
Duty ConventionUI accepts percent; internal D = duty% / 100.
RC TopologySeries R, shunt C, output across capacitor, high-impedance load.
Cutoff Formulafc = 1 / (2πRC)
Time Constanttau = RC
Transfer FunctionH(jw) = 1 / (1 + jwRC)
Carrier AttenuationCarrier gain is |H(fPWM)|; attenuation is -20log10(|H|).
Exact Ripple ModelPeriodic charge/discharge recurrence solves steady-state Vmin and Vmax.
Steady-State Vmin[VL(1-b) + b VH(1-a)] / (1 - ab)
Steady-State VmaxVH + (Vmin - VH)a
Ripple DefinitionVripple_pp = Vmax - Vmin
Average PreservationIdeal unity-DC-gain RC output average equals PWM input average.
Settling Formulat = -tau ln(error fraction)
Harmonic ConventionPeak sinusoidal amplitude An = 2(VH-VL)|sin(nπD)|/(nπ).
Load AssumptionHigh-impedance load; finite load is not modeled in V1.
Source AssumptionIdeal PWM source; driver output resistance is not included in V1.

Worked Examples

5 V, 50%

Known: VH = 5 V, VL = 0 V, D = 50%

VAVG = 2.5 V.

3.3 V, 25%

Known: VH = 3.3 V, VL = 0 V, D = 25%

VAVG = 0.825 V.

Nonzero low level

Known: VH = 5 V, VL = 1 V, D = 25%

VAVG = 2 V.

RC time constant

Known: R = 10 kΩ, C = 100 nF

tau = 1 ms.

RC cutoff

Known: tau = 1 ms

fc = 159.155 Hz.

PWM ratio

Known: fPWM = 10 kHz

fPWM/fc = 62.8319.

Carrier gain

Known: fPWM/fc = 62.8319

|H| = 1/sqrt(1 + ratio²).

Carrier attenuation

Known: 10 kHz PWM through 10 kΩ / 100 nF

Carrier attenuation is about 35.96 dB.

0% duty

Known: D = 0

Output equals VL and ideal ripple is 0.

100% duty

Known: D = 1

Output equals VH and ideal ripple is 0.

Exact ripple

Known: 50% PWM

Vmin and Vmax are solved from RC recurrence, not a sine approximation.

Period recurrence

Known: Steady-state solution

The next-period Vmin returns to the same value.

Average invariant

Known: Periodic RC waveform

The integrated output average equals PWM average.

Ripple design

Known: Target ripple

Minimum RC is solved then verified with the exact model.

Carrier design

Known: 40 dB target

RC is solved so fPWM response is approximately -40 dB.

99% settling

Known: First-order RC

t = 4.60517 tau.

99.9% settling

Known: First-order RC

t = 6.90776 tau.

50% harmonics

Known: D = 50%

Even harmonics cancel in the ideal Fourier model.

Frequency units

Known: 1000 Hz and 1 kHz

Both produce the same carrier response.

Log sweep

Known: 50 points

Rows remain finite, ordered, and bounded.

PWM Average Voltage

Average voltage depends on duty cycle and high/low levels, not only the supply rail.

PWM DAC

Filtered PWM can approximate analog voltage, but ripple, settling, noise, and resolution limit performance.

Carrier Attenuation

Carrier attenuation is filter gain at fPWM and should not be called total ripple.

Exact Ripple

First-order RC ripple follows exponential charge and discharge during each PWM period.

Settling Time

Lower cutoff reduces ripple but slows response to duty-cycle changes.

Harmonics

PWM contains harmonics; duty cycle controls which harmonics are strong or canceled.

Load Effects

Finite load impedance changes DC gain, effective resistance, cutoff, and ripple.

PWM Resolution

PWM frequency and timer resolution often trade off in microcontroller hardware.

Common Mistakes

Using VCC x duty and ignoring a nonzero low level.
Forgetting to divide duty percent by 100.
Treating PWM as a sine wave.
Treating carrier attenuation as total ripple.
Treating fundamental amplitude as ripple peak-to-peak.
Assuming (Vmin + Vmax) / 2 is the exact average.
Setting fc too high and getting too much ripple.
Setting fc too low and getting slow settling.
Ignoring load impedance and source resistance.
Using 10log10 for voltage gain.
Assuming 0% and 100% duty still have PWM ripple.
Ignoring harmonics and PWM timer trade-offs.

Support reference

FAQ

How do I convert PWM to an analog voltage?

Use a low-pass filter so the RC network passes the DC average while attenuating the PWM carrier and harmonics.

How do I calculate PWM average voltage?

For high level VH, low level VL, and duty D, VAVG = D x VH + (1 - D) x VL.

How do I choose R and C for a PWM low-pass filter?

Choose R and C from the required ripple, carrier attenuation, settling time, output impedance, and load constraints.

What cutoff frequency should I use for PWM?

The cutoff is usually well below the PWM frequency when low ripple is needed, but very low cutoff makes output settling slower.

How do I calculate PWM ripple?

This calculator uses the exact steady-state first-order RC charge and discharge solution, not just carrier attenuation.

Is PWM carrier attenuation the same as ripple?

No. Carrier attenuation is the filter gain at fPWM. Total ripple depends on the PWM waveform, duty cycle, and harmonics.

How does PWM frequency affect ripple?

For the same RC values, higher PWM frequency generally lowers ripple because the capacitor has less time to charge and discharge each cycle.

How does duty cycle affect ripple?

Duty cycle changes both the average voltage and harmonic content. At ideal 0% or 100% duty, ripple is zero.

How do I reduce PWM output ripple?

Use a lower cutoff, higher PWM frequency, higher-order filter, buffer, or true DAC when the settling trade-off becomes unacceptable.

How do I calculate RC settling time?

For a first-order RC response, t = -tau ln(error fraction). A 99% settling target is about 4.605 tau.

Why does a lower cutoff make the output slower?

Lower cutoff means a larger RC time constant, so the output changes more slowly after duty-cycle updates.

Do I need a second-order filter for PWM?

A second-order filter can provide more carrier rejection for a given response speed, but component tolerance and stability should be checked.

How does load impedance affect a PWM RC filter?

A finite load appears in parallel with the capacitor and changes DC gain, cutoff frequency, and ripple. V1 assumes high load impedance.

When should I use a DAC instead of filtered PWM?

Use a DAC when ripple, settling time, resolution, noise, or update-rate requirements exceed what filtered PWM can meet.

Engineering Disclaimer

This calculator uses an ideal first-order RC model with ideal PWM high and low levels and high-impedance load. It does not model finite load impedance, PWM driver resistance, capacitor ESR/leakage, op-amp buffers, ADC sampling behavior, EMI, or real microcontroller timer limitations. Validate critical analog outputs with circuit simulation and measurement.