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

Hello,

I'm trying to reliably power a D1 Mini from solar charged battery according to this video:
436 How to use Voltage Supervisors to protect ESP32, Raspberry Pi, and Batteries - YouTube

I've built an experimental prototype like on this sketch:

Because of the drop on the voltage regulator, I decided the voltage at which the MCU should be switched on should be above ~3.8V.

The voltage divider sends ~3.15v to the supervisor (KA75330), which switches to "on" above this threshold voltage and pulls the Gate pin high of the N-Channel mosfet (IRLZ44n), closing the circuit.

Unfortunately there is something strange going on... When I read the voltage on the MCU, it shows only ~1v until I crank up the buck converter to at least 4.1v. Also, the Gate pin of the mosfet is showing ~1v too until more voltage is supplied.

This of course causes the MCU to freeze and never boot up properly (as described in the video above).

Why is this so? Please keep in mind that I'm still learning about electronics and might not know about some obvious property of the components used. Thanks!

Datasheets:
KA75330
IRLZ44N
MCP1826S

Interesting question, sorry I cannot follow the frizzy picture, an annotated schematic would be a big help. Also I do not watch videos to answer questions. Your Links to technical information on the hardware items is good.

Why the external 3.3volt regulator (without the mandatory caps).
The WeMos D1 mini has AFAIK a better LDO with 125mV dropout at 100mA (ME6211).
Did you try without the external regulator, with +batt connected to the 5volt pin.
(and measure the dropout)

Why change the supervisor voltage (200 ohm + 1k).
The WeMos should work fine from 3volt.

The 6k8 gate resistor could make the fet unstable.
Try one (10k) resistor, and connect the supervisor directly to the gate.
Leo..

I thought it had a AMS1117... Probably because the ESP32 boards have it. Didn't check the schematic... I'm such a newbie. It makes perfect sense to discard the regulator in that case. To my defense, I did add caps in the prototype, but didn't include them in the schematic. :slight_smile:

From my small experience, LiPo powered ESP32 struggle when battery charge falls below 3.7 volts. It puts the MCU into a coma like state where it fails to boot up from deep sleep later after the battery is charged. My supervisor compares to 3.3v and switches on when above. Adding a divider makes it check for 3.85v on the battery charge. I can lower it though to something like 3.7, since the onboard regulator has such a small drop, as you pointed out.

I didn't know you should use 10k for pull-up. Can you share some materials on how to choose correct resistors for that? Thanks

Maybe because of the 1117 regulator's higher dropout especially during the transmit current peaks.
A dual-core ESP32 likely also draws more peak current than a single-core ESP8266.
A reservior cap across the supply might be needed to smooth out those peaks when going to solar.
I use 470uF/6.3volt tantalum at the 3.3volt VCC pin in my bare ESP8266 builds.

Educated guess. You can use almost any value to drive the gate of a fet, but a low value wastes power and a high value makes the fet switch slower. Just seems wise to let the supervisor switch the gate directly to ground.
Leo..

Didn't fix the problem unfortunately. Also, the same voltage (~1v) appears on the Gate of mosfet until more voltage is supplied from the buck converter. As if the KA75330 can't open the transistor to the ground fully. I tried different parts (thought the one used before might be broken), but the problem persists.

The second I disconnect the load everything works as it should.

You mentioned that the switch on the mosfet isn't instantaneous. Maybe that's the problem? Is there a way to solve this? I thought the KA75330 was suppose to rectify that, i.e. either deliver full >3.7 voltage to the mosfet or nothing at all.

Show us a picture of the setup.

Did you already measure dropout voltage of the built-in regulator of the WeMos.
Connect 3.3volt to the 5volt pin, and measure voltage on the 3.3volt pin.
Leo..

It is as you said, the drop on the builtin regulator is ~200mV, so it is a better option. My Wemos however is a clone, so it can handle max. ~150mA because the clones often come with a different package. More info on that here: Reddit - The heart of the internet

It shouldn't be a problem, as my project doesn't seem to use more than 95mA, even when connected to WiFi. Most of the time it uses ESP-Now and connects to WiFi only for OTA updates.

I managed to fixed the issue though. Apparently 2x 0.47mF capacitors on the KA75330 input worked like charm. There is small oscillation when the KA75330 is about to switch on (~3.66v - 3.7v on the input), but it just switches the Wemos on and off and sometimes it even stabilizes keeping it on. I figure it could be fixed with even more capacitors :smiley: . I made around 100 tests of slowly increasing voltage and the Wemos didn't hang on boot even once.

Thank you for all the help!!

I would share a pic of the setup, but it's very messy on the breadboards right now. I'll have to clean it up. Sketch for now:

1 Like

Good to hear your project is back on track.

Must power that sensor from the 3.3volt pin though, not from the V-in pin.
150k is probably a typo :slight_smile:
Leo..

To circumvent the builtin regulator of the sensor right? Or is there some other reason?

Yes it is... Sorry

I think this is the best setup that I can come up with (plus with solar charging).

Here are some insights for posterity...

It works well, but requires full sunlight - the solar panel current output has to be above the the BMS's current limiter or the setting on the TP4056 (via Rprog), whichever is lower. Otherwise the battery will try to draw too much current on lower charge levels and the voltage on the panel will hit rock bottom.

I am going to test the CN3722 MPPT module to see if cloudy conditions can become a viable option.

Important: The default max charging current for TP4056 is 1A. It can be lowered with changing the Rprog resistor on the board, but I think it's better to invest extra cents in using a min. 1000mAh LiIon battery (most can be charged with 1c, =1A in this case), or a 1000mAh LiPoly battery with an integrated BMS. The integrated BMS should have a current limiter set for its battery, but it's better to check the draw before leaving the setup for a longer run outside.

I'm having trouble understanding this. The battery can never draw the panel voltage lower than the battery voltage. The TP4056 will draw current only if its input voltage is above the battery voltage. And the load will be supplied at the battery voltage if the panel can't supply enough current. So what would cause the panel voltage to ever drop below the battery voltage, even in dim light?

I'll just link to where I found this information: https://youtu.be/WdP4nVQX-j0?t=301
I honestly don't know if the power of the panel will drop to 0 or just level with battery voltage (in which case it will stop drawing current). They way I understand that, is that a battery + load may draw too much current without anything limiting that current on the solar's output in order to keep the solar's voltage on a desired leved (and thus retaining power). So, on a bit cloudy day, a 5W 6V solar panel could still be able to produce E.g. 200mA current, but without an MPPT, a battery + load that draws 450mA would gain 0mA. I could be wrong, but that's how I understood that video.

Your charger does not draw a constant current like his electronic load. The TP4056 is a linear charger, and if the battery is connected, the charger will draw current for the battery and the load only if its input voltage (the panel voltage) is higher than the battery voltage. In dim light, it will generate as much current as it can at the battery voltage, and that's the point it will be at on its V/I curve for that level of illumination. That may not be at the MPP, but it won't be at "rock bottom". I'm assuming your battery will power the load adequately by itself. Is that not true?

I'm also assuming that your load current is less than the TP4056 is set to deliver.

Can you provide a link to the BMS? Is its only function to reduce charging current?

What is the dropout voltage of the 3.3V regulator on the D1 Mini?

I still don't understand why you got the low voltages back in the beginning. But at some point you said everything worked properly with the load disconnected. So I wonder if something on the load side is drawing lots of current that it shouldn't.

Sorry to butt in late with all the questions.

I don't know, I'm on the beginning of my journey here :slight_smile: What about this vid? https://youtu.be/37kGva3NW8w?t=323 The author uses TP4056 and still touches on the subject of limiting current. Can you help out?

Correct, it's around 100mA at peaks when the ESP wakes up from deep sleep every 3 min for 5-10sec to deliver sensor readouts.

It's integrated with the battery, so I can't say for sure what particular features it has. You can type "523450 3.7V 1000mAh" into AliExpress and the one will be the most common. All offers claim it has a 2.75v cut-off voltage and a charging current of 0.5c. Don't know if it has an overcharge protection. Here's a picture of it, if that's of any help.

200mV

Adding 2 capacitors between the voltage divider and KA75330 fixed the problem completely. The device is working as intended, the main problem is fixed. I'm in the process of optimizing the solar and battery setups now, so that it charges as fast as it can during brief sun periods in winter (and remains dirt cheap).

Help is never late.

Solar cells will draw current at night. I use a blocking diode to prevent current from flowing from the battery to the solar cells during darkness. Use a Schottky diode for lowered Vdrop.

There is a modification that can be done to the TP4056 so that it does not enter rapid charge discharge cycles (an internet search). Those rapid charge discharge cycles will wear out the battery in 3 or 4 months, my experience.

I finally changed over to using a MPPT charge controller. This one, currently out of stock, handles the motorboating issue and gives maximum charge. Takes the place of a BMS and TP4056.

and can charge LiPo's, LifePo4's, and lead acid batteries.

Great tip! Thanks! I added a 1N5819.

Thanks, didn't know that. I can't find the modification you mention though. All I can find are the ones with adding a potentiometer to lower the current. Can you tell me more on what is supposed to bo modified?

I just managed to order one from a domestic Amazon counterpart :smiley: Should arrive in on Thursday. The drawbacks are it's price (4x the price of TP4056) and very limited stock.

or some such link, the modification is around somewhere.

words I used "tp4056 modification" in a search thingy.

And I had ordered 10 of those MPPT charge controllers.

I almost don't know where to start.

First, I doubt current will flow back through the TP4056 to the panels at night. It doesn't happen on my TP4056. But you should test that before putting in a diode.

The circuit shown in that video #383 does not work with solar panels. He says it does, but it doesn't. In fact, there's a lot wrong with that video, a lot of stuff that just isn't true. And my circuit referenced in post #18 is also only for USB 5V power, not solar panels.

The so-called BMS incorporated into your battery is probably just the normal protection circuit, the same as the one included on your TP4056 module if you have that version. Can you see if one of the chips on the BMS is a DW01?

Well, if it's working the way you want, you may just want to leave it as is. But I still don't understand why you have to have full sun before anything happens.

What I understand from those shared resources, is that the battery degrades with time due to the load being connected directly to it, instead of having a "power path", correct? But from what I see, the module you shared (and many smiliar) also doesn't have dedicated pins to connect the load, so it has no power path either, right?

Will do...

What if we add use a voltage divider + voltage supervisor (e.g. the KA75330) to pull the solar voltage to the gate of the mosfet only if that voltage is >4.2v? Would this work then?

I can't see anything under the tape, but I assume what you say is true. If so, then there is no charging current limiter there, other than an overcurrent protection, which is way above what the solar panel can produce. The battery simply charges with max 450mA when completely depleted, because that's the max it can take, correct? Also, does the TP4056's protection circuit even work, if the the load is connected directly to the battery (according to the schematic), like in most cases?

From this conversion I gather it will degrade the battery fast if left in its current state (no power path). Also I'm swaying towards using some CNXXXX module rather than TP4056, unless you can confirm that using such a module over a TP4056 will have a very little effect when it comes to such small voltages.

Thanks guys for being so helpful with this