Electrical – TP4056 and li ion battery charging that never ends

#nodemcubattery-charginglithium ion

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.

This is the charging module:
This is the charging module

  • 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:

schematic

simulate this circuit – Schematic created using CircuitLab

TP2104 datasheet

This circuit work as intended:

  1. The voltage drop on vbat is reduced (with respect to using a diode)
  2. 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.

Best Answer

The charger is probably acting as intended.
By drawing power from the battery after charging completes you are discharging it and causing the voltage to drop to the recharge point.
This is bad for battery cycle life.

The solution is to arrange battery and the charging source in such a way that the circuit draws energy preferentially from the power supply when it is on.
If you are supplying 3V3 to the circuitry then presumably you have a regulator between the battery and the 3V3 bus. The regulator may be on the node mcu pcba. Or not.

The simplest sharing circuit is to provide diodes from battery and power supply to the voltage regulator input. The maximum Vbat = 4.2V. If Vpsu > 4.2V the circuitry will be operated by the psu. When mains power is removed the battery takes over.
The battery to vreg diode should be a Schottky diode. The psu to vreg diode can be Schottky if desired but an eg 1N400x will suffice.

This site has a number of questions related to backup supplies and these will provide other means of supplying the vreg from the battery with minimal Vdrop. (A MOSFET is often used).