Introduction: Raspberry Pi Prototyping Hat

Almost every Raspberry Pi project that I have ever worked on has needed at least two of the following: a power button, a means of cooling and extra voltage / gnd rails for prototyping.

I would find myself re-building the same fan enable circuit for every project and always needing a breadboard or perf-board for prototyping. After looking around, I could not find a Pi hat that provided all of these functionalities in one board so I decided to create the ultimate Raspberry Pi prototyping board, the proto-power-hat. This prototype hat is great for any and all your Pi projects.

You can find the original write up for the proto-power-hat on my personal blog and buy one on Tindie to easily get started!

Supplies

Step 1: Overview

Power Button:

The Raspberry Pi does not have a default on board power button. Since the Pi is a computer, it's important that you do not use the power plug as a means of turning it on and off repeatedly. It needs to be properly shutdown else issues will eventually manifest. But it can be a hassle having to run the 'sudo shutdown' command every single time. Luckily, the Pi can be configured to wake up and shutdown by grounding GPIO3. The proto-power-hat takes advantage of this functionality and provides an onboard power button with the option to use an external power button if needed. It also includes a LED power indication light.



Cooling:

Most Raspberry Pi projects run hot, especially when running for long periods of time in an enclosed environment. Most cheaper heatsinks are very small and do not provide adequate heat dissipation. The proto-power-hat comes with a small 30 X 30 mm fan mounted straight onto the hat for easy integration while keeping the Pi cool during high work loads. The fan is powered from a MOSFET low side switching circuit that get's enabled on wake up and turned off when the Pi is halted. Below is the simple schematics of the Raspberry Pi fan enable circuit. GPIO7 is enabled at startup which drives the FET gate, turning on 5V power to the fan circuit. The Pi power rails stay active during halt so this switching circuit means you can leave your Pi connected to power while it is in the "halted" state without wasting energy.


Prototyping:

The proto-power-hat has nine 5V rails, nine 3.3V rails and 21 ground rails. It also breaks out nearly every GPIO signal and includes a small 25mm x 35mm through hole prototyping area for building up external circuits.

Step 2: Software Driver Install

The software driver repository was forked from the following howchoo article, how-to-add-a-power-button-to-your-raspberry-pi.


Automatic Installation:

The easiest way to install the needed software drivers is to run the provided installation script as shown below:


git clone git@github.com:BradenSunwold/pi-power-button-with-fan.git
./pi-power-button-with-fan/script/install

This installation script automatically completes all of the steps in the manual installation guide below.


Manual Installation:

The software drivers rely on one main python script (listen-for-shutdown.py) which waits for a falling edge on GPIO3 to facilitate a soft shutdown and enables GPIO17 on power up to drive the fan enable circuit. This python script is wrapped into a bash script (listen-for-shutdown.sh) that is called on system startup and runs autonomously in the background. Take a look at these files to understand how they work and copy them into scripts on your Pi.

If completing a manual install, place the .sh script into the /etc/init.d folder and ensure that it is executable:


sudo mv listen-for-shutdown.sh /etc/init.d/
sudo chmod +x /etc/init.d/listen-for-shutdown.sh

Then register the .sh script to automatically run on boot up:


sudo update-rc.d listen-for-shutdown.sh defaults


Note:

The proto-power-hat uses GPIO3 as the wake and shutdown pin. The Raspberry Pi defaults this pin as the wake up pin and therefore this configuration has to use GPIO3, there is no way around it. The fan enable circuit is driven from GPIO17. The PCB was created using KiCad.

Step 3: Where to Get Hardware

The following repository has all the Gerber files needed if you would like to order your own Proto-power-hat directly from a FAB, https://github.com/BradenSunwold/RPi_Proto_Power_Hat/tree/master. A BOM (Bill of Materials) can also be found in the repository that outlines every needed part available from Digikey.

Alternatively, you can order this hat on Tindie, https://www.tindie.com/products/bare-naked-embedded/proto-power-hat-raspberry-pi-prototype-hat/.


Thanks for checking out my Raspberry Pi prototyping hat and happy making!


Make it Move Challenge

Participated in the
Make it Move Challenge