Watching the Lunar New Year celebrations last month, I began to think about our love of loud bangs and bright flashes. However, fireworks – such as small explosive firecrackers – have proved to be so dangerous they are banned in many countries, including the UK.
So I decided to make some firecrackers for myself – but ones that are legal and safe!
The firecracker idea
Make some ‘fake’ decorative firecrackers from plastic plumbing pipe. Attach some very bright LEDs or neopixels. Control the lights with a Raspberry Pi using Node-RED. Turn up the volume on a speaker and play ‘cracking’ sounds through it. And then add smoke from an electronic cigarette into the mix.
All triggered by a switch.
This blog is intended as a rough guide to what I did – it’s not a step-by-step instruction manual.
The total build cost was about £185 (parts listed at the end) – however, I am sure some savings could be made.
The E-cigarette in particular was fiddly to hack and each one will be different. However, you are welcome to take this idea and adapt it for your own use.
I’d love to hear what you make – let me know in the comments below.
This project uses a Raspberry Pi 3 to control everything, programmed using a Node-RED flow. I used pre-installed nodes, plus the Neopixel node. The complete flow is available on GitHub.
Some soldering was required in this project. The LED lights are WS2812B neopixels controlled via a 3V3 (3.3 Volts) to 5V level shifter.
For sound I use a USB audio adapter and a portable speaker. This is because there is a conflict between the neopixels and the normal audio jack. For the smoke, I hacked an e-cigarette and used glycerine, rather than a nicotine solution. I use an aquarium pump to force the smoke out of the e-cigarette and up the tube. These are both powered by a 30W Isolated DC-DC Converter. MOSFETs switch the e-cigarette and the pump.
A button attached to the GPIO pins triggers the firecrackers. However, I am tempted to trigger it from a motion sensor to make visitors jump.
The rest of the props are made out of things I had around – a two-litre fizzy water bottle, gold ribbon, a paper plate, plastic pipe and spray paint.
I used a function node to make the neopixels flash in order, and a delay node to make the flashes random.
When the lights were looking realistic, I moved on to the sound.
The USB audio adapter plugs directly into a USB socket, the portable speaker plugs in to the adaptor. The audio settings need to be set in the Raspberry Pi’s configuration settings (raspi-config). I also used the Linux program ‘alsamixer’ to set the volume. The firecrackers sound file was made by Phil Andrew. I found that using the Node-RED ‘exec node’ calling the ‘mpg123’ program worked best.
With lights and sound looking good it was time to make some smoke…
This was the trickiest bit. On an electronic cigarette, if you blow down the air-intake hole (not the outlet hole you would normally ‘suck’), smoke comes out the outlet hole. I attached an aquarium pump to the air-intake hole and the firecrackers pipe to the outlet, to make smoke on demand.
The e-cigarettes are not designed to be taken apart, and so I ended up attacking it, rather gingerly, with a pipe cutter – I knew there was a LiPo battery inside. The LiPo battery had no protection circuitry, and as I was hacking the ‘intended use’ I was a little concerned about using it. Commercial 3V7 LiPo batteries with protection circuitry do not have the current-handling capability to power the e-cig (it needs about 4-5A at 3V7). I also didn’t want to rely on battery power for the whole assembly. I therefore removed the battery and replaced it with a 30W Isolated DC-DC Converter. The isolation means the input has no electrical connection to the output – and therefore no high currents can accidentally pass through to the Pi’s circuitry. The model I used has an adjustable output voltage, so I could change the output from the nominal 3V3 to nearer 3V7 –the nominal voltage of a LiPo battery. (The information on how to do this is on the data sheet).
Using some silicon pipe, I attached the aquarium pump to the air-inlet of the e-cigarette. I taped up the remaining air inlet holes. I used MOSFETs connected to Pi’s GPIO pins to turn the pump and the e-cigarette on and off.
The Node-RED flow needed various delay nodes to get the timing of the smoke, lights and sound correct. I wanted the e-cigarette to heat up before I put the pump on. As the pump was very noisy, the sound needed to be on before the pump started.
Making it look good
I cut plastic plumbing pipe into short lengths – and used a longer piece for the smoke pipe. I spray painted the pipes. I have found that white primer made the red colour brighter and really ‘pop’ out.
Painted plastic plumbing
Nothing I had would make the pipe stick to the silicon cover of the neopixels (including Sugru and hot-melt glue). So I sewed them on with gold ribbon.
I drilled holes in the main smoke pipe to let the smoke out at different heights.
The base of the firecrackers was a fizzy water bottle spray painted gold. Most of the electronics, e-cigarette and pump fitted inside, with a hole in the bottom for the wires and also to let in air. The Raspberry Pi, speakers and button were left on the outside.
A fizzy water bottle sprayed gold
Roll on the 5th November, Diwali, and Chinese New Year 2018!
I hope you’ve gotten connected with me these last several weeks. I was talking to a colleague about why I wrote these. And it really comes down to one thing: IoT is taking place all around us. Are you and your company participating in the digital transformation, and impacting the physical world? Or are you […]