I have a microcontroller that I want to install in my car. One wire coming from the car supplies +12V from the battery independent of whether the car is on or off. This works fine to power the microcontroller when the car is on, but I would like to cut the power when the car turns off. Another pin in the same harness reads about +0.25V when the car is on and +12V when the car is off. How can I use this signal to switch on/off my microcontroller? There are some ideas that come to mind, but I am not sure what type of solution will use the least amount of power when the car is off.

  • \$\begingroup\$ Don't bother. Use an Ignition Switched power line. No key, no power, clean and elegant. \$\endgroup\$
    – Passerby
    Nov 23, 2015 at 2:47
  • \$\begingroup\$ I would, but unfortunately one does not exist on the connector with which I'm working... Having another harness to get the power would be cost-prohibitive \$\endgroup\$ Nov 23, 2015 at 3:24
  • \$\begingroup\$ I'd want to know where that wire comes from. It might be 12V when you first turn the car on, but switch on and off intermittently when actually running. \$\endgroup\$
    – Icy
    Nov 23, 2015 at 8:29
  • \$\begingroup\$ You mean that it's a PWM signal? I only checked with the voltmeter, so I don't know. That's a good point. I will check it out with my scope later today \$\endgroup\$ Nov 23, 2015 at 16:06

1 Answer 1


You could make a high side switch with a p-channel MOSFET. Attach your load to the drain, and your car's 12V power to the source. The MOSFET basically becomes a short when the voltage on the base goes lower than the source voltage, 12V in your case, minus the Vgs(th). If the data sheet for your MOSFET indicates that the Max Vgs is greater than 12, then you can attach the signal to the gate through 100 Ohm resistor and be done.

If you are interested in a schematic, and more details, search "MOSFET high side switch"


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.