Arduino Nano Self Power off troubleshooting

Hi,

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.

Thanks you!
-Igor

If you haven't replaced the bootloader your board might still haven't started to execute your sketch in 1 or 2 seconds... The Arduino bootloader allows you to upload a new sketch on the MCU by initiating the firmware flash process within a timeframe (not sure how long it is), but that means during that time frame the MCU is waiting for the flash process initiation sequence rather than executing your sketch.

You can turn on the on-board LED into the setup() function so you know that when you release the activation button the sketch is properly running.

I don't have enough electronics knowledge to validate your circuit, so I'll follow the thread in order to learn :-D

Thanks for the suggestion but that is not the problem. I can keep the pushbutton pressed for 30 seconds and the board still powers off when the button is released. The sketch starts running for sure because the mosfet gate is driven high.

I'm pretty sure it is the hardware configuration, I just don't understand why it is happening, so looking for some explanations from people more knowledgeable in electronics.

Hope we both get to learn something here!

Cheers, -Igor

Time to post your code, between code tags.

ChilliTronix: Not much in the code, just sets a pin that drives the MOSFET high:

#define PWRFET 3

void setup() 
{
pinMode(PWRFET, OUTPUT); 
digitalWrite(PWRFET, HIGH); 
}

void loop ()
{
}

So you drive the gate of the mosfet high, but presumably you have to drive it higher than it's drain, but the maximum voltage you can drive it with is 5V, and the drain must be higher that 5V, and certainly higher than the Arduino because there is a Voltage regulator after.

So...

You need to use the power drive pin to some how generate much more than 5 V.

Can't find (in a hurry) the last article regarding this particular problem, but you are using a N-channel FET which you cannot turn on with the Arduino as it cannot pull the gate up, where you actually need a P-channel FET whose gate will be pulled down by either a N-channel FET or NPN transistor.

OK?

Why would you not be using the regulator built into the Nano?

Hi Guys,

Thanks for the feedback, I realise now that I can not do this as I can not meet the Vgs(th) in this configuration. A P-Fet is necessary.

I am not using an actual Nano, but a custom PCB similar to the Nano, using Arduino libraries.

Cheers for the help, -Igor

igor86: I am not using an actual Nano, but a custom PCB similar to the Nano, using Arduino libraries.

Thought as much. :grin:

igor86: A P-Fet is necessary.

And an NPN transistor (or FET if convenient) to pull the gate down to enable it.