DIY Safe Shutdown w/ PowerBoost
Posted: 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.)
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.
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.