I have a circuit that's setup to use either USB or a 3.7V lithium battery. When both are plugged in at the same time, the battery is charged through a TP4056 IC. The charger also has two LEDs attached to it. One that's red which is on whenever it has power. And one that's green which lights when it's fully charged.

However, these stay on and flicker if you plug in the device without a battery. Is it possible to somehow detect that no battery is present and if so, disable the charger?

My biggest issue is that when there's no battery attached, the charger will output a voltage to the battery positive.enter image description here

This is my current design, USB power enters from the top left. But I'm willing to redo the design. I also have access to multiple free pins on a microcontroller, if that could be used.

  • \$\begingroup\$ They flicker? I haven’t seen that before. Can you show an oscillogram of Vcc and CHRG when this happen? \$\endgroup\$ – winny Sep 30 '20 at 21:37
  • \$\begingroup\$ Only STDBY flickers. And it's only while no battery is enabled. I'm assuming that's how it senses if a battery is present. But in either case I'd like for both LEDs to turn off while no battery is present. \$\endgroup\$ – user2145184 Sep 30 '20 at 21:46
  • \$\begingroup\$ *connected, not enabled \$\endgroup\$ – user2145184 Sep 30 '20 at 21:54

Pulling pin TEMP high (Vcc) stops the charge, maybe you can use that.


From the Data sheet...

CE(Pin8):Chip Enable Input. A high input will put the device in the normal operating mode. Pulling the CE pin to low level will put the YP4056 into disable mode. The CE pin can be driven by TTL or CMOS logic level.

So I would try to make a battery detection circuit which controls the CE Pin. Guess a kind of reset IC with an programmable out delay would be a possible solution.

Edit: according to the comments, its delayed shutdown of course

  • \$\begingroup\$ Delayed startup would work. It wouldn't turn it off if unplugging an already plugged in battery, but it wouldn't disable it if you pop the battery out while charging. But it did give me an idea. I could maybe have an IO pin turn off the charger, and another one to check if a voltage is still present on the battery positive. \$\endgroup\$ – user2145184 Sep 30 '20 at 22:58
  • \$\begingroup\$ I did not mean delayed startup but delayed shutdown. maybe it's so logic, I did not mentioned it explicitly \$\endgroup\$ – schnedan Sep 30 '20 at 23:11
  • \$\begingroup\$ How would delayed shutdown work? \$\endgroup\$ – user2145184 Sep 30 '20 at 23:17
  • \$\begingroup\$ e.g. a ne555 should be able to delay the "no battery connected" signal a bit \$\endgroup\$ – schnedan Sep 30 '20 at 23:34

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.