0
\$\begingroup\$

I am using a TPL5110 timer to drive my NodeMCU, in order to keep battery consumption low, but I can't let it work. I have setup the standard circuit for this timer, as below: enter image description here

Whenever I apply power from battery, TPL5110 starts blinking without providing power to NodeMCU. If I disconnect the NodeMCU load, the timer works fine. Whatever load I apply to the timer, it performs like it should, except if I connect it to the NodeMCU (which is draining just 80 mA). I have also tried with an opto-isolator, but I got same results: it is like the TPL5110 doesn't like the NodeMCU's load.

I came to the conclusion (after buying 3 TPL5110) that this timer is a cheat for use with NodeMCU. I hope I'm wrong.

\$\endgroup\$
  • 2
    \$\begingroup\$ "TPL5110 starts blinking"?! TPL5110 is a timer chip, it can't blink. If you refer to LED installed on Adafruit board, then "blinking" is exactly correct behavior. The LED is connected to the output of the MOSFET, so if it lights up then there is a power on the output. \$\endgroup\$ – Maple Aug 9 '18 at 10:08
  • \$\begingroup\$ No. The LED should be steady. If it blinks, also power out blinks and NodeMCU doesn't start \$\endgroup\$ – Fabio Marzocca Aug 9 '18 at 11:04
  • \$\begingroup\$ Can you measure the voltage at the nodemcu's VDD to its GND? Maybe the FET just drops more voltage than tolerable. \$\endgroup\$ – Marcus Müller Aug 9 '18 at 11:32
  • \$\begingroup\$ Battery is a 3.2v LiFePO4. When timer is activated, I can measure 3.2 volts at NodeMCU 3v3 pin, but it is not steady. \$\endgroup\$ – Fabio Marzocca Aug 9 '18 at 11:46
  • \$\begingroup\$ You've posted generic schematics from datasheet. Would you mind posting actual schematics you use? MOSFET and resistor values as well as what you have in place of "power management" box on the left. \$\endgroup\$ – Maple Aug 10 '18 at 16:34
1
\$\begingroup\$

I fixed it by installing a 2,200 µF capacitor between NodeMCU's Vcc and ground, to filter startup spikes.

\$\endgroup\$
  • 1
    \$\begingroup\$ Nice! (by the way, that is really much capacitance!) Maybe you can tell future readers how you came up with the idea. :) \$\endgroup\$ – Marcus Müller Aug 9 '18 at 12:19
  • 1
    \$\begingroup\$ By monitoring Vout from the TPL when connected to NodeMCU. A lot of spikes!! I first tried with 100µF, no way. Then I found that maybe 1,000µF could have worked but 2,200µF work for sure! \$\endgroup\$ – Fabio Marzocca Aug 9 '18 at 12:37
  • 1
    \$\begingroup\$ Excellent! My suspicion is that the NodeMCU already turns on while its on-board capacitor is still being charged, which leads to instable operation, a reset, and repetition of that. Does the NodeMCU have an external "RESET" pin? In that case, it might be a good idea to add a small R-C delay to that pin, so that the NodeMCU only powers on when the supply power has already stabilized. \$\endgroup\$ – Marcus Müller Aug 9 '18 at 12:43
  • \$\begingroup\$ No problem. The sketch has a small delay at startup to allow things to be balanced. It works fine. \$\endgroup\$ – Fabio Marzocca Aug 9 '18 at 13:14
  • \$\begingroup\$ @MarcusMüller First of all, NodeMCU has 3 of its GPIO performing special functions during the boot. This often causes a lot of frustration when the chip refuses to boot with no apparent reason. Second, the supply is already stabilized when MOSFET turns on (it powers timer itself). The observed jumps between 0 and 3.3V is not "unstable" supply, it is something else is wrong with circuit. 100 uF should be more then enough to deal with spikes. Besides, how much "spiking" would you expect in single cell battery supply by connecting 80 mA load with mosfet? something else is wrong \$\endgroup\$ – Maple Aug 9 '18 at 17:30
1
\$\begingroup\$

Do you, by any chance, set the GPIO in the beginning of your code? Because that would explain why you think it does not work.

The DONE signal is exactly that: "I am done, you can power me off". It should be the last line of code in your NodeMCU.

UPDATE

OK, I did some digging and it seems there are several potential culprits.

  • First, you are not alone having this problem. In fact, the Adafruit datasheet acknowledges a problem and recommends adding 47 uF capacitor to NodeMCU Vcc. Many people on forum say it is not enough and they needed at least 100 uF to make it work (I saw your posts there BTW). Links to forum: one, two.

This is totally wrong IMHO. There should not be any huge power spike at startup (not at 80 mA draw!). The capacitor would only delay the rise time on power up and keep NodeMCU from proper shutdown on power down. It is rather "let's add the cap and see what happens" approach. Even if it works, it does not pinpoint the actual problem.

Also, if it really has anything to do with power line drop then it makes sense to add capacitor before the MOSFET. This way it won't delay the boot, it will supplement startup current instead.

  • Second, this thread reminded me about one peculiarity of TPL5110/TPL5111 chips.

The normal operation is: timer activates DRV, MCU boots, does whatever it supposed to do and signals DONE, timer switches power off.

However if DONE is not received then timer forces DRV off 50 us before the end of period. Although datasheet is not clear on this, my understanding is it does this so it could activate DRV again when period ends, i.e. almost immediately (in 50 us).

So, if programmed period is short it would look like "blinking". In order to avoid this time period should be set long enough for MCU to boot, do its thing and still have enough time to signal DONE.

  • Another potential candidate is ESP8266 itself.

It's bootloader dumps boot log to UART during startup. AFAIK this cannot be disabled completely. So, if you happen to use TX pin for DONE signal you are in trouble.

  • Finally, and this is what I believe is real culprit for many people on Adafruit forum, some GPIO pins of NodeMCU triggered high during boot.

See here and here for some investigation of this problem (first link is dead ringer of your case). I must say, this is rather bizarre behavior for MCU. I always assumed that all pins stay in high-Z until I program them otherwise...

In short, you have to make sure you use "safe" pins for DONE signal. Interestingly enough, adding capacitor after MOSFET could mask this problem by keeping NodeMCU alive till next period, just as I said in the beginning (a working solution without understanding a problem).

UPDATE 2

OK, while all of the above can cause the observed behavior (especially choosing "unsafe" pin for DONE), the most probable culprit is high current draw of the ESP on startup. Here, I found an interesting article about it, claiming as much as 400 mA on startup, with possible lockup in this state if power rise slew rate is too slow.

Now that I knew what to look for, I found hundreds of pages about this issue, like this post on Espressif forum.

In conclusion: ESP draws huge current during boot. Furthermore, it can lock up in this condition if voltage is not rising fast enough. Adding capacitor before MOSFET solves both problems by instantly providing required power without reducing voltage rise time.

\$\endgroup\$
  • \$\begingroup\$ At the beginning of the code, GPIO is set to LOW as it should be. And I have also a pull-down resistor on it. The problem is that the sketch never runs because the NodeMCU never gets powered. \$\endgroup\$ – Fabio Marzocca Aug 9 '18 at 11:05
  • \$\begingroup\$ I am confused. You say "never gets powered" here, but "I can measure 3.2 volts at NodeMCU 3v3 pin" in the comments. So, which is it? Also, ESP has several pins controlling the boot sequence. Are you sure it boots properly if you just apply power to it, all other connections being the same? \$\endgroup\$ – Maple Aug 9 '18 at 12:13
  • \$\begingroup\$ Don't get confused... if you read my post I said that TPL5110 was switching on/off rapidly, blinking. I measured that it was blinking between 3.2 and 0. Now it is stable, with the capacitor on Vcc. \$\endgroup\$ – Fabio Marzocca Aug 9 '18 at 13:15
  • \$\begingroup\$ Does it "blink" if you disconnect DONE signal too? \$\endgroup\$ – Maple Aug 9 '18 at 17:32
  • \$\begingroup\$ Yes. It works only if I remove DRV from the positive line. \$\endgroup\$ – Fabio Marzocca Aug 10 '18 at 15:49

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.