# What determines if a battery is charging or discharging in a circuit?

I have a basic understanding of DC circuits from high school and university physics courses, but those courses only covered circuits that discharge batteries.

I'm trying to build an rudimentary electrical system for the inside of a trailer. It'll be used for a few LEDs for lighting, USB ports for device charging, and an inverter for a few 110v outlets. The system will be powered from its own lead-acid battery (not charged by the car's alternator), that's chargeable via a solar panel on the roof, or by plugging it in.

I have no experience in this domain, and couldn't find the information on this (perhaps I just can't think of the right keywords to google). Fundamentally, what determines if a battery is being charged in a circuit, vs being discharged? For example, how can I ensure that if the system is plugged into a mains outlet, that the energy comes from the wall plug and not the battery?

• Sounds to me as though this is close to the same as any off-grid solar power system. If you put "off grid solar system diagram" into google and go to "images", you should see plenty examples to study. Then, I think, you can refine your questions a little better.
– jonk
Apr 1, 2019 at 2:57
• @jonk Perfect! That's exactly what I was looking for Apr 1, 2019 at 3:01
• Glad I was able to point in the right direction! :)
– jonk
Apr 1, 2019 at 3:02

The direction of current through the battery determines whether it is charging or discharging.

The battery is trying to push current in a particular direction. If the current flows in that direction, the battery is discharging. If the current flows in the other direction, the battery is charging.

It is a little bit like a spring or a clockwork toy. When you have a spring, it tries to push in a particular direction (longer or shorter). If the spring moves in that direction, then it's discharging. If you push the spring in the opposite direction, it's charging.

What determines the direction of current? You'll have to solve the circuit to find that out. In general, since the battery is connected in parallel to the charger, the battery charges if the charger is trying to output a voltage which is greater than the battery voltage.

simulate this circuit – Schematic created using CircuitLab

It is common practice to have a charging source, battery and load all connected in parallel.

If the charging source can provide more current than the load requires, the excess current will be used to charge the battery.

If the charging source cannot deliver enough current to supply the load, the battery will discharge, providing the extra current required.

The battery will switch between charging and discharging automatically as the load demand and charge source capability vary.

• That makes sense. Does this even apply to the solar panel? If I understand correctly, current draw is determined by resistance. What's the resistance of a solar panel like? Does it draw current if it's dark, and the battery has a higher voltage than the output of the panel? What happens if a solar panel draws current? (I understand they're giant diodes, so there might not be any flow at all, but I'm not sure.) Apr 1, 2019 at 3:01
• The solar panel regulator should prevent reverse flow into the solar panel. Apr 1, 2019 at 3:09