How to safely power an ESP32 with a LiFePo4 battery and charge it

3.6V +/-1.5%
So maybe the one you get is set at 3.654V

I tested my ESP and it continued to work even if 4V where present at the 3.3V

Many people have done that and many have damaged the ESP. You may be lucky with one board but not with another.
It may work today but not a week from now.

If you choose to ignore the specifications, that's up to you.

You did ask how to safely...

and it does not solve the problem of having USB connected at the same time as he 3.3V

1 Like

Thank you, i have missed this in the schematic. I will check the datasheet if this problem is covered.

I have come to terms that I will have to try and learn to design my own PCB and fix those problems anyway. Then i can use an ESP chip directly and forget about the onboard regualtor of the S2-mini (or desolder it) and also cleanly seperate the 5V and 3.3V power paths.
The Arduino MKR Zero schematic also seems like a good starting point to learn how the power paths can be managed, thanks for the hint.

As I understand it now I have two options:

  1. Power the ESP always trough the linear regulator(set something like 2.9V if possible):
    + no problem with voltages from the battery above 3.6V
    + simpler circuit
    - loss of usable battery capacity due to the dropout voltage
    - efficiency loss in the conversion

  2. Directly connect the battery to the ESP
    + higher efficiency
    + more usabel capacity
    - circuit to separate the voltage regulator needed
    - find a way to block voltages above 3.5V without wasting power

I didn't want to seem rude or unthankful and I really apreciate all of your help, I am just a bit frustrated that this "easy" project turns out to be a lot more complicated than i thought :smiley: .

One thing to keep in mind is that with the newer LDOs, when the battery voltage gets down into the dropout range, or even below 3.3V, the regulator may let the output voltage just follow the input voltage on down. Of course you are no longer regulating anything, but since the power source is a battery, it may still work well enough. In my limited experience, this capability is not addressed in datasheets, so there's really no substitute for testing all this stuff in your circuit to see what happens as the battery discharges.

This is not the case. LiFePO4 batteries never output 3.6V. It is the charger that holds that voltage while charging during the constant voltage stage.

LiFePO4 chargers do reach 3.65V while charging but once disconnected the battery voltage is below 3.5V (fully charged at rest 3.4V)

The power path circuitry makes sure the battery is off the charger before being connected to the load. Texas Instruments produces many variants of specialized power-path charger chips for this very application.

There seem to be a big misconception here on the forum about dropout voltage. Simply operating above dropout voltage does not guarantee the the regulator will be in regulation, or that it will meet the specified load amd line regulation speifications.

Do you (or anyone else) have a recommendation for a regulator that may behave like that? Otherwise I am just going to try the AP7215 as used by the MKR Zero.
It would be also interesting if the power loss from the linear regulator would be smaller (or zero) if it no longer has to "regulate" and just passes it trough. This could simplify the circuit.

This matches what I found in my research. But can there be a short time during the switching where the voltage spikes above 3.6V, Or can i just buffer this with a capacitor?

From my quick search I just found regular battery charging chips, could you point me to where i could find those?


Isn't the dropout voltage simply the minimum needed difference between the input and the output voltage? This graph shows that I will need a higher difference (3.3V + Vdo) if i want to pull more current, so I will have to consider this for the implementation.
So this would indeed lead to a loss of usable battery capacity due to the voltage requirements.

No. There is no industry standard definition for dropout voltage or how to measure it. You must read the datasheet for your particulator regulator to determine the proper operating conditions. Typical values and graphs are for design guidance but should not be considered as min/max values.

Again, like the ESP, you may find one that works out of spec but the next one you buy may not.

I should have been more precise. I do of course know that this is no universal statement, this is why I included the specific datasheet graph for the exact regualtor i want to use.
So for this exact usecase this are the values I can depend on for max/min and "simply operating above dropout voltage" should guarantee me in this case that this chip will work as expected.
Or have I missunderstood the concept of dropout voltage?

Yes you have misunderstood.
As I said: Simply operating above dropout voltage does not guarantee the the regulator will be in regulation, or that it will meet the specified load amd line regulation speifications.

TI has published an application report "Understanding the Terms and Definitions of LDO Voltage Regulators" that might be helpful.

Thank you, this report was very insightful.
It confirms my considerations and now I see that @jim-p just was unhappy with my wrong, definitve statement. I actually understand that the voltage does not guarantee that the regulator will be in regualtion, but that is why I explicitly referenced the datasheet that I am using and there I can find a given voltage and current combination where the regulator will work as expected.
But yes, this is not universal, is dependent on the current and has to be checked for every regulator model.

After further searching I found what @ShermanP was suggesting before. The Ricoh R1172x datasheet actually describes what happens to the output if the inputvoltage drops below the voltage needed for regulation.

Actually the chart you referenced doesn't insure regulation under those conditions, simply what the typical dropout voltage is at particular load currents. The series pass element acts like a resistor under those conditions and the LDO circuitry does nothing to control the output voltage.

That graph is a typical characterisic for the 3.0V regulator.
Output voltage is defined for Vin-Vout=1V
Line rgulation is defined for Vin-Vout=0.3V

Why do you now want to connect the battery to a voltage regulator?

Power Path ICs from Texas Instruments: BQ25820, BQ25750, BQ25185, BQ25180

Analog Devices makes a few models as well

1 Like

These CMOS regulators typically just have a P-channel mosfet connecting the input to the output, and a resistor divider on the output that provides feedback. If feedback sees the output below 3.3V, it presumably turns the mosfet on all the way to try to correct that. And it probably keeps it that way until the voltage is so low that nothing works. I can't guarantee it, but my memory is that the Holtek HT7333 works the same way. But there are no charts in the Holtek datasheet, so you would have to confirm that behaviour in testing. But it's a pretty good regulator, cheap, and even comes in a TO-92. :slight_smile:

Whether you could actually run the circuit at below 3.3V, with no regulation anymore, is something you would also have to test. At some voltage, the ESP32 will no longer be able to transmit effectively. But, you know, if it could work down to 2.8V, that could give you extra battery life. And you could also think about what voltage the regulator should be - 3.3V or 3.0V, or even 2.8V. If the ESP32 will actually work at 2.8V, there's a good argument for using a 2.8V regulator. The ESP32 will draw less current at 2.8V than at 3.3V.

yes you can

just make sure the charger is disconnected before connecting the battery

you can size the capacitor based on the load (you need an oscilloscope to see how fast the capacitor goes below 3V while the power source is being switched)

Since this is your personal project, not commercial production and since you arrive into some "gray zone" with regulator or without, I would build setup without. You get maximum battery life at least.
Also note that 3.6V is still within "Recommended Power Supply Characteristics". It's very unlikely that you damage the board with brief 3.65V. Not correct design though.
Be aware also that minimum voltage for esp with builtin flash is 3.0V.

ps. not anyhow scientific approach, but I planted esp to chinese solar light which had lifepo4 cell (with unspecified solar charge circuit) and it was working perfectly for >2 years until water found a way to get inside.

Since you are now designing your own PCB and don't care about the 3.65V, then just build the Hackaday circuit given by @time_document_3108 in post #14.
It will do exactly what you want.

This option could make the circuit easier. The battery could always be connected to the regulator, even during charging without a risk for overvoltage on the ESP. But the charger would have to support load sharing. I am still not sure which way to go.

Thank you for sharing. These seem like a great option, but these packages would be probably impossible for me to solder by hand. Maybe if I also got a better setup this could work.

I will try to figure that out. 2.8V is ambitious but if I can keep the circuit working until the battery is at 3.0V then 90% of the battery capacity could be used.

another thing to add to my shopping list :smiley:

Thank you for pointing that out, I will probably be using one with flash.
I will also check out that solar charger thing, a lot of those also seem to use LiFePo4 cells and maybe I can finds some inspiration there.

This seems like a good starting point but @ShermanP pointed out that the "oddball power path" may cause issues with feeding into the output of the regulator. So I would have to find out if this is a problem and if it is, a way to correct this.

It doesn't.