About this project
Hello everyone! I have finished designing a hardware power switch for the Raspberry Pi that communicates with the Pi. It has a micro-USB connector on one end so you can use your existing power supply. On the other end is a regular USB port for another micro-USB cable connecting the Pi to the switch. I've programmed an ATtiny85 microprocessor to use two leads that connect to GPIO pins and a tiny script runs in the background on the Pi . When you turn off the switch, it signals the GPIO pins and the Pi runs a safe shutdown sequence. Once the Pi has safely completed its shutdown, the switch then removes power. Press the switch again and the Pi boots up safely.
The switch is also capable of sensing when a software-shutdown has been issued independent of the physical switch and will cut power as necessary.
The switch can also be used to hard-restart a frozen Pi via a small tactile reset button.
The GPIO pins used by the switch are user-selectable in the script and the board is capable of handling 2A power supplies. Installation of the script to the Pi is simple - copy the script over to your Pi and add one line to your rc.local file. Instructions and the script will be supplied. You must be able to comfortably use SSH to install the script but I will also be including a video tutorial to smooth that process.
This switch is designed for users who don't use back-powering hubs. For users with a powered USB hub attached:
If your hub provides any back-power to your Pi and you're using a normal power supply to the Pi separately (this scenario is not recommended) then this switch will require disconnecting your hub each time you want to reboot the Pi).
If your hub is designed not to provide any back-power (this is recommended) then the switch will work as it does in the video but the switch will not cut power to your hub's devices - that would have to be done with the hub's built-in switch.
If your hub is being used to back-power your Pi (serving as the only power source to the Pi) then eventually I will provide a modified version of the switch with the appropriate USB ports to accomodate this (USB type A female which the USB hub upstream will plug into, then USB type A male on other end of switch will go directly into one of the Pi's USB ports). This will power-down your Pi but it will not power-off your hub. You will have to specifically message me if you need this version!
UPDATE: I have prototyped a version 2.0 (new after the video was posted) which has reduced the size of the switch by almost 40%! The shipping version will be the new and improved design :)
So far the switch has been tested on RaspBMC and Raspian distributions. OpenELEC should work as well by using the autostart.sh script, I am currently testing that.
Please note that the switch doesn't come with USB cables, you must use your own!
Risks and challenges
The only challenge which may arise is teaching novice users how to install the script via SSH. I will be posting a video tutorial to simplify that process and possibly creating an apt-get resource to auto-install once the project has fully completed.Learn about accountability on Kickstarter
Support this project
- (20 days)