Halloween is the time of year when makers add LEDS and sound effects to cheap goodies bought at pound shops and supermarkets.
I saw this skull in my local Asda, and thought it was ideal for a bit of modding. The cranium is quite rigid, and as it’s hollow there’s room to put stuff inside it. I used my Dremel to drill a 3mm hole in each eye socket, and to cut a square out of the bottom to allow access. I threaded orange LEDs through the hole in the base to each eye hole, and secured them in place with a dollop of hot glue, which also gave the LEDs a nice diffuse look inside the eye socket.
The plan was to have the eyes gently puslsing and to make spooky sound effects play as trick-or-treaters approached. I have a PIR detector in my box of bits and so I connected it to a Raspberry Pi and used the examples from the gpiozero documentation to write some code to use the sensor as a trigger. I’d tried using this sensor before for something and couldn’t get it to work, and again it defeated me. I’m sure there’s a trick to setting the sensitivity pot just right on these things, but I couldn’t make it work so chucked it back in the box for another day.
Instead I decided to add a button so the trick-or-treaters can scare themselves by playing the sounds if they’re brave enough! The illuminated arcade button that came as part of the Google AIY kit with issue 57 of the MagPi was perfect!
Sounds are played with a Pimoroni Speaker pHAT (I love these). I got the audio files from a Spooky sounds CD I bought at Woolies years ago. It plays just over an hour of gruesome sounds, and I edited a few short samples from it to use here.
Having got the electronics and software working I made a stand out of plywood, drilled holes for the button and to allow wires to pass through into to skull, and painted this black.
Paint it black
Once the paint was dry I put all the bits together. Having glued the LEDs to the skull earlier I had to take unfasten them now to let me hide the Raspberry Pi underneath the stand. Threading the wires from the Raspberry Pi, through the top of the stand, into the skull and then into the small holes in the eye sockets was tricky, but some patient fiddling about helped me get there. Really this is just a new version of the box of horrors I made at Halloween a couple of years ago, just don’t tell anyone I’m recycling my ideas!
Inspired by Les Pounder’s hacking, I spent a quid on some LED pumpkin lights and thought I’d make something fun for the trick-or-treaters this year. I wanted the lights to come on and a spooky sound effect to play when a button is pressed on my little box of horrors.
As Les suggested I removed the battery box from the LEDs, and then extended the wires with some hook up wire. I also found and edited some nice spooky sfx, which I saved onto the Zero.
The Raspberry Pi Zero has no audio output, so I added a pHAT DAC from Pimoroni; remembering to use extended headers so I could later add a ProtoZero board to tidily solder the wires onto.
For the first prototype I connected the LEDs to a GPIO pin and the ground pin and started by writing some code that just made them come on and then go off again after a few seconds. Next I added a button which switched the lights on. Finally I used Pygame mixer to play the audio file at the same time as the lights come on.
The code looks like this:
# Import Python libraries
# Set the GPIO caming convention
# Set the GPIO pins for button input and LED output
I went back to my favourite Instructable on launching Python scripts at startup and then set about cramming it all – including USB powered speakers and a USB power bank – into a Celebrations box that I’d kept because it looked useful. I drilled a small hole in the side to pass the LED’s wires through, and a big hole in the lid for an arcade button. It’s a bit of a squeeze to get to the lid on, but it all just about fits in.
There are plenty of things I could do to make this better. For instance…
At the moment it plays the same sound every time the button is pressed, but it’d be nice to play a random selection from a playlist of sounds
The lights could flicker and flash while the sound plays instead of being constantly on
If the sounds are of varying lengths the lights should only be on for as long as each sound plays
The lights and sounds could be swapped for Christmas or other gaudily celebrated occasions
Spray paint and decorate the box to be a bit less chocolate-boxy