Intelligent Power Supply Switch For Raspberry Pi
The Pi Supply Switch is the solution to un-controlled Raspberry Pi power switching issues. This product is an “intelligent”, ATX style power supply switch for the Raspberry Pi. It allows you to leave all of the power wires from the “wall wart” all the way through to the Pi permanently connected with just the quick push of a switch to turn the power on or off.
Once you have finished using your Raspberry Pi, you just shut down using the sudo halt command, and then a couple of minutes after the full and safe shutdown the Pi Supply Switch cuts the power to the computer. From this point, once again, all you need to do to restore power to the Pi is touch the ON button.
There is also a hard power off button for use in emergencies which immediately cuts the power to your Raspberry Pi. Remember to only use this button when absolutely necessary (e.g. Pi has been frozen for a long time) as it risks corruption of the files on your SD card if done at the wrong moment.
- Press the On button to power on the Raspberry Pi.
- Press the Off button to cut power to the Raspberry Pi. This is the un-controlled shut-down.
- Press briefly the Soft button for a controlled shutdown of the operating system. After 2 minutes the power is also cut off.
- Press the Soft button and keep pressed for a reboot.
Remember to install the code before connecting the switch to the Pi!
- Login via SSH or via the console.
- Run the following command and Pi Switch will be setup and installed:
curl -sSL https://pisupp.ly/piswitchcode | sudo bash
With this new script any standard pin can be chosen to provide the function previusly covered by pins 7 and 8. Within softshut.py you can change the assignement which by default is
PinSeven = 7
PinEight = 11
This means that pin 7 coming from the Pi Switch goes to pin 7 on the Raspberry Pi and that pin 8 from the Pi Switch goes to pin 11 on the Raspberry Pi.
PiSwitch 7 <---> RPi 7PiSwitch 8 <---> RPi 11
Remember that the notation used is the physical notation only.
Note that the file to be changed, once the installation has been carried out, is located under /opt/piswitch/softshut.py and will need to be edited as root
sudo nano /opt/piswitch/softshut.py
- Code Examples (GitHub Repository)...
- Pi Supply – ATX style power switch for Raspberry Pi – Review...