Spooky build status indicator.
This project makes use of the following:
- Pumpkin - Carve a real one or you can always 3D print one
- Raspberry Pi Zero WH (UK, US)
- Pimoroni Unicorn pHat (UK, US). Note discountinued now so you might want to try the Unicorn HAT Mini instead
- Micro SD Card (UK, US)
- USB power - I used the official Raspberry Pi Charger (UK, US) but you can also power with a USB battery pack.
3d Printed Pumpkin
For the 3d printed pumpkin case, you will need:
- Glow in the Dark PLA Filament for body (UK, US)
- Green PLA Filament for top (UK, US)
- Adafruit Panel Mount Extension USB Cable - Micro B Male to Micro B Female [ADA3258] (UK, US)
- 4 x M2.5 threaded brass inserts (UK, US)
- 4 x M2.5 male PCB standoffs & screws - keep a kit of these handy if you don't have some. (UK, US)
When ordering online, while Amazon (US) and Amazon (UK) are always handy places (especially if you are a Prime member) I also highly recommend AdaFruit for electronics purchases in the US and PiHut in the UK. They basically should just park a truck at my house and take all my money.
Format the micro SD Card and install Raspberry Pi OS Lite. If installing onto a Pi Zero you might not have the keyboard and HDMI adapters lying around so you probably want to do a headless install, configuring SSH and WiFi by dropping an
ssh file and a
wpa_supplicant.conf file onto the root of the SD card after copying over the Raspbian files.
You'll need to install the Unicorn HAT software but they have a cool one-line installer that takes care of all the dependencies including Python and Git.
\curl -sS https://get.pimoroni.com/unicornhat | bash
In addition, we'll be using the
requests module in python so after installing the Unicorn HAT software, install the
requests module with the following command
sudo pip install requests
Next you want to clone this git repo. I have it at the root of the standard
git clone https://github.com/martinwoodward/PumpkinPi.git
You need to modify the settings to point at your build badge. First of all copy the sample settings provided in the repo:
cp ~/PumpkinPi/src/local_settings.sample ~/PumpkinPi/src/local_settings.py
Then edit the
BADGE_LINK variable and point at the URL of your Build badge.
# Build Badge for the build you want to monitor BADGE_LINK = "https://github.com/martinwoodward/calculator/workflows/CI/badge.svg?branch=main" # How often to check (in seconds). Remember - be nice to the server. Once every 5 minutes is plenty. REFRESH_INTERVAL = 300
Finally you can run the script as root
sudo python ~/PumpkinPi/src/pumpkinpi.py &
Once you are happy everything is running how you want, don't forget you can run the script at boot time. The easiest way to do this is to use crontab. See this cool video from Estefannie over on the Raspberry Pi blog to learn more. But basically do
sudo crontab -e then add the following:
@reboot /bin/sleep 10 ; /usr/bin/python /home/pi/PumpkinPi/src/pumpkinpi.py &
Note that we are pausing for 10 seconds before running the python script. This is to allow the network to come up. We could make the python script more resilient to network outages and/or start up the script using systemd.