Self shutdown circuit and code

++Karma; // Correct.

If you follow this forum for a while you will see people posting similar circuits that have some variation of that problem.

Ok, final check. I hope…

Does this look like it would work? I’m thinking this way, there are two paths to ground for the P-channel MOSFET. If either the 12v switch or the Arduino provides a signal to either of the NPN transistors, they will enable a path to ground for the MOSFET gate, and keep the Arduino powered as long as I wish.

Thoughts?

You can also see additional examples here. However I’d also use an NPN transistor instead of the N channel mosfet. https://circuitjournal.com/arduino-auto-power-off

You don't need a transistor for the switch. Just use the switch to directly ground the mosfet gate, as shown in CrossRoads' circuit in reply #3.

ShermanP: You don't need a transistor for the switch. Just use the switch to directly ground the mosfet gate, as shown in CrossRoads' circuit in reply #3.

I'm not able to have a ground switch, my switch is necessarily a 12V switch since this is tied into the ignition switch of a car.