Halloween Pumpkin Light Effect Tutorial
While browsing the Halloween section of my local supermarket, I stumbled across this adorable pumpkin light for £2. Given the fact I had a £2 coin in my pocket and an itching for a Halloween hack project, it came home with me at once.
You’ll see, if you look hard enough, the small orange LED within the plastic shell. Controlled by a switch beneath, the light was less than impressive once illuminated.
And so the hack seed was planted.
Now, I’ll admit to not having much coding knowledge. But what I lack in skills, I make up for in charm, and it didn’t take long for me to find help from a couple of Raspberry Pi staffers.
Pimoroni had been nice enough to send us some Blinkt! units a while back and while one is being used for our People in Space Indicator, I’d been wanting to use one myself for some sort of lighting effect. So, with their Getting Started guide in hand (or rather, on screen), I set up the Raspberry Pi 3 that lives on my desk, attached the Blinkt! HAT and got to work on creating this…
If you’d like to create your own pumpkin light effect, you’ll need:
- A Raspberry Pi (Make sure you use one that fits in your pumpkin!)
- A Pimoroni Blinkt!
- A power supply (plus monitor, mouse, and keyboard for setup)
- A pumpkin
Take your Blinkt! and attach it to your Pi. If you’re using a 1-3 model, this will be easy enough, but make sure the Pi fits in your pumpkin! If, like me, you need to go smaller, you’ll have to solder your header pins to a Zero before attaching the HAT.
You might want to make sure Raspbian is running on the newest version. Why? Well, why not? You don’t have to upgrade to PIXEL, but you totally should as it’s very pretty. Its creator, Simon Long, was my soldering master for this project. His skills are second to none. To upgrade to Pixel, follow the steps here.
In the terminal, you’ll need to install the Pimoroni Blinkt! library. Use the following to achieve this:
curl -sS get.pimoroni.com/blinkt | bash
You’ll need to reboot the Raspberry Pi to allow the changes to take effect. You can do this by typing:
At this point, you’re more than welcome to go your own way with the Blinkt! and design your own light show (this may help). However, and with major thanks to Jonic Linley, we’ve created a pumpkin fire effect for you.
Within the terminal, type:
git clone https://github.com/AlexJrassic/fire_effect.git
This will bring the code to your Raspberry Pi from GitHub. Next, we need to tell the Raspberry Pi to automatically start the fire_effect.py code when you power up. To do this, type:
At end of the file, add this line:
Save and then reboot:
Now you’re good to go.
To add more of a spread to the light effect, I created a diffuser to cover the Blinkt! LEDs. In the video above, you’ll see I used a tissue. I wouldn’t suggest this for prolonged use, due to the unit getting a little warm; I won’t be responsible for any subsequent tissue fires. I would suggest using a semi-opaque bowl (the ones you get a Christmas pudding in) or a piece of plastic from a drinks bottle, and go to town on it with some fine sandpaper.
We also drilled a small hole in the back for the micro-USB lead to reach the Zero. I used a battery pack for power, but you could use a lead directly into the mains. With a larger pumpkin, you could put a battery pack inside with the Pi.
If you use this code, please share a photo with us below, or across social media. We’d love to see what you get up to.
And if you want to buy the Blinkt!, the team at Pimoroni have kindly agreed to extend the cut-off for postage on Friday from midday to 3pm, allowing you the chance to get the unit through your door on Monday (so long as you live in the UK). You can also purchase the Blinkt! from Adafruit if you live across the pond.
“if you live across the pond”
A very big pond, it seems!!
It’s quite a common idiom in the UK
It’s an age thing. I’ve been calling the Atlantic Ocean “The Pond” for thirty years and more. It was a thing that was common when I worked for IBM and corresponded with my international colleagues. In IBM we even labelled the two sides as Leftpondia (aka America) and Rightpondia (aka UK/Europe), I don’t know how common that is or whether it was just an IBM thing.
The best name was for Perth, Western Australia which was known by some folks as “Outer Pomgolia” because so many Brits (aka Poms) had migrated there.
BTW, well done Alex on you £2 purchase and re-purposing a Blinkt and publishing your code on Github.
Another “pond”: here in New Zealand, we term the Tasman Sea The Pond, Aussie the West Island. Halloween is not (yet at least) as big an event, we go more for Guy Fawkes (to the consternation of dog/cat/horse owners). I suppose that’s the Brit/Colonial part of our history.
I did this as well (although the pumpkin decoration we found on this side of the pond cost $3 and had a lonely white LED in it, instead of orange).
One difference in my project was that I used Pimoroni’s Unicorn pHAT, rather than Blinkt!. This makes the finished project brighter and able to use more complex patterns at a tradeoff of about 3x the cost of the Blinkt!.
Also, I’ve found that wax paper makes a decent diffuser for these, as well as being a bit more temperature resistant than tissue paper. :)
One other improvement to this project: Run raspi-config to turn off the X server – it’s not needed, and will only slow down the boot process (especially on the single-core Zero!). You can run the python script out of /etc/rc.local instead to have it start on boot.
I haven’t put my code up on github yet (I will, I promise!), but I’m using a script which has a number of patterns defined as functions (including a flickering candle pattern, which is a slightly slowed-down version of Pimoroni’s ‘random_blinky’ Unicorn example script), and uses signals from an external script (called via cron) to choose a random pattern to display on the Unicorn. I haven’t looked to see how compatible the Blinkt! is with the Unicorn, so ymmv.
Thats very impressive, I am also running a Piglow on the original model B using crontab to kick it off on boot. On the Zero I am running the rainbow.py program in the blinkt directory using the following:
Open a terminal and type crontab -e
Scroll down to the bottom on the last line do the following:
@reboot sudo python /home/pi/Pimoroni/blinkt/examples/rainbow.py @
If you no longer want it to boot up on the display just remove the bottom line.
I have never run a Pi headless, how do you switch it off ‘safely’?