PWM → Voltage Calculator

Find the average voltage, ripple and settling time after an RC low-pass filter on a PWM output, to use a microcontroller pin as a simple digital-to-analog converter.

Calculator Electronics Updated Oct 15, 2026
How to Use
  1. Enter the PWM high voltage (the supply, usually 5 V or 3.3 V) and the duty cycle as a fraction (0.5 = 50%).
  2. Enter the PWM frequency.
  3. Enter the filter resistor R and capacitor C.
  4. Read the average output (V × D), the ripple, the filter cutoff and the time constant; allow about 5 time constants for the output to settle after a change.
Input
V
Presets
Filtered Output
V avg
—
Ripple
—
τ
—
fc
—

Worked Example

A 5 V PWM output at 50% duty and 1 kHz feeds a 10 kΩ resistor and 1 µF capacitor. Average = 5 × 0.5 = 2.5 V. The time constant is 10 kΩ × 1 µF = 10 ms, so ripple ≈ 5 × 0.5 × 0.5 × 1 ms ÷ 10 ms = 125 mV peak to peak, and the output settles in about 5 × 10 ms = 50 ms.

Improving it: raising the PWM to 31.25 kHz with the same filter cuts the ripple to about 4 mV without slowing the response.

The common mistake: only making the capacitor bigger. 10 µF instead of 1 µF cuts the ripple to 12.5 mV but takes half a second to settle. Raise the frequency first, then add a second filter stage if needed.

Show Work

Enter values.

Formulas

V avg
Vcc · D
DC output.
Ripple pp
Vcc·D·(1−D)·T / (RC)
Small-ripple approx.
τ
R · C
Time constant.
fc
1 / (2π·R·C)
−3 dB corner.
Rule
fpwm ≫ fc
10–100× for clean.
Settling
5τ
To 99%.

History of PWM DACs

Filtering a pulse-width-modulated signal with a resistor and capacitor has long been the cheapest way to get an analog voltage from digital logic: one output pin and two passive parts, no converter chip. It was common in early digital controllers and hobby computers, and it is still how many microcontroller projects produce a control voltage today.

The key trade-off is always the same: higher PWM frequency lowers ripple, but MCU timer resolution limits how fine the duty cycle can be at high frequencies. 8-bit PWM at 100 kHz needs a 25.6 MHz timer clock (39 ns per step); 10-bit at 100 kHz needs 102 MHz, and 12-bit 410 MHz, which is why high resolution and high PWM frequency rarely come together on simple timers. Most modern MCUs include dedicated PWM peripherals with 10-16 bit resolution and MHz-range operation via timer clock scaling.

For audio-grade performance, oversampled PWM (class-D amplifiers) uses feedback to shape the noise spectrum so ripple falls out-of-band. Single-chip Class-D amps like the TPA3116 implement full PWM + LC filter + feedback in a TSSOP package, delivering 50 W at 90% efficiency from a 24 V supply.

About This Calculator

Enter Vcc (PWM high level), duty cycle (0-1), PWM frequency, and filter R and C. The tool returns average output voltage Vcc × D (the DC component), peak-to-peak ripple Vcc·D·(1-D)·T/(RC) (small-ripple approximation, valid when ripple < 5% of Vavg), RC time constant, and filter corner frequency 1/(2πRC).

Rule of thumb: place the RC corner 10-100× below the PWM frequency so the filter achieves 20-40 dB attenuation at the fundamental. Worst-case ripple is at 50% duty. For higher-quality DACs, cascade two RC sections (second-order rolls off 40 dB/decade) or add an op-amp buffer to isolate the filter from load. Everything runs client-side; no values leave your browser.

Frequently Asked Questions

How does the filter turn PWM into a voltage?

The RC low-pass filter averages the square wave: the capacitor charges while the pin is high and discharges while it is low, settling at the average, Vcc × duty cycle, with a small ripple on top.

How is the ripple estimated?

When the time constant RC is much longer than the PWM period, the ripple is about Vcc × D × (1 − D) × T ÷ (RC). It is largest at 50% duty and shrinks in proportion to a higher PWM frequency or a bigger RC.

What is the catch with a big RC?

Speed. A large time constant smooths the ripple but makes the output slow to follow changes: it takes about 5 × RC to settle. A 10 kΩ, 10 µF filter (0.1 s) needs about half a second.

How can I get less ripple and a fast response?

Raise the PWM frequency (often the biggest win), use a second RC stage or an active (op-amp) filter, which rolls off much more steeply for the same settling time.

Can I draw current from the output?

Only a little: the resistor sets the output impedance, so any load pulls the voltage down. Buffer the filtered voltage with an op-amp follower if it must drive anything.

How do I use the PWM → Voltage Calculator?

Just type your numbers. The answer shows up right away — there is no button to press. Change anything and it updates by itself.

Is it free? Does it work without internet?

Yes to both. It is free with no sign-up, and once the page has loaded it keeps working even with no internet.

Where does my data go?

Nowhere — every calculation runs on your own device. Nothing you enter is uploaded, logged, or stored.

Common Use Cases

Cheap DAC on a Microcontroller

Arduino-style boards without a true DAC can produce a control voltage from analogWrite plus a resistor and capacitor.

Reference and Bias Voltages

Set an adjustable reference for a comparator or op-amp from software.

Motor Driver Speed Inputs

Some drives and LED dimmers take a 0–5 V or 0–10 V control input that a filtered PWM can provide (with an op-amp stage for 10 V).

Audio Experiments

Simple sound output from a microcontroller uses a fast PWM and an RC filter; class-D amplifiers use the same principle with an LC filter.

Last updated: