The software

 Sold out 

 
The Turnoffee-Pi is not much use on its own. Software is needed to monitor for button presses and to perform some action in response to it being pressed. You can write your own (perhaps using the WiringPi GPIO interface library), but you can also download a script that was written for the Raspbian operating system. This software takes the form of a python script monitoring the interrupt of a specific GPIO pin, and is called "turnoffee.py". The turnoffee.py script is not supplied as part of the kit, but is provided as a courtesy when purchasing an item.
 
When the Raspberry Pi boots up, a green LED lights up on the Turnoffee-Pi to indicate that the Raspberry Pi is powered up and running. In addition, when the turnoffee.py software starts, a red LED lights up to indicate that the button is being monitored. On being pressed, the red LED starts to flash, with increasing frequency until a 20 second countdown period has expired. At this point, the red LED goes out completely, and the Raspberry Pi starts its safe shutdown procedure (similar to a "sudo halt" command being issued). This will take less than a minute, and during this time, the green LED stays lit. When the green LED goes out, it means that the Raspberry Pi has completed its shutdown procedure, and it is safe to pull the power plug and/or remove the SD card etc. You can see this in action in our YouTube video by clicking here.
 
The script makes use of an interrupt based handler, which, for the purposes of this type of device, is far more efficient in terms of CPU usage than a polling method. When working with relatively low powered devices like the Raspberry Pi, this is a critical consideration.
 
turnoffee.py can also be run in test mode, and can be set up to run automatically when the Raspberry Pi is booted. Full details are provided in the instructions that accompany your purchase, via a download link.