this is very interesting question to me that why batteries can be charged while being used as the same time? I designed a buck converter that charges a battery from a solar panel but and when I want to use the battery I would enable a relay that will cut the power off to the battery so I can use it. but using a battery while being charged is possible. What are the principles in this case and would the battery be damaged if being used and charged at the same time?
Figure 1. A very simplified schematic.
How a battery is being charged and used as the same time?
It can't. Either current is flowing into the battery (it's being charged) or current is flowing out (it's being discharged). You can't have current flowing both ways in the one wire.
This is the same as a car electrical system. The alternator charges the battery even though the lights, ignition and radio are switched on. The current into the battery in either case is the difference between the charging current and the load current. The result of the subtraction can be positive or negative with, for example, positive means battery charging and negative being battery discharging.
- V1 is supplying 5 A.
- Load is drawing 6 A.
- Battery current = 5 - 6 = -1 A. It's discharging.
You shouldn't cut off the charge to the battery when you're using it, because you're discharging it while your available power from the solar panel is sitting idle, doing nothing, and it would be better to use it for the load.
You can use it and charge it at the same time, it shouldn't damage it.
However, a battery's type and capacity should be taken into account along with the charging current and the load current, but generally speaking a battery without a load can get overcharged, while a battery disconnected from a charger and connected to a load gets discharged sooner and can get too low. Both of those scenarios are worse for the batter, and that's why it is better to actually keep charging it while using it.
The main issue here would be the charger's ability to limit its current so it doesn't burn under too much load.
A battery doesn't really know and care about being charged and used at the same time.
What it "cares" about is the voltage across its terminals.
When the voltage applied to it is higher than its own, it will be accepting charge.
When its own voltage is higher, it will be losing charge.
You should only worry that the current being used by a load is lower than the current coming to the battery from the charger connected to the solar panel.
It is about striking balances. How to achieve all this? Well, the devil's in the details.
It takes some time and effort (and knowledge) to figure out and calculate, but it shouldn't be too hard.