Power on -off circuit : Long press to Turn on instead Short Press

panic mode

Joined Oct 10, 2011
5,189
depending on RPI version and installed hardware, that draw may be anything between couple of mA to few tens of mA. for many uses that may not be suitable.
 

Thread Starter

hmzblgn

Joined Sep 15, 2025
6
Question to the TS:

Is the goal of the circuit to delay power to the uC, or to delay operation of the uC when it has power?

A corollary question: Are other circuits/things besides the RPi being powered through this switching circuit?

ak
The target is turn on with long press. The right side of the mosfet is already handling the safe shutdown with the GPIO.
 

eetech00

Joined Jun 8, 2013
4,725
Here's an alternate circuit.

R1 adjusts the delay. Time delay depends on NMOS VGS(th), but an assumption is the delay time is not critical.

1758134766697.png
 

sghioto

Joined Dec 31, 2017
8,743
Here's an alternate circuit.

R1 adjusts the delay. Time delay depends on NMOS VGS(th), but an assumption is the delay time is not critical.
One issue I see is the power OFF is also delayed when pin7 goes Low.
C1 has to discharge through R1 and R4.
Still think post #4 is the best approach.
 

AnalogKid

Joined Aug 1, 2013
12,242
If you remove D2, the uC high output, necessary to keep M1 turned on after the button is released, now will be connected to the timing capacitor, so it will not discharge (reset) while the circuit is running.

ak
 

sghioto

Joined Dec 31, 2017
8,743
If you remove D2, the uC high output, necessary to keep M1 turned on after the button is released, now will be connected to the timing capacitor, so it will not discharge (reset) while the circuit is running.

ak
Huh?
Pin7 Connected through D3.
When pin7 goes Low C1 will discharge through R4 and D1, D3 will be reversed bias.
 
Last edited:

AnalogKid

Joined Aug 1, 2013
12,242
When pin7 goes Low C1 will discharge through R4 and D1, D3 will be reversed bias.
Yes, but that's not the condition I was describing. When the pushbutton is open *and the RPi circuit still is running*, pin 7 is high.

I interpreted "remove D2" as replacing it with a direct connection. With a wire connection there, a high at pin 7 will hold up C1 because holding up R4 will take around 1 mA, which the RPi GPIO pin can source easily. Thus, C1 cannot begin to discharge until the RPI shuts down itself. For yhe ON-Delay time to be repeatable, C1 must discharge for at least three time constants. That could be a problem for some restarts. D2 lets C1 discharge through R4 while the RPi circuit is running, so it can be fully discharged and ready for the next start cycle immediately after an RPi shutdown.

If he meant replacing it with an open circuit, then you no longer need D3.

ak
 

sghioto

Joined Dec 31, 2017
8,743
He means replacing D2 with a wire. In order to pull the gate down through R1 and R4 when power is OFF.
I see your point but C1 will discharge rapidly through R4 and D1 when pin7 is low.
If D2 is removed how would the mosfet initially get turned ON?
 
Last edited:
Top