I was making a board with an atmega328 mcu (to be used with Arduino libraries) to do some one wire communication stuff. Since I was etching the board anyway, I decided to try and implement a simple software off functionality, without putting much thought into it. Once I etched and assembled the board, my one-wire stuff works fine, but the software off circuit does not. I was poking around and I can't understand why it does not work.
The idea is that pushing a momentary push button (for 2-3 seconds), will connect the battery to the 5V regulator which in turn powers the MCU. The first thing the MCU does is set a digital pin high (line labeled PWR in the below diagram), to latch the N-MOSFET Q1 and bypass the push button switch. When the switch is released, the circuit should remain powered through the MOSFET.
What in reality happens is that pushing the pushbutton powers up the board as expected. The gate of the FET is driven to 5V by the MCU as expected, but as soon as the pushbutton is released, everything turns off. It seems that the FET is not bypassing the pushbutton for some reason, but I can not understand why? The FET Vgs is 1.8V, R6, R7 and D1 are there so I can use another push on the button to generate an interrupt on the BTN line, then drive the PWR line low and switch off the board.
So the question is what is wrong here? Why doesn't Q1 MOSFET stay latched once the pushbutton (connected to PWRSW header) is released? I'm certain it is not something complicated, but I just can not understand why – perhaps because I've been staring at it for too long…