Sense Batt voltage + power the IC only when the device is charging : possible?

Hi everyone.

The context:
I am making some improvements on my battery powered screwdriver (low cost Black and Decker) : I want to add a LED strip for a light pattern when the device is charging.
The battery is NiMh 3 cells.
The original circuit has only a diode to prevent reverse voltage, and the charger is a weird 4.35V@200mA with a DC plug barrel. I want to change this to USB.

What I did:
I just needed a diode (Vdrop around 0.4V) to prevent the current to flow back from the battery to the arduino (ATtiny85) when the device is unplugged.
this is working.

My problem:
If I link an analog pin to the battery + voltage, it is powering up the arduino when the USB is unplugged...
Now, what I have on my bench is the flawed circuit showing in the attached file named "circuit.png".

my idea to correct it (untested):
I thought about preventing the current to flow when the USB is unplugged with a NPN transistor, but I don't have one to test it (file "circuit with transistor.png"). Would it work?
do you have a better idea?

the ATtiny should be totally unpowered when the device is unplugged to prevent battery draining.

I am not a crack in electronics, so I am not very sure about myself and there is probably a very simple solution I didn't think about despite my research...

circuit with transistor.png

circuit.png

I have two possible solutions, first and the simplest use something in the 50K range between analog pin and the battery + voltage. This is about the simplest but it will draw about 0.1mA so over a long period it will discharge your battery. You can also use a relay that you turn on when you want to read the analog pin. The battery + through the NO contact the other side of the NO contact (C) to the analog in. There are many other ways but I am trying to keep this simple. This response is to help you get started in solving your problem, not solve it for you.
Good Luck & Have Fun!
Gil

The context:
I am making some improvements on my battery powered screwdriver (low cost Black and Decker) : I want to add a LED strip for a light pattern when the device is charging.
The battery is NiMh 3 cells.
The original circuit has only a diode to prevent reverse voltage, and the charger is a weird 4.35V@200mA with a DC plug barrel. I want to change this to USB.

Could you change the barrel plug to a stereo type jack plug, a 3 pole plug and socket? If so the Arduino would only be powered off the charger.

Thanks for the help.

I thought about the 3 pole plug, but I really want USB for convenience.

The idea of a relay also crossed my mind, but I want the case as small as possible, so it may be difficult to conciliate the two...
maybe an optocoupler would work?

But I think I will go with the resistor, seems a good compromise.

thanks.