I have designed a circuit with a Nodemcu ESP8266 (something similar to an arduino nano, requiring 3.3V to work) and I would like to have a backup battery to be robust to main power interruptions.
So far, it seems that one approach is to use a li ion battery and a charger. Therefore I bouth a 14500 Li ion battery (AA sized, rated 1200mAh but, you know with chinese batteries this is not reliable) and a TP4056 circuit that comes with OUTPUT + and - pins. This is supposed to be able to charge the battery without overcharging it, while giving stable power to my circuit.
- battery connected to pin B+ & B-
- input provided to pin input + & -
- output taken from OUT+ & OUT-
Basically, this works. The problem is that, after some times the battery is on charge, the board switch to "full charge reached" (blue pin), and, in a few seconds, switch back to "charging" (red pin), then again "charged" and so on.
The firmware used by the nodemcu has a deepsleep cycle of 2 sec, than it wakes up for ~40ms, then back to deepsleep. In the current version, the deepsleep uses 15 mA (please note, this is a terrible value for deepsleep, in the real use case it uses 200 uA) while taking 30-40mA when wake up. It seems to me that the charging board switch from "charged" to "charging" when the nodemcu wakes up.
A final note: I'm giving the 5V input to the charging module from an isolated 220ac-5vc converter, which is supposed to be able to provide 800mA. The charging board is supposed to manage and input current up to 1A. Could it be the problem?
15/12/2018 Edit: I realized the following circuit thanks to @RussellMcMahon comment below:
simulate this circuit – Schematic created using CircuitLab
This circuit work as intended:
- The voltage drop on vbat is reduced (with respect to using a diode)
- When PSU is available, no current is drawn from the battery
Well, actually "sort of"! When PSU is on, a very small amount of current (2.5uA) is drawn from the battery. Is it correct? Should I change something in this circuit, or given the fact this current is so small, should I just ignore that? May it be useful, the battery I am now using is rated 2200mAh.