The Sleepy Pi 2 is designed in the physical HAT format and plugs into the GPIO header of the Raspberry Pi. The first job is to attach the 40-pin GPIO header that came with the Sleepy Pi 2 (either a stacking or low profile). This plugs into the 40-pin socket on the Sleepy Pi 2 through the holes in the underside of the board.
Power Options #
The next job is to decide how to power the Sleepy Pi 2. You have two choices for powering Sleepy Pi 2:
- Sleepy Pi 2’s 5V USB connector / 5V input pads, Or
- 5.5 to 30V via the external Power I/P Header
DO NOT power the Raspberry Pi from it’s own USB connection – the Sleepy Pi will not be able to control the power.
If you elect to use the external Power I/P header, then you can solder power leads directly to the Sleepy Pi 2 or solder in the supplied 2-pin screw terminal and screw leads into that.
If using a Raspberry Pi 4 – see this article on the best way to power it
Power up the Raspberry Pi #
When you receive your Sleepy Pi 2, the Arduino is programmed with the simple example sketch ButtonOnOff and the jumpers (more on these later) are set to make it compatible with a Sleepy Pi 1.
At it’s very simplest, with this sketch, you can attach power to the Sleepy Pi 2 and press the large User Button to power up the Raspberry Pi. The green Power LED will light showing that there is power to the Raspberry Pi which should now boot up.
If the Raspberry Pi has been configured for Sleepy Pi (see below), then pressing the button again for around 5 secs will trigger a controlled shutdown.
If your Raspberry Pi has not been configured to shutdown with the Sleepy Pi then just issue a
sudo shutdown -h now
and remove power once the Raspberry Pi has shutdown.
Setting Up The Raspberry Pi Software #
Before running the setup script it’s worth updating Raspbian or it may not run properly. This is good practice even if you have just downloaded the latest and greatest Raspbian, there are still other libraries that may have been updated. To update, make yourself a coffee (this can take a while) and do from the command line:
sudo apt update sudo apt full-upgrade
In order to support programming and safe shutdown, the Raspberry Pi needs to be configured to operate with the Sleepy Pi. This involves loading the Arduino IDE and configuring the system. The easiest way to do this is to run the Sleepy-Pi-Setup.sh script that can be downloaded from the setup Github page
If you’re brave, you can download the script directly from a command line with the magic incantation (note it is case sensitive and ‘master’ is lower case!):
wget https://raw.githubusercontent.com/SpellFoundry/Sleepy-Pi-Setup/master/Sleepy-Pi-Setup.sh
and it’ll dump it into whatever directory you are in.
To run the script, you first need to make it into an executable by:
chmod +x Sleepy-Pi-Setup.sh
Then run the script with administrator privileges with:
sudo ./Sleepy-Pi-Setup.sh
Answer the initial questions, then sit back, cross your fingers and have a G&T whilst the script scrolls past like a scene out of some hacker movie.
The script will do everything except setup the RTC for which you will need to refer to this page to do.
If you DON’T use the script and feel the need to do this manually, or you want more information about what it’s doing, you can look at the Setting up the Arduino IDE on Raspbian , Getting the Sleepy Pi to Shutdown the Raspberry Pi or the script itself.
If you are using the Real Time Clock, I recommend setting this up next.