# Why is there a lot of current variation at the output of a buck when a battery is connected at the output?

I am looking to simulate a buck DC-DC that charges a battery pack. In LTspice when I connect a battery at the output there is a lot of current variation, but if I connect a resistive load the current is pretty stable. Is this something that is observed in actual or just in simulation?

This is showcased in the simulations below where there is a 30V supply and the output of buck is set to around 13.6V. You can find the simulation file with battery as load here - Simulation file

Figure 1: Buck with resistive load

Figure 2: Output current of buck with resistive load has about 12mA ripple

Figure 3: Buck with a 9V battery as load

Figure 4: Output current of buck with 9V battery load has about 43A current variation

• The chip or the circuit is not a battery charger. And you have connected a 13.6V voltage supply together with a 9V supply. Commented Oct 11, 2022 at 10:18
• A battery charger provides a controlled current for most of the charge cycle. Some chargers "top off" a battery at constant voltage, but only if the current the battery accepts at that voltage is less than the safe charging current. A constant voltage DC-DC converter is not a sensible battery charger. Commented Oct 11, 2022 at 20:41
• Just "13.6v battery pack" is not enough information to be able to answer the question. What is the battery chemistry and cell layout? What is its C rating? Different battery chemistries have different charging requirements... Commented Oct 11, 2022 at 23:00
• If your end goal is to charge a battery, please stop what you are doing and start figuring out how to do constant current. If that will come later, please replace the battery in your circuit with a resistor. Commented Oct 12, 2022 at 6:26

V2 is an ideal 9 volt source and you are trying to force its output to be 13.6 volts using a powerful switching regulator. There should be no surprise that the ripple current is absolutely massive compared to that when a resistive load is connected. The switching regulator just cannot compete against an ideal 9 volt source and it does its best to win (by pulverising the output node with current) and fails.

Try making the 9 volt source less than ideal with some series resistance and "model" the 9 volt battery more correctly.

• HI Andy, yeh adding a series resistance as internal resistance, the current ripple has reduced but there is still a significant amount of ripple. Do u know a better way to model a battery more accurately. Commented Oct 11, 2022 at 10:55
• @AshiqA Is there any reason why you need to reduce it? Ripple voltage is often a problem (and the battery fixes that all by itself) but ripple current isn't. Commented Oct 11, 2022 at 11:01
• @AshiqA ripple current is because you are transferring energy to the load. If you subtract the valley energy from the peak energy you get the energy transferred to the load per switching cycle. If you then multiply this by the switching frequency you get the average power given to the load. In other words, it is what it needs to be for the power you require to be fed to the load. Modelling the battery is something I'd have to google so, I suggest you do that and see what you come up with. Commented Oct 11, 2022 at 12:32
• For instance, in your 2nd waveform picture I estimate that you are pushing about 140 watts of power into the 9 volt battery. Commented Oct 11, 2022 at 16:26

It depends on the model of the battery. It seems you are using a simple battery model. If it's not a model that simulates a chargeable battery (I'm not sure if it even exists), it only has a small internal resistor in series with an ideal battery in the simulation.

The ideal battery sources as much current as you draw and sinks as much current as you direct to it.

In your scenario, when the voltage of the dc-dc converter exceeds the voltage of the battery, the battery starts to sink the current as much as the converter is providing and is also limited by the simulated internal resistor in the battery model.

You have a buck regulator that can supply a certain amount of current before it drops out. As long as your load doesn't exceed the amount of current your regulator can supply, the output volatage and current will stay stable.

On the other hand, your load is a fixed 9V source. It will consume nearly any amount of current trying to pull down the source to 9V. The load will exceed the current capability of the source and pull just as much current as needed to get it down to 9V. This means the regulator heavily (over)loaded. Take a look at the current in your diagram: The peak current is around 45 Amps, and the target output voltage is still far from being reached. Actually, you are extremely lucky that your virtual simulated inductor didn't saturate (you might want to look up the size of a real existing inductor that is rated for 400µH at 45A!) and the virtual FETs didn't overheat and short out.

Basically, the takeaway from this exercise should be: If you want to charge a battery that can be at 9V, and your target voltage is 13.6V (sounds like a car battery charger), you really want a way to set a limit to the maximum current supplied to your battery, because you charger will blow up otherwise. And if you limited the peak current to a sensible value (like C/10 for a car battery), you should stop worrying about current ripple. The battery doesn't care whether it gets charged at 5A flat, or at a triangle current varying between 0A and 10A. Actually, the triangular current might be slightly better to counter sulfatisation of the battery. The main design criterion of your charger should be that the output voltage is kind-of stable when the battery is fully charged. A fully charge battery poses a notable series resistance the charger, and it has a voltage equal to the set voltage of the regulator. This property is likely already fulfilled on your charger, but the 9V source models a healthy, but completely flat battery that takes any amount current it can obtain. Look up the operating and design principles of a CC/CV chargers for how to design a car battery charger.