Power Switch Part 1 - WyrmTech

Go to content

Power Switch Part 1

Pi Bits > Power Switch
The Circuit

Having done some fiddling with the Pi Zero W and Volumio I now wanted a way of turning off the player.
Volumio has a Shutdown option from the menu, but this only shuts down the Pi, leaving the display on and power running to the Pi, I thought it would be nice to have power removed completely after shutdown to save unplugging the Pi.
Scouting around I found the Pi Supply Switch and this article from the Raspberry Pi Geek from 2013. now I may be wrong but looking at the (tiny and blurry) circuit diagram from the Raspberry Pi Geek and the board layout from the Pi Supply switch I'm guessing that the design is the same for both and this is the circuit diagram as I see it.
The link to the Schematic on the Pi Supply site is broken, but they do state that the files are released under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported licence, so I'm putting up my version of what I think is their design.



Circuit description:
  • When the relay is off and 5V is supplied to the input, the input voltage is connected through the NC contact and Common on the relay and then through R6 to charge the capacitor.
  • Once the voltage across the capacitor has risen, it provides bias to the base of Q2 to turn it on which turns on Q1 (Q1 and Q2 are set up as a darlington pair), which will connect one end of the relay coil to ground.
  • When the power-on button is pressed the relay is turned on. This then allows power to be supplied to the output.
  • As the relay common switches from NC to NO, it also causes the capacitor to slowly discharge. After about two minutes, the capacitor will drain to a level where it can no longer keep the transistors on, which will cause the relay to switch off (removing power from the output). This behaviour is not what you want, so the following section of the circuit will allow it to maintain power to the output.
  • Applying power from one of the Raspberry Pi GPIO pins, (pin 8 or another pin of your choosing) to J3 will begin to apply voltage to C1 and keeps the capacitor charged, allowing the transistors to remain biased on and the relay powered. This output will also supplies power to the LED and also provides a 3.3V source for the safe shutdown switch – the safe shutdown switch routes this 3.3V from J4 back to a GPIO pin set to an input which, in turn, triggers a safe shutdown to be called within the system.
  • When a shutdown is initiated (either using the soft shutdown switch provided, a terminal window, or the built-in LXDE functionality), the GPIO output will be dropped. This will cause the capacitor to begin discharging, and after about two minutes , the relay will switch to its initial state and the power to the Rasp Pi will be dropped.
  • You can then start the Raspberry Pi again using the On button.
  • The Off switch is rather brutal, it immediately applies 0v to the base of Q2 thereby turning off the darlington pair, removing power to the relay and dropping the output voltage. this is the same as yanking the power cord out of the Raspberry Pi, with the possiblity of corrupting the SD card.


Visitor Number:
Back to content