Problem with charging battery with dual power supply

hello guys
in this circuit a wemos D1 powered by a battery which will charge with 220v AC that regulated to 5v DC to charge the battery and a 5V 1A solar panel that is for charging battery too . i have a question , what happens if both 220v AC and solar panel connected to the circuit?
is there any solution to switch between power supplys for instance when one of them connected the other disconnect?

You cannot charge a lithium battery from a constant voltage , it needs a proper charging circuit , charging whilst supplying a load “ pass through charging” is more complex .
Connecting your power supply directly to the panel could damage it . You can use a relay powered from the mains side of the power supply to disconnect the solar panel when the power supply is “on”

1 Like

It's possible you could insert schottky diodes into the positive ouputs of the AC adapter and the solar panel. Then the one with the highest voltage would supply the charger, or they would share the load. And that would prevent any backflow from one into the other. That would give you about 4.7V going into the charger, or possibly higher than that if it's running on the solar panel. But that should be high enough.

But this design suffers from all of the problems associated with running the load's current through the charger. When the charger has fully charged the battery, it will shut down, which forces the battery to take over when it shouldn't need to. So the battery will cycle between 4.2V and 4.1V. And if the load current is too large, charging may never terminate, which could be bad for the battery.

The solution is normally a load sharing circuit. But the typical load sharing circuit doesn't work with solar panels. So what you have may be the best you can do without getting a lot more complicated.

Do you know the maximum open-circuit voltage of the solar panel when it's in direct strong sunlight?

1 Like

the maximum voltage of solar panel is 6v . as @hammy mentioned the simplest way is using a relay for switching between them or a physical key. But I thought it would be better if I use a better solution

The simplest way would really be a pair of diodes.
That's actually also how an Arduino selects power sources (Vin or USB).
The main issue is backfeeding of one power source to the other - and just adding a diode to each power source stops that from happening. A regular 1N4007 or 1N4148 would do, or if you're worried about the voltage drop use a Schottky type to half that.

I'm curious what environment would require both a solar panel and a battery to back up mains power. I don't recall seeing that setup before.

Anyway, if you set the charge current to 1A, which I suspect a TP4056 module would have by default, then you will probably be ok. The battery will still cycle between 4.2V and 4.1V even when both mains and solar are available, but it should run ok. Just try to have periods when the D1 Mini is drawing less than 100mA so charging can terminate properly.

Thanks guys.
Yes @ShermanP TP4056 can charge up to 1A.
is this circuit ok?
i might use a 1N5822 Schottky diode

another question. Connecting two sources at the same time is not harmful to the battery?

That should work. The diode is fine, but the 1N5820 would give you a slightly lower voltage drop. But either should work.

No. The charger will control what gets through. So it will be a maximum of 1A at no more than 4.2V at the output.

image

And that device is ?? And it’s connected to the load and the battery so won’t charge it correctly
Risking damage

It's a TP4056. They're surprisingly good. (They'd be better on a board of thicker stock and heavier copper - or an aluminum plate with a silpad between.)
I would discourage anyone from operating a circuit while the battery is charging.

A DPDT would take care of that.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.