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