Maker Pro
Maker Pro

Delayed shut-off for RasPi?

Don Murphy

Mar 14, 2017
5
Joined
Mar 14, 2017
Messages
5
Hello all,
I've been working on a self powered device that uses a Raspberry Pi for its "brain".
because of the way the Pi is designed, I need a power management circuit that will interrupt the Pi's power supply after it has gone through an orderly shut-down. Normally, the Pi receives its power through a buck supply that's driven directly off a generator but a set of ultracapacitors takes over when the generator isn't active. When this is the case, the Pi runs some event dependent script for a timed shut-down after an elapsed time. Unfortunately, rebooting the Pi when it's in standby requires some operator interface unless the power has been completely interrupted so I've hacked up this circuit to disconnect the Pi from the capacitor bank at some interval following the shut-down sequence.
Can anyone see any potential problems with this approach? I'm planning on using some LL FETs that I have laying around. The power requirements are minimal (< 15 watts). I forgot to draw in the drain resistor for the first FET's gate (10kΩ to ground) and figured on tinkering with the unmarked capacitor and resistor values to get the delay I need: It will probably need to be around three to five seconds. The zener's just for the sake of my paranoia. Drawing1.JPG Will this work?

Oh yeah, I almost forgot: The 5V output of the power converter is the power feed for the Pi.

Thanks,

Don
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,719
Joined
Nov 17, 2011
Messages
13,719
It's easy to turn off the Raspi by this circuit with GPIO=low.
How are you going to power up the circuit when power returns? You will need GPIO=high but the Raspi has no power to set this signal. A dead end...

You will need to incorporate some kind of 'power good' signal to re-activate this circuit.
 

Don Murphy

Mar 14, 2017
5
Joined
Mar 14, 2017
Messages
5
It's easy to turn off the Raspi by this circuit with GPIO=low.
How are you going to power up the circuit when power returns? You will need GPIO=high but the Raspi has no power to set this signal. A dead end...

You will need to incorporate some kind of 'power good' signal to re-activate this circuit.
Hello Herald,

I'm just assigning one of the GPIOs as always high upon boot-up (using some python code activated by the cron daemen). At shut-down, another python script executes the GPIO cleanup command and the drain resistor that I forgot to draw pulls the first MOSFET gate low. The intent is for start-up of the Pi to be brought about by the reintroduction of its primary power (i.e. the generator is active again) and that this circuit would allow enough time to complete a safe shut-down before disconnecting the secondary power supply (the caps). I figured the Pi is going to need a little more time (very little) after the GPIO cleanup is sent to safely finish locking its brain down.


Thanks,
Don
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,719
Joined
Nov 17, 2011
Messages
13,719
Whre in your circuit is the main power connected? If it is input through the top left wire (from the ultracaps), then there is no way the Pi will ever strat up because this circuit permanentgly shuts off power,
If the main power is connected elsewhere, please post an updated schematic to show where main power is connected. This will help getting a common understanding of this circuit.
 

Don Murphy

Mar 14, 2017
5
Joined
Mar 14, 2017
Messages
5
Hello Herald,
The Pi is powered by two semi-independent power sources. Most of the time, it's powered off the main bus, which is provided via a generator and a buck converter, but a bank of ultracapacitors (charged from the same bus) takes over for the generator when the voltage drops too low or is interrupted. I didn't include the balancing/isolation circuitry between the two supplies because I thought it would cause confusion. The purpose of this circuit is to use the cap bank for an orderly shut-down if the main bus is interrupted for "x" period of time. The system automatically reboots when the primary bus becomes active again. Obviously, there's a feed-back circuit and some code the pi uses to determine the state of the GPIO that controls this circuit.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,719
Joined
Nov 17, 2011
Messages
13,719
I understand the rpi will be powerd-up by the main bus independend of the state of the voltage on the ultracaps, right? In that case the idea behind your circuit is o.k., but I see a flaw:
The signal GPIO has 3.3 V level (as far as I remember the Rpi's GPI signal levels). This voltage is way to low to turn the left MOSFET on.
Also the right MOSFET will need a gate-source voltage greater than the threshold voltage to turn on. This is going to be difficult with only 6 V (min) at the gate from the ultracaps. You'll need a level shifter, but generating the high voltages for the MOSFETs will require additional effort.

I suggest you use bipolar trnaistors (NPN) instead.
upload_2017-5-28_20-48-56.png
With GPIO=Low, Q2 is off an d Q1 is on through R1.
With GPIO=High, Q2 is on through R2 and Q1 is off.
 
Top