0
\$\begingroup\$

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.

\$\endgroup\$
3
\$\begingroup\$

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).

\$\endgroup\$
  • \$\begingroup\$ Ideal diodes with a priority path will also do the trick. \$\endgroup\$ – Peter Smith Dec 9 '18 at 13:16
  • 1
    \$\begingroup\$ @Desmond The 300 uA (not "per hour") will hopefully be sourced from the psu and not the battery when mains power is available, so that the battery will not be cycled unnecessarily. | P Channel MOSFET is connected from battery to load with DS and S reversed to normal - Drain to V+ and Source to load. Gate has a resistor to ground and a diode (+ mabe a smaller series resistor) from gate to PSU+. When PSU is positive the FET will be biased off. When PSU turns off gate is pulled to ground and FET is on. Vsd is much lower than diode drop as Rdson can be very low. \$\endgroup\$ – Russell McMahon Dec 14 '18 at 17:35
  • 1
    \$\begingroup\$ @Desmond Schottky diodes have higher reverse leakage current than silicon diodes - especially so at higher temperatures. A MOSFET will also have leakage current which can be determined from the data sheet. However - 2.5 uA is very unlikely to cause major problems. 2.5 uA will take 400 hours or about 16 days to draw 1 mAh of charge. If your AA battery has say 1000 mAh of true capacity, 1% is 10 mAh and it will take about 4000 hours or about 6 months to reduce capacity by 1%. Depending on your recharge voltage point this may trigger recharge but so infrequently as to have minimal affect. \$\endgroup\$ – Russell McMahon Dec 16 '18 at 6:57
  • 1
    \$\begingroup\$ @Desmond - To recap: (from text and references above) that the P channel FET is used "backwards" to usual with drain to battery and source to load. It is on when gate is negative relative to source (as it also is when D & S are connected in the usual way. This reverse DS but normal Vgs on polarity is possible because the FET is a 2 quadrant device - it will conduct as a pure resistor (more or less) with either Vds polarity as long as Vgs is negative. || I say the above so I can then note that the FET is off OFF OFF!!! when Vgs is zero OR positive. SO when Vgs = 5-4.2 = +0.8V the FET is OFF... \$\endgroup\$ – Russell McMahon Dec 17 '18 at 4:17
  • 1
    \$\begingroup\$ @Desmond ... regardless of its Vgsth. In the TP2104 datasheet page 2, Idss = drain current at Vgs=0 = -10 uA at Vds = max (=-40v). This is more than the 2.5 uA you are seeing so is in spec as far as you can tell (ie your Vds is lower). (As your Vds is +5V and the "normal" Vds is negative - ie your/our use is legitimate but not quite as per this spec sheet table, it is possible that Ids will be different/higher/lower in this quadrant. || NB: R2 value on diagram appears very wrong. Maybe 10 megOhm? Or ...? \$\endgroup\$ – Russell McMahon Dec 17 '18 at 4:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.