Edit: I did a dumb-dumb. I got the emitter and collector mixed up on both transistors. Now it works.
What I'm trying to accomplish:
I'm planning to run a ESP8266 microcontroller in my car. The ESP runs off a 3V converter. I want it to turn on when turning the ignition on, but when ignition is turned off I want the ESP to decide when to turn off the curcuit. (I want to save some data etc. before shutdown) I want as little power draw as possible (or none) when it is shut down.
Current sollution attempt:
After some suggestions from others, I attempted to set up the circuit as shown in the schematic, using two transistors. The NPN transistor is a BC547 and the PNP is a BC557. The 3V converter with everything connected draws about 25mA at 12V. With the transistors in place the numbers are roughly 11.5V 30mA.To keep the circuit on the ESP outputs 3V on the D5 pin. However, there are problems:
- When the circuit is supposed to be off there is still 4V on the PNP transistor emitter pin.
- When powered through the transistors the ESP does not turn on. I should measure what I'm getting out of the 3V converter, but I'm currently not at home so can't do that right now.
Help?
- Is the attempted sollution the best way to go or would it be simpler/better using a relay or any other sollution instead?
- My knowledge of transistors is limited even after trying to read up a bit. I must be doing something wrong, but what? I am trying to learn, so just giving me pointers and letting me do some of the work is fine. (Also, I'm as lazy as anyone, so no complaints about complete sollutions either ;) )
Thank you!