Problem with a battery (and solar) powered Wemos D1 Mini

Get an extra schottky diode. Looking at my circuit again, it may be necessary to insert a diode going into the TP4056 from the panel. I need to think about it, and do some tests, but will be tied up this weekend.

Alright, but can you elaborate on your concern?

Also, sorry for asking about basics (I assume what I'm about to ask are basics, but I honestly don't know), but can you explain how current would be distributed in a circuit that I shared?
Provided the panel generates >100mA of current, does the load always get the 100mA it needs to operate (this is the actual value the Wemos needs) and the rest goes to the battery? Or is it divided evenly? Or something else?

From the TP4056 datasheet
"No blocking diode is required due to the internal PMOSFET architecture and have prevent to
negative Charge Current Circuit."

A good designer always checks that of course. With a current meter in series with the +wire of the panel. Positive current with sunshine, no negative current when covered.
Leo..

I think I checked this during testing, but just want to be sure. If the voltage drop across the TP4056 during charging is less than the voltage drop across the schottky diode, then it's possible that load current could flow through the charger during partial illumination. That's exactly what the load sharing circuit is supposed to prevent. So I need to see whether current ever flows through the mosfet when the charging LED is lit up. It shouldn't.

In general, the output voltage of a solar panel will rise to the same level as any low-impedance sink it is connected to, such as a load powered by a battery, and will supply as much current as it can at that voltage. That's assuming that that voltage is less than the panels open-circuit voltage at the current level of illumination. If it can supply more current than the sink can absorb, the panel voltage will rise.

So as the sun rises, the panel will supply an increasing share of the load current, at the battery voltage, until it is supplying all of the load current, at which point the voltage will begin to rise. It's at that point that the mosfet needs to turn off to prevent current from flowing back into the battery from the load side.

Alright, but how is the available current distributed between the load (Wemos) and the battery? Is one prioritised over the other, or equally?

Well, if the panel can't supply all the load current needed, then the battery will be supplying the rest, meaning that it's in discharge mode. So both the battery and the panel will be sourcing current, the panel as much as it can, and the battery the rest. If the sun is bright, and the panel can supply all the load current, then it could also supply current back into the battery, which we don't want. That's when the mosfet needs to shut off to prevent that.

I'm going to be out of pocket until late Sunday, so won't be able to reply or test the circuit until then.

Ok, I think we're not on the same page, so let's look at a scenerio with numbers...

The weather is a bit cloudy, and the panel can supply only 150mA at 4.2V. The Wemos+sensor need 100mA to operate correcly. How is the 150mA split?

Does the Wemos get 100mA and the battery is charged with 50mA, or do they both get 75mA?

If the circuit works correctly, the panel will supply 100mA through the schottky diode to the Wemos, and 50mA through the charger to the battery. What we don't want is for the whole 150mA to flow through the charger to the battery and Wemos. I just need to be sure it works correctly. But I just got in after spending all day on the road, and I may not be able to test it today.

1 Like

I was able to do the tests, and my circuit did not work properly. The voltage drop through the charger is less than the voltage drop across the schottky diode, so panel current takes the charger path, which means load current is flowing through the charger. I don't know if this is a critical issue because it should be corrected as the battery becomes fully charged and charger output reaches its 4.2V limit. But to be sure, the solution is to insert another schottky diode between the panel and the charger. That makes the drops equal, or even a little larger going through the charger, so panel current goes around the charger to the load. The revised schematic is shown below:

1 Like

A 6V/5W panel should output 800mA in full noon sun.
Expect 50mA on an overcast day at noon.
A 5watt panel seems way too small for the task, depending on where you live.

Seems like the panel can't supply the current to charge the battery and power the load.
Charging of course takes proirity until the battery doesn't need it anymore.
Until that, voltdrop across the linear TP4056 is only a few hundred mV higher than the battery.

A diode is not the solution. That only looses more power that you don't have.
If you must use that 5watt panel, then mod the charger so it's not charging with 1Amp anymore.
Maybe drop it to 500mA or even 200mA.
Try changing the default 1.2k resistor to 3k3 (360mA).
Leo..

I think he said a 5V panel, not 5W. Anyway, if his load is 100mA, then whatever the panel produces above that can charge the battery.

Well, I guess it depends on how you look at it. If the panel can't provide enough current to power the load, then the battery cant be charging because it has to supply some load current too. So I don't know that priority makes any difference. If panel current supplies some of the load, then the battery will be discharging less. In any case, the battery can't actually be charging until the panel can already supply all of the load current.

I don't think reducing the charge current setting helps. That just increases the time it takes to charge the battery when the sun is out. If you leave it set to 1A, the charger will still charge at a lower current if that's what's available. You don't want to be limiting it to a lower rate if the battery can accept 1A. That's for a linear charger like the TP4056. It would be different for a switching MPPT charger.

It was a 6v 5W panel. I actually dirty tested an MPPT CN3791 charger today with that panel comparing with TP4065 and a 1Ah LiPo battery charged to ~3.75V.

It was full sun and the panel actually managed to perform with max parameters despite it being december and only around 6 celcius.

I simulted clouds using a semi-transparent piece of cloth. With the sun covered, the CN3791 charged the battery with (measured between the panel and the charger) ~90mA while maintaining 4.2V on the charger output.

The TP4065 charged the battery with ~120mA, but the charger output voltage was something around 4V.

Does this mean that the TP acutally performed better?

Not necessarily. Since the TP4056 is a linear charger, a 120mA input current will produce close to a 120mA output current. But the CN3791 is a switching (buck) charger, so you would have to measure the output current to see how it compares to the 120mA of the TP4056.

While the TP4056 appears to be drawing more power from the panel than the CN3791, I think it is the output current that matters in battery charging. The TP4056 could be dissipating a lot more heat, so it's hard to tell which is better from just looking at the input.

I don't know how you deal with load sharing with the CN3791, if you even need to.

Alright, thanks for clearing that up.

It's this little thing - link.
I can't find a schematic for it anywhere though... I'm guessing it requires the load to be connected directly to battery pins in parallel, in which case I'm facing no over-discharge protection and the 4.1-4.2 charge-discharge oscillation when the battery is full (no power path).

Also, wouldn't having a power path interfere with MPPT? The load would lower the voltage on the solar output via the power path, and (in theory) the charger would shut down trying to reduce current to maintain the 6V on the solar output?

A solar panel has loaded and unloaded volts. When unloaded the solar panel V's go up which would trigger your thingy to begin charging.

The battery takes what it wants. Many Lipos are cheaply made. A measure of a LiPo you see on line that's rated for 9000mAh is to look at the shipping weight. Lithium is a metal the more capacity of the battery the more lithium it has in it. Most batteries ship in a standard battery box, so that weight can be accounted for. Now take a look at a 5000mAh battery, The 5000 should be about less then 1/2 the weight of a 9000mAh.

Anyways the battery will take what it wants. Trying to push current into a battery will damage it.

For better LiPo charging results use a BMS.

The CN3791 doesn't have real MPP tracking. Instead, it makes use of the fact that the voltage at the MPP doesn't vary much with illumination. It's typically around 80% of the open circuit voltage. So you have to figure out what that voltage is for your panel, and set the MPP resistors accordingly. The CN3791 will adjust its current draw so as to maintain that input voltage. I assume it does that by adjusting the charging current, but I don't know how that's done.

I think that's right. It would adjust the current it draws so as to keep the input voltage at the desired level, and if there's a power path, and the sun isn't bright, it should reduce charging current accordingly, and even turn off charging completely. But that's what you want it to do, I think.

Another solution to this is using a chip that includes the power path load sharing circuit built-in. Adafruit sells a module that uses the BQ24074 from TI:

https://www.adafruit.com/product/4755

So for a mere $14.95 plus shipping, you don't have to reinvent the wheel. Or you could use the BQ part in your own design provided the QFN package isn't a problem.

But I don't see any cheap modules on Aliexpress or Ebay that use this chip.

I've built a working prototype, and it seems to perform really well. I also used a CN3791 adjusted to 12V, a 12V panel and a Mini360 buck converter to lower the power path voltage to 5V.

I believe it should be safe to use an unprotected cell, as the CN3791 will cut off if overcharging and KA75330 + IRLZ44N should cut the load off if battery output is below 3.5V, preventing over-discharge. Or is quiescent current a factor for the components used here?

However... The Wemos is currently set to go into deep sleep for 10 seconds (will be 2 minutes in the final version), wake up, take a reading from the sensor and return to sleep. I noticed that whenever the Wemos goes to sleep (if the panel has very little sun), the voltage on the input rises to 5V. I believe, since the load in deep sleep is drawing only some uA from a shaded panel, the battery is switching to charging (although with just a tiny amount of current). This causes constant back and forth switching from charging and discharging in clouded conditions. Won't this kill the battery fast?

I guess I would always want there to be protection somewhere, particularly output short protection and over discharge protection.

You mean the panel output voltage rises to 5V? What happens when the Wemos goes to sleep in full sun?

Anyway, I think it's doing what it should do. When the load current drops to near zero, the panel voltage should rise, and it should supply that current. If there's current left over, it will charge the battery if not already fully charged. I don't think that would hurt anything.

Have you tried it using the TP4056?

Next time try a much simpler setup.

  1. 1Ah LiFePo4 battery directly connected to the 3.3volt pin of the WeMos.
  2. 5volt solar panel directly connected via Schottky backflow diode to the battery.
  3. TL431-type shunt regulator, set to 3.5volt, connected to the panel.
    Image of the principle.

I have a similar setup for a 20mA*12H night light running for more than a year now.
Leo..