I would like to get your help in relation to a one-off battery powered project (it a conversion of an old Russian 35mm still picture film projector to LED light source with additional features).
As this is really a home project to 'keep using the device with some added features as it is fun' I went really basic on the design and used ebay available boards on a strip board and fitted it into the original housing. Also, this is my first 'chargeable battery operated appliance'.
The idea is the following:
I power the device from a 18650 LiIon battery with a step up converter to 5V powering and Arduino board running normal C code. The charging of the battery is via a TP4056 CC/CV with added over/under voltage protection from a USB port.
The powering on/off of the device is achieved by disconnecting the whole charging+battery circuit from the step-up converter's input by the means of a basic switch.
With this I can still charge the battery and when I use the device I flick the switch on, it powers the ATmega328 which is needed to adjust LED brightness and do some other stuff.
So far so good, the problem came in when I thougth about to connect the two open drain outputs (charging and charged state) of the 4056 to two of the GPIOs to monitor the charging status of the device (when the MCU is turned on).
The two open drain outputs have LEDs connected to them (powered from the USB side 5V) allowing to see the charging state even when the MCU is powered off.
The 4056 always has one of the open drain outputs engaged to show charging or charged status when in operation (ie powered from USB).
When my device is powered off (MCU is powered down by the switch) but charged by the 4056 via USB (one of the open drain outputs is on) I have experienced that the not active LED is also lit up, hence the two un-powered MCU pins are acting as a 'link' and providing the drain for the other LED also, hence both LEDs are on.
Obviously when the MCU is powered it is not a problem as the pins are set as inputs (with pull-up).
I realised it comes from the fact that the non-engaged open drain actually pulls the connected MCU pin to 5V which phantom powers the MCU and causes it to probably create this undesired feature also it is not good for the MCU either. I have a 2kOhm resistor in series with the LEDs so current is limited but it is still a distracting feature.
My question would be (I think my solution is correct but would like to get your opinion on it):
- Would it be a proper solution to add a diode between the open drain outputs and the MCU pins for both outputs of the 4056 (the anode being on the MCU pin side) stopping current to flow from the USB 5V towards the MCU but still allowing to use the MCU pin to monitor the charging state when it is powered up by setting it as an input with pull-up enabled?
thanks and regs.: