Real-time calculation of duty cycle, frequency, average voltage, ripple current, switching loss and LC filter design.
PWM parameters
Input voltage V_in
V
Duty cycle D
%
Switching frequency
kHz
Load current I_out
A
Switch characteristics
MOSFET R_DS(on)
mΩ
Switching time t_r+t_f
ns
Filter design
Inductance L
μH
Filter capacitor C
μF
Results
—
Duty D (%)
—
Average voltage Vavg (V)
—
Frequency f_sw (kHz)
—
Ripple ΔIL (A)
—
Instantaneous current i(t) (A)
—
Speed (rpm)
PWM waveform, current ripple and motor animation
PWM voltageAverage voltage VavgCurrent ripple i(t)2× frequency ghost
Item
Value
Unit
Average output voltage
—
V
Output power
—
W
Ripple current ΔIL
—
A
Ripple ratio
—
%
Switching loss
—
W
Conduction loss
—
W
Total loss
—
W
Estimated efficiency
—
%
Filter cutoff f_c
—
Hz
f_sw / f_c ratio
—
—
Engineer dialogue — "What improves when you raise the frequency?"
🙋 "I hear a higher PWM frequency is better. Why?"
🎓 "A higher frequency means a shorter switching period, so you can use a smaller inductor for the same ripple current – the circuit gets smaller. That is why EV inverters are moving from around 10 kHz with Si IGBTs to tens of kHz with SiC."
🙋 "Then why not make it infinitely high?"
🎓 "Switching loss grows in proportion to frequency. Every time the MOSFET turns on or off, heat is produced in the instant when voltage and current overlap. A few watts at 100 kHz become ten times that at 1 MHz. So the optimum frequency is a trade-off between efficiency and size."
🙋 "I hear a lot about SiC and GaN devices lately. How are they related?"
🎓 "SiC and GaN have switching times (t_r, t_f) several times to ten times shorter than Si MOSFETs, so switching loss drops sharply. EV on-board chargers can run at the 100–200 kHz level thanks to SiC. Lower t_r+t_f from 300 ns to 30 ns in this tool and you will see P_sw fall to one tenth."
Estimated efficiency and motor speed: $\eta = P_{\text{out}}/(P_{\text{out}}+P_{\text{sw}}+P_{\text{con}})$. The speed card uses a simple DC-motor model rated at 3,000 rpm (with $V_{\text{in}}$ applied) with a 0.5 Ω winding resistance: $n = 3000\,(V_{\text{avg}} - 0.5\,I_{\text{out}})/V_{\text{in}}$.
What Is PWM Motor Control?
🙋
What is PWM control? To change a motor's speed, how is it different from simply lowering the voltage?
🎓
Roughly speaking, it is a way of controlling the average power by switching on and off very fast. If you want an average of 6 V from a 12 V battery, for example, you get it by switching on for 50% of the time. Move the "input voltage" and "duty cycle" sliders in this tool and the "average voltage" is computed immediately – try it.
🙋
Really! But doesn't repeated switching make the motor run jerkily?
🎓
Good catch. That is where the inductor and the switching frequency become important. The inductor smooths out abrupt current changes, and if the switching frequency is high enough, neither people nor the motor notice anything but the average. Reduce the "inductance" in the tool and watch how the "ripple current" changes.
🙋
I see! But it says that if the switching frequency is too high, the "switching loss" grows. How do you strike the balance?
🎓
That is the point that gives practitioners the biggest headache. A high frequency lets you shrink the components but increases loss and heat; too low and the ripple grows. The design guide is to keep the ripple ratio (ΔI_L/I_out) within 20–40% while holding the losses within limits. Play with the "switching frequency" and "MOSFET R_DS(on)" in the tool and you can feel the trade-off between conduction loss and switching loss.
Frequently Asked Questions
Check that the input voltage (V_in) is set and is not 0. The duty cycle must also be set within 1–99%. Following V_avg = D × V_in, the result updates automatically once V_in is correct.
Increase the inductance L or raise the switching frequency f_sw. A larger L, however, increases component size and cost, and a higher f_sw increases switching loss, so adjust with the trade-off in mind.
Based on the computed cutoff frequency f_c and the f_sw/f_c ratio (guide 10–20), choose the combination of L and C that meets the load's requirement for permissible output ripple voltage. In the implementation also take the capacitor's ESR into account.
Check whether the switching frequency is too high or the rise/fall time of the switch is set too long. The loss also grows if the input voltage or current is larger than the real design.
Real-World Applications
Motor control in electric vehicles and e-scooters: The battery voltage is controlled precisely with PWM to adjust the motor's torque and speed. Optimising the switching frequency and inductor is essential for efficiency.
Servo control of robot arms: To control position and speed accurately, the duty cycle is varied on a microsecond scale. Keeping the ripple current small so that no vibration is generated is important.
PC CPU power supplies (VRM): On the motherboard, the 12 V input is converted with high efficiency into the roughly 1 V the CPU needs. An advanced application that demands fast response to load changes and ripple suppression.
LED lighting dimming: The brightness of LEDs is varied continuously through the duty cycle. A frequency high enough to be invisible to the eye (several hundred Hz or more) is used, and the filter can sometimes be simplified.
Common Misconceptions and Pitfalls
First, there is the misconception that "the duty cycle decides everything". The average voltage is indeed $V_{\text{avg}}= D \cdot V_{\text{in}}$, but a circuit built on that alone will hurt. Taking 5 V from 12 V, for example, needs a duty cycle of about 42%, but if you casually pick an inductance as small as 1 µH, the ripple current balloons to about 29 A even at f_sw=100 kHz, the motor growls and capacitors overheat and fail. Always check the ripple current in the tool and keep it within 20–40% of the load current – that is the first design rule.
Next, the attitude of looking for a "magic number" for the switching frequency. There are commonly heard values such as 20 kHz (above the audible range) or 100 kHz (smaller components), but they are only starting points. In fact the switching speed $t_r + t_f$ of the MOSFET you use matters a lot. A fast MOSFET with $t_r + t_f = 50ns$ may be fine at 500 kHz, whereas with a cheap 300 ns device $P_{\text{sw}}$ is already large at 100 kHz and the thermal design becomes hard. The professional approach is to vary the frequency in the tool and look for the "sweet spot" where the sum of conduction and switching loss is smallest.
Finally, the gap between simulation and the real hardware. The tool's calculation is ideal. In a real circuit the parasitic inductance of the wiring and the parasitic capacitance of the MOSFET increase the losses; a calculated efficiency of 95% turning out as 85% on the bench is common, and the gap is especially large at high frequency. Once the desk design is done, make it a habit to measure the input/output voltage and current and the FET temperature on the real hardware and compare them with the calculation.
Set the input voltage Vin (e.g. 24 V, 48 V, 400 V)
Enter the duty cycle (1–99%) and the switching frequency (1–500 kHz)
Specify the load current, the MOSFET R_DS(on), the switching time t_r+t_f and the filter L and C; everything is recomputed immediately (there is no calculate button)
The average output voltage Vo=Vin×D, the ripple current ΔIL and ripple ratio, and the switching loss, conduction loss and estimated efficiency are computed automatically. The animation shows the PWM waveform, the inductor current and the speed of a simple motor model
Check the filter cutoff frequency fc=1/(2π√LC) and apply it to the circuit design
Worked Example
Driving a DC motor from a 48 V lead-acid battery: set Vin=48 V, duty cycle D=75%, Fsw=20 kHz and output current Iout=30 A. The average output voltage is Vo=48×0.75=36 V. With an L=100 μH filter the ripple current is ΔIL=(Vin−Vo)·D/(L·Fsw)≈4.5 A. With a FET Rds(on)=0.02 Ω the conduction loss is P_con=I²·R·D=13.5 W, the switching loss (for t_r+t_f=100 ns) about 1.4 W, and from the total loss of about 14.9 W the estimated efficiency is about 98.6%.
Practical Notes
Outside a duty cycle of 5–95% dead time and minimum on-time make real hardware hard to control, so a design that limits the control range is recommended
Raising f_sw increases gate-drive and switching losses (in this tool P_sw is proportional to f_sw); 20–50 kHz is common for industrial DC-motor drives
If the ripple current exceeds 30% of the rated current the risk of inductor core saturation grows, so the L value needs to be reviewed
A switching frequency in the audible range (about 16 kHz or below) causes motor whine, so choose 20 kHz or more where quiet operation is required