Tools / Ideal PWM Average Voltage
How to work out the average voltage of PWM
A pin that is on for part of each cycle gives an average voltage in proportion. That average is what motors and filters respond to.
Vavg = Vs × duty fraction, ideal 0/Vs waveform
Result
- Ideal average
- 2.5 V
- Ideal rms
- 3.536 V
What this leaves out
- Load and filtering determine observed voltage/current; never substitute PWM for a validated regulator.
Step by step
The working with your numbers
- Change the duty cycle to a fraction
D = 50 % ÷ 100 = 0.5 - Average voltage
Vavg = D × Vs = 0.5 × 5 = 2.5 VThe pin is at Vs for D of the time and at 0 V for the rest. - Peak is still the full supply
Vpeak = 5 VEach pulse still reaches the full voltage. Only the average is lower.
See it
Average voltage at every duty cycle
Does the answer make sense?
- OK: At 0 % the average is 0 V, at 100 % it is 5 V; 50 % sits 50 % of the way between.
- OK: A multimeter on DC volts shows this average, because it is too slow to follow each pulse.
- Watch out: To use it as a real analog voltage (for an ADC or op-amp), add an RC low-pass filter with a cutoff well below the PWM frequency.
Common mistakes
- Expecting a steady voltage on an oscilloscope. Without a filter you see full-height pulses.
- Feeding unfiltered PWM into an ADC and reading random values, because each sample lands on a high or low part.
- Assuming an LED's brightness looks linear with duty cycle. Eyes respond roughly logarithmically, so low duty cycles change brightness the most.
Learn it, try it, build it
Calculated, not measured. Check the exact part datasheet and your real circuit before powering anything.
Just need the number? Use the ideal PWM average voltage calculator on Geekobot.
Common questions
What is the average voltage of a PWM signal?
Duty cycle × supply voltage. A 5 V pin at 50 % duty averages 2.5 V; at 20 % it averages 1 V.
How do I turn PWM into a steady voltage?
Pass it through an RC low-pass filter whose cutoff 1 ÷ (2πRC) is at least 10 times below the PWM frequency. A larger RC gives less ripple but responds more slowly.
