Raspberry Pi Power Switch Circuit - Page 1
Forum section: electronics / projects

author: Quatrerwin
author_rank: Unknown
timestamp: March 16, 2017, 05:08:00 am
content: I've been designing a power switch circuit for the Raspberry Pi Zero. It uses an Adafruit Powerboost 1000C along with a DPDT switch.Once the Raspberry Pi is off, I would like to disable the Powerboost (pulling the enable pin down to ground). I have a circuit that should work using diode logic, but I would like something more power efficient.The thought behind it is that the Powerboost will remain disabled until either the VS and LBO are high (3.0V - 5.2V) or the 3.3V or a GPIO pin on the Raspberry Pi are high (3.3V). I've found a couple CMOS logic chips that can do an AND-OR with those voltages, but I don't know how to control the P-Channel JFET with the output from that. I'm not even really sure where to start. Would anyone have any advice for the circuit to help make it more feasible/power efficient?Here is the circuit I've been creating (Note that only one side of the DPDT switch is shown. The other side just signals to the Raspberry Pi to shut down):Powerboost pins:BAT- this is the battery input, connected directly to the JST connector. For most Lithium batteries, this will range from 3.0V when near-dead to 4.2V when fully-charged. Higher voltages will let you draw more current and in general, are more efficient. Try to keep the wires going to this pin nice and short - 3" or less is best!VS- this is the load shared output from the battery charger. When there is 5V coming in from the micro-B USB power plug, this pin will have approx 5V on it (less a little due to the internal resistance of the charger chip's MOSFET). When there's no USB charging, theVspin will be the same voltage as theBATpin.GND- this is the power ground. This boost converter is not 'isolated' - the ground input is the same as the ground output5V- this is the boosted output. When the board is running, the voltage will be 5.2V approximately. It may dip down to 5V as the current draw starts to go up (over 500mA). When the board is disabled, this output is 'floating' but you should still try not to apply a voltage to it while the board is disabled. There's a blue LED connected to this pin which will let you know when there's power outputEN- this is the 'enable' pin. By default it is pulled 'high' toVS. To turn off the booster, connect this pin to ground. The switch can be as small as you like, it is just a signal. Contrast this to an inline power switch which would have to be able to handle up to 2A of current! When the chip is disabled the output is completely disconnected from the input.LBO- this is the Low Battery Output. By default it is pulled high toBATbut when the charger detects a low voltage (under 3.2V) the pin will drop down to 0V. You can use this to signal when its time to shut down or alert the user that the battery is low. There is also a red LED connected to this pin

author: danadak
author_rank: Super Contributor
timestamp: March 16, 2017, 01:03:37 pm
content: Basic PChan needs a + gate V to turn it off.So select a FET with a Vth that meets your logic level out of the CMOS gate. If youneed inversion translate your AND-OR to NAND-NOR logic and or use the inversionin the NAND-NOR to invert any signals to meet the logic requirements. But you haveto raise the gate to Vth + Vs. Without seeing the rest of the power domain schematicI cannot tell whats driving use of the PFET.Worst case you can always use a charge pump to get extra gate drive, or a diodemultiplier off CMOS grunge oscillator circuit.http://electricalengrz.blogspot.com/2013/05/aoi-logic-to-nand-or-nor-logic.htmlhttp://stackoverflow.com/questions/9845684/how-to-convert-a-boolean-expression-from-and-and-or-to-only-nandOne alternative is use of a low end UP, like a PSOC 4000 series part,use it to do the sequencing and logic, then a more simplified interfaceto actual power routing components should be achievable. Sleep modewould enable power conservation as well. Like a 4013, << 50 cents.Has internal reference and comparator.Regards, Dana.

author: Quatrerwin
author_rank: Unknown
timestamp: March 16, 2017, 03:06:48 pm
content: That was pretty much the complete circuit. There were a couple of transistors to bring up some of the voltage levels to make the FETs work (Unfortunately I don't have them in the notes I can find). The toggle switch is a modified DPST switch where it has 4 pins (2 pins connected when in the off position and a different pair of pins connected when in the on position). I could replace it with a DPDT switch if necessary. The other pins connect a GPIO pin on the Raspberry Pi to ground when the switch is in the off position, pulling the GPIO pin low. As for the Powerboost, Adafruit has a schematic here:https://learn.adafruit.com/adafruit-powerboost-1000c-load-share-usb-charge-boost/downloadsThe logic gate was stumping me because it has a negative current when the condition is true. I needed a positive voltage to turn on the P-Channel JFET. The source of the P-Channel JFET is normally at 3V - 3.7V (the same as the BAT pin on the powerboost) when the Powerboost is enabled.

author: danadak
author_rank: Super Contributor
timestamp: March 16, 2017, 10:15:25 pm
content: You have a classic high side switching problem, that is in generaldone with a boostrap/boost circuit, or possibly depletion modemosfet with its gate puled up to drive voltage, and an open drainor collector drive to ground connection to gate.Regards, Dana.

author: Quatrerwin
author_rank: Unknown
timestamp: March 16, 2017, 11:00:09 pm
content: That's quite a bit to look up! I'll look into those and see what I can come up with. In the meantime, I'm not particularly attached to the circuit if there's a better way to do it. Really the requirements are as follows:If the switch is moved to the "on" position, enable the Powerboost (this is done by disconnecting the EN and GND pins on the Powerboost).If the switch is in the "on" position, but the LBO pin is pulled down to 0V disable the Powerboost (unless the Raspberry Pi is on).If the Raspberry Pi is on, do not disable the Powerboost.If the switch is moved to the "off" position, signal the Raspberry Pi to shut down, but do not disable the Powerboost.If the switch is in the "off" position and the Raspberry Pi is off, disable the Powerboost (connect the EN and GND pins on the Powerboost).The Raspberry Pi seems to operate its GPIO pins at 3.3 V for high and around 0 V for low. The Powerboost outputs at USB voltage (5 V) or battery voltage (3.0 V - 3.7 V) for high and around 0 V for low.This is my first attempt at really designing a circuit from scratch (I'm a software developer who is starting to get into electronics design. I had a fairly basic circuits course as part of my physics major in college).

author: technix
author_rank: Super Contributor
timestamp: March 17, 2017, 12:16:47 am
content: I think that there is a driver in the Pi kernel, selectable through the device tree overlay, that can hold a GPIO pin in some known state when the kernel is up, and release it after all other parts of the kernel is down.