@macsbug Thanks for the links to your projects. For my use the 110mWh battery is all I need. I've done some testing with the diode connected between VBAT and 5V. As the built-in cell doesn't have any protection other than the IP5306 there is a risk that the battery could be over-discharged. I watched the cell voltage drop to 2.4 volts with the diode connected! Normally the IP5306 shuts down the M5 if cell voltage drops to 3.0 volts but the diode prevents this. So with this in mind here's a schematic of how I intend to connect the MAX40200.
R1 is a pulldown to ensure the battery isn't discharged when the M5 is off, and if the cell voltage drops to 3.0 volts and the IP5306 shutsdown the M5, the pulldown should ensure that the MAX40200 shuts off. Also by using GPIO2, the MAX40200 can be controlled from software in the M5 which means that I can use the software to allow the M5 to continue to run uninterrupted if the USB power is removed and then shut it down later as required.
Posts made by GregF
-
RE: No reset when USB power removed [SOLVED]
-
RE: No reset when USB power removed [SOLVED]
@world101 What I am trying to do is to have the M5 turn on when it gets power, stay on when power is removed without resetting so I can do some house keeping and then turn it off. The next time it gets power it should turn back on. With the diode connected the M5 thinks it still has power from the USB so it won't turn off from the power button. I am also concerned with draining the battery excessively.
However I am thinking if the diode is replaced with a mosfet/transistor then it could be controlled from one of the GPIO pins. Experimenting with plugging in the diode (I'm using a 1N5818 ), the M5 will turn on and off when the diode is plugged in and unplugged. I am still struggling with getting the M5 to turn on reliably when is gets power either from the USB or the diode but I do have it reliably turning off when removing the diode after removing the USB power.