DIY Safe Shutdown w/ PowerBoost

Various user-contributed guides for hardware-related things
Post Reply
User avatar
JamesW
Posts: 36
Joined: Wed Sep 27, 2017 4:45 pm
Has thanked: 12 times
Been thanked: 23 times

DIY Safe Shutdown w/ PowerBoost

Post by JamesW » Mon Mar 12, 2018 9:07 pm

DIY Safe Shutdown w/ PowerBoost

Here is a little circuit which provides safe shutdown capability when using a powerboost from Adafruit.

Parts required:
1 x momentary switch
1 x 220uf capacitor rated 6v minimum
3 x 10k resistor
1 x 33k resistor
2 x 100k resistor
4 x Small signal diode (1N4148, 1N914, etc.)
1 x General purpose NPN transistor (2N3904, 2N2222, etc.)
1 x General purpose PNP transistor (2N3906, 2N2907, etc.)
SafeShutdown.png
SafeShutdown.png (32.75 KiB) Viewed 3401 times
The circuit as shown above is in it's off state. Here is a link to the Falstad circuit simulator so you can play with this circuit to see how it functions

The way it works is, upon pressing the momentary power switch the capacitor charges and the npn transistor turns on. This turns on the pnp which pulls the enable pin high. At this point, the Powerboost starts up, your pi powers up and starts outputting a high signal on a GPIO pin of your choosing... this keeps the power on, under the pi's control. Meanwhile the pi monitors the momentary switch (via an input pin) for button presses and upon detecting one, it initiates a shutdown. The pi's GPIO output pin stops outputting high in the last moments before it is shut down. The capacitor stored enough energy to keep the transistors turned on and Powerboost active for approximately 6 more seconds before it's enable pin is pulled low again, switching off the boost converter.

The last part (at the top) is a GPIO input connected to a diode which is connected to the LBO pin of the Powerboost. When the Powerboost senses a low battery it sends this pin low. The pi's GPIO can detect this low condition and do whatever you want. It might warn you, give you a time till shutdown, or just initiate shutdown right then, it's up to you and how you write the code.

Why go to all this trouble when you can just shutdown the pi from a menu or shorting the run pins? Because the Powerboost is still active and continuing to drain your battery. With this setup the Powerboost is disabled and power is cut to practically nothing.

It looks complex, but in reality it's not too bad. This circuit can be built using freeform construction to take a minimal amount of space, or on a small perfboard.

User avatar
JamesW
Posts: 36
Joined: Wed Sep 27, 2017 4:45 pm
Has thanked: 12 times
Been thanked: 23 times

Re: DIY Safe Shutdown w/ PowerBoost

Post by JamesW » Tue Mar 20, 2018 7:18 pm

The circuit posted above works well, but upon thinking about this some and doing more real world testing, you can get away with a much simpler circuit. The circuit shown below has nearly half the components and works the same way.

Here is the link to the simulation.
SafeShutdown2.png
SafeShutdown2.png (27.49 KiB) Viewed 3384 times

User avatar
erik_gee
Posts: 343
Joined: Thu Jun 16, 2016 12:57 am
Location: United States
Has thanked: 133 times
Been thanked: 183 times

Re: DIY Safe Shutdown w/ PowerBoost

Post by erik_gee » Wed Mar 21, 2018 11:46 pm

very nice, im sure this will help a lot of people! I believe I saw this diagram online somewhere as well. I think it was a video on soft latch switches?

Instead of using 2 separate transistors, you can also use a dual mosfet ic, with n channel and p channel.

Also, there may be more interest for people who dont want to use a momentary switch, but rather, a sliding switch. As that is what most people use. Just a heads up if you wanted to add more features. Honestly, im sure this will help a lot of people so youve done enough. Thanks for posting!
Bunch of different shoulder button kits Sales Thread:https://sudomod.com/forum/viewtopic.php ... 192#p63192

AIO board for DMG Sales Thread:
https://sudomod.com/forum/viewtopic.php?f=38&t=6431

6 Button Common Ground Board Sales Thread: https://sudomod.com/forum/viewtopic.php?f=38&t=4811

User avatar
JamesW
Posts: 36
Joined: Wed Sep 27, 2017 4:45 pm
Has thanked: 12 times
Been thanked: 23 times

Re: DIY Safe Shutdown w/ PowerBoost

Post by JamesW » Fri Mar 23, 2018 3:47 pm

erik_gee wrote:
Wed Mar 21, 2018 11:46 pm
I believe I saw this diagram online somewhere as well. I think it was a video on soft latch switches?
These circuits are ones I made from scratch in the falstad circuit simulator, not nabbed from somewhere else, but I'm sure there are similar ones floating around. It's kind of like the guitar, there are only so many chords - it's all been done.
erik_gee wrote:
Wed Mar 21, 2018 11:46 pm
Instead of using 2 separate transistors, you can also use a dual mosfet ic, with n channel and p channel.
Yes, this would be a requirement for a generic booster which does not have the enable pin. I'll probably look at posting one for those as well. My favorite board to use for that is the Pololu mini mosfet board... Cheap and tiny. Add some parts and it's an easy safe shutdown board. https://www.pololu.com/product/2811
erik_gee wrote:
Wed Mar 21, 2018 11:46 pm
Also, there may be more interest for people who dont want to use a momentary switch, but rather, a sliding switch. As that is what most people use. Just a heads up if you wanted to add more features. Honestly, im sure this will help a lot of people so youve done enough. Thanks for posting!
As is, either of the circuits above will work with a sliding switch, you just lose the ability to have the pi power down the powerboost if the switch is on when there is a low battery condition. The pi would still power down but unless the switch was turned off, the powerboost will still be running.

I came up with this circuit for the NES controller project, where I needed a momentary for space savings, but I'll look into a design which allows for a regular switch and still shuts down completely when the battery is low.

User avatar
erik_gee
Posts: 343
Joined: Thu Jun 16, 2016 12:57 am
Location: United States
Has thanked: 133 times
Been thanked: 183 times

Re: DIY Safe Shutdown w/ PowerBoost

Post by erik_gee » Sat Mar 24, 2018 12:52 pm

Oh sorry I wasn't implying anything, my bad if it came across that way haha I was looking at soft latch switches for another project a while back and reminded me of it.

Thanks for the work, I'm sure it will help a lot of people 👍
Bunch of different shoulder button kits Sales Thread:https://sudomod.com/forum/viewtopic.php ... 192#p63192

AIO board for DMG Sales Thread:
https://sudomod.com/forum/viewtopic.php?f=38&t=6431

6 Button Common Ground Board Sales Thread: https://sudomod.com/forum/viewtopic.php?f=38&t=4811

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest