I’ve designed a little circuit interfaced to an Arduino Nano. The idea is that everything is powered by a 9volt battery, which is regulated to 5 volts to power the arduino. There is a push button, when pressed, it momentarily gives power to the arduino (press for a second or two), the arduino should power up and the first thing it does is switch a digital pin to HIGH to turn on an N-CH Mosfet which would latch the power ON as long as the pin is held HIGH. If the power button is pressed again, it can generate an interrupt on the arduino which in turn will drive the digital pin controlling the Mosfet LOW and shut off its own power supply. Alternatively, if the system is unused for 5 minutes, the arduino would likewise power itself off.
The relevant part of the circuit is attached.
PWRSW is where the push button is connected. Resistor divider R6 and R7 allow the arduino pin to sense when the button is pressed again. D1 block reverse current into the divider. Q1 is the Mosfet that controls the power.
The issue is that the circuit and arduino power on when the pushbutton is pressed and held down, and the mosfet gate is driven to 5V as expected. Mosfet Vgs is 1.8V. However, as soon as the pushbutton is released, everything shuts off. Hence, even though the Mosfet should be turned on, it does not bypass the pushbutton switch as expected.
Could someone please enlighten me on why this does not work as I’m banging my head against the wall trying to figure it out.