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.)
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.
DIY Safe Shutdown w/ PowerBoost
Re: DIY Safe Shutdown w/ PowerBoost
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.
Here is the link to the simulation.
- erik_gee
- Posts: 356
- Joined: Thu Jun 16, 2016 12:57 am
- Location: United States
- Has thanked: 137 times
- Been thanked: 193 times
Re: DIY Safe Shutdown w/ PowerBoost
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!
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!
GBC AIO kit Sales Thread:https://www.sudomod.com/forum/viewtopic.php?f=38&t=9928
Bunch of different shoulder button kits Sales Thread:viewtopic.php?f=38&t=6233&p=63192#p63192
AIO board for DMG Sales Thread:
viewtopic.php?f=38&t=6431
6 Button Common Ground Board Sales Thread: viewtopic.php?f=38&t=4811
Bunch of different shoulder button kits Sales Thread:viewtopic.php?f=38&t=6233&p=63192#p63192
AIO board for DMG Sales Thread:
viewtopic.php?f=38&t=6431
6 Button Common Ground Board Sales Thread: viewtopic.php?f=38&t=4811
Re: DIY Safe Shutdown w/ PowerBoost
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.
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
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.erik_gee wrote: ↑Wed Mar 21, 2018 11:46 pmAlso, 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!
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.
- erik_gee
- Posts: 356
- Joined: Thu Jun 16, 2016 12:57 am
- Location: United States
- Has thanked: 137 times
- Been thanked: 193 times
Re: DIY Safe Shutdown w/ PowerBoost
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
Thanks for the work, I'm sure it will help a lot of people
GBC AIO kit Sales Thread:https://www.sudomod.com/forum/viewtopic.php?f=38&t=9928
Bunch of different shoulder button kits Sales Thread:viewtopic.php?f=38&t=6233&p=63192#p63192
AIO board for DMG Sales Thread:
viewtopic.php?f=38&t=6431
6 Button Common Ground Board Sales Thread: viewtopic.php?f=38&t=4811
Bunch of different shoulder button kits Sales Thread:viewtopic.php?f=38&t=6233&p=63192#p63192
AIO board for DMG Sales Thread:
viewtopic.php?f=38&t=6431
6 Button Common Ground Board Sales Thread: viewtopic.php?f=38&t=4811
Who is online
Users browsing this forum: No registered users and 1 guest