# Why am I getting a sinewave output from a buck converter with an input of square wave?

I was expecting the output to stay at 1V which is the average value of (2V, 1MHz, 50%) input.

It seems the capacitor is slowly charging to the input peak, and the inductor current is changing based on the difference between input and output voltages.

So in practice, how can a buck converter manage to keep the voltage at average value?

It seems the capacitor gets charged all the way to the peak of the input voltage. (The inductor keeps charging the capacitor until the capacitor voltage gets LARGER than the input peak.)  • Your input is AC. You have to put a constant voltage source in series to make it pulsed DC. Jul 10, 2021 at 8:08

What you have drawn is a buck converter but, more specifically, it's called a synchronous buck converter. The 1N4148 diode brings nothing to the party. These types of buck converter have extremely low losses in the energy transfer to the tuned circuit (a clue to why your output is oscillating).

Also, you have no load on the output hence the Q-factor of the LC circuit is infinite and, the capacitor voltage will continue to oscillate forever. This is what happens with tuned circuits without damping. You apply a step input (be it pure DC or PWM) and the output continues to cycle up and down for all time.

Add a reasonable output load and watch the output voltage stabilize to a constant value. For the values chosen (10 μH and 1 μF), with a 100 Ω load, the output sinewave will decay like this: - A mechanical analogy is turning on a motor that is driving a flywheel via an elastic rope. The flywheel starts turning slowly at first (as the rope starts to twist) but, eventually, as more twists in the rope occur (producing more transmitted force), the flywheel reaches the same speed as the motor.

However, because the elastic rope is still exerting a force on the flywheel (due to it being twisted up by the motor rotations), the flywheel continues to accelerate until it reaches twice the motor speed. At that point the elastic rope becomes full untwisted and no extra force is exerted.

But now, the motor speed is half the flywheel speed and, this situation begins twisting the rope in the opposite direction. This slows down the flywheel until eventually (and momentarily) it stops spinning. The elastic rope is fully untwisted again and, quite naturally, the process repeats forever. Of course, mechanical losses cause the flywheel speed to eventually become constant just like adding a resistive load to your circuit (as recommended).

• Output voltage = flywheel speed
• Input voltage = motor speed
• Flywheel = capacitance
• Elastic rope = inductance
• Twists in rope produce force and force is equivalent to current

It's irrelevant the the input is a 50% duty cycle squarewave - the output capacitor still reaches twice the average voltage of the input. If your PWM was 25% then the output average voltage would be 0.5 volts and the output capacitor peak voltage would be 1 volt and fall to 0 volts cyclically at the same oscillation frequency.

The schematic as drawn right now is not a regular buck converter. The voltage source is not representing the switched MOSFET correctly. The MOSFET in a buck converter is either on or off, but never actively providing zero volt at your "in" node. You also need a load on the output as described in Andy's answer. Just have another look at the buck equivalent circuit: Source: buck converter wikipedia

What you actually build here is nothing more than a regular LC filter with a cutoff frequency of about 50 kHz.

• Ah ok in my schematic the voltage source is providing 0V but in a buck converter, the voltage source actually gets disconnected. I see now thank you so much! But even with your correct circuit, the capacitor is always getting charged. Because the current in inductor is always flowing in clockwise direction, charging the capacitor. So if the load resistor were not there, there is no way for capacitor to discharge. Why would it settle at average voltage? Jul 10, 2021 at 9:06
• What he has drawn is a synchronous buck converter. It is still a buck converter. Jul 10, 2021 at 9:10
• @Andyaka Ah thanks, you are right. The confusing part then is the diode that is still part of the schematic. Jul 10, 2021 at 10:08