DIYGadgets

Build | Fix | Re-use

Controlling Fireworks With a Raspberry Pi

Check out this great tutorial by Chris Osborn over at Intentricity. Power is provided by a 12V sealed lead acid (SLA) battery. I have the 12V battery go into my switch box which has two lighted switches on it, the output of one switch goes to the switching regulator to power the Pi, the other switch has one of those flip-down safety covers and goes through the relays to the fireworks.

 

 

To ignite the fireworks you need something called a squib or e-match. The ones I make use nichrome wire and a paper match. I’ve written an article on that previously, and here’s a video showing how I put them together.

 

 

After getting the hardware assembled the next thing was software. I re-used the web interface that I wrote for the laptop years ago and made a quick and dirty Python script that could run as root to control the GPIO. In order to get the script to run as root I used sudo and allowed the web server to call sudo without a password. Yah, it’s a security hole but the Pi was going to be outside on the lawn with no internet access so one of my guests would have to hack it during the 15 minutes or so that the Pi would be booted up running the show.
With the web interface working and able to control the relays I needed a way to access the web interface. Instead of dragging a monitor & keyboard & mouse out, I chose to use a pocket computer that I have: an iPhone. To use the iPhone I would need to be able to connect it to the Pi wirelessly. Since the Pi would be in the backyard far away from any internet access, the Pi itself would need to act as a WiFi access point.
The only USB WiFi adapters I have are the Edimax ones. There are several tutorials out there on how to setup a Pi as an AP and get hostapd running. The stock hostapd that comes with raspbian doesn’t support the Edimax, but all the tutorials either provide a custom version of hostapd, or tell you where to download it and compile it yourself. Nothing worked though. The Pi would broadcast the SSID, but whenever I tried to join the network it would always fail.
In desperation and with time running out I jumped on Amazon to see if they sold any of the other WiFi adapters that were known to work with the stock hostapd. They had the Panda Ultra with 2 day Prime shipping, so I ordered a couple. When they arrived I plugged one in and after restoring the stock hostapd it worked! Hurray!
For whatever reason though, only two of the eight things I wired up worked. As I activated each I could see the nichrome wire glow red hot but for some reason the match or the fuse didn’t light. I think for next time I will put some resistors on the 12V power to limit the current to the nichrome so it will stay red-hot without vaporizing.
Main parts:
  • Raspberry Pi model B
  • AC/DC 9-48V To 1.8-25V 3A Switching power supplies (eBay link)
  • 5V 8 channel relay modules (eBay link)
  • 74HC595 shift registers

 

Original Source Here.

Leave a Reply