256 Channel Firework Controller

Use two cheap 16-relay boards to multiplex and remotely control up to 256 channels of firey madness

Similar projects worth following
We had a bit of the neighborhood 4th of July party last year. Let's just say it involved people not putting bottom caps on their launching tubes, lots of fuses taped together, and flying pvc shrapnel. This year, we're doing things right. For the betterment of all mankind, we will leverage commodity hardware in a synergistic manner in order to provide the maximum return on investment with the minimum of impalement.

The basic concept for this project is a matrix of individually switchable terminals that will be connected to electrical firework igniters. The igniters don't need a ton of current, but given all the noise that must inevitably result from firing, I chose to switch the matrix using opto-isolated relay boards.

The first revision uses a pegboard substrate for the matrix. This is incredibly cheap, but a lot of work to solder. Since I had a lot of time to think while soldering, I was able to come up with a design that can be constructed out of reasonably-sized PCBs.

Another interesting improvement involves the use of CAT5 and RJ45's to connect the matrix to the igniters. This will need some testing as I'm unsure if the RJ45 connectors will withstand the currents involved.

Video of V1 firing:

  • 1 × Raspberry Pi Model B
  • 2 × 16x opto-isolated relay board (ebay, ~$15)
  • 2 × mcp23017 Microprocessors, Microcontrollers, DSPs / IO Controllers
  • 1 × 5v regulator going to try to use one of those in-car dealies, but might need something beefier
  • 1 × Car battery yes yes, deep cycle marine yadda yadda, but I have one of these

View all 7 components

  • 16x Board Design

    Aleks Clark07/06/2015 at 18:15 0 comments

    I'll be using this to prove out the concept of an RJ-45 based interconnect

  • I2C woes

    Aleks Clark07/05/2015 at 12:41 0 comments

    well, it half worked :P There was a significant amount of rain on the day, and despite multiple layers of tarps, we ended up with some water on the electronics, which wasn't good. The video shows how it worked while it was working. Even getting it to work for a little was problematic, one of the i2c chips just refused to have a reliable connection. Stay tuned for an in-depth assessment of why things didn't go well, and lessons learned from actually having to set up ~160 channels worth of igniters.

  • Sequencing

    Aleks Clark07/04/2015 at 15:44 0 comments

    I'll have all the codes up on github after launch, but this is what the running firing sequence looks like this (the interval between firings was switched from seconds to milliseconds to make the video shorter)

  • Igniter Cables

    Aleks Clark07/04/2015 at 15:41 0 comments

    Well, this morning finished assembling igniter cables. Definitely going the RJ45 + push lock terminal route next time, something like:

    The current process goes like this:


    separate wires on a piece of cardstock

    add hot glue

    press down

    rinse, repeat many times

  • Victory!

    Aleks Clark07/02/2015 at 17:56 1 comment

    Ok so hanging out in the collaboratorium turned out to be profitable - @Blecky prodded me until I figured out my problem with i2c. One of the MCP23017's had its SDA/SCL lines swapped, so every time I 'fixed' one, the other failed. Also, the RPi has pullups, so the pullups I added were not helping things.

    After my i2c woes were sorted, I was able to successfully fire some igniters, whoo! 300ms is a bit short, I had to run the sequence a couple times to get them all to fire, so I'll use 600ms, and just write some code for firing groups simultaneously. Now it's time to make a bunch more cables.

  • Testing!

    Aleks Clark07/01/2015 at 10:35 0 comments

    Well, small update cause the 4th is nearly upon us. Took the board outside, and it decided not to work. Yay. The problem seems to be on the i2c bus and/or the power/ground lines. I will either need to slow it down ( ) or add additional pullups on the power lines. Unsure why it started failing all of the sudden, unless the humid air outside added capacitance somehow.

  • Power & safety

    Aleks Clark06/29/2015 at 14:14 0 comments

    So we definitely want to make sure nothing fires while putting things together. To that end, the relay boards will be powered separately from the RPi, and the actual firing power will be on yet another circuit. My junk stash yielded up this box, which was previously used for an arduino-powered quiz button system:

    The existing nintendo power button will switch 12v to the relay board, and a salvaged printer power switch (the green blob in top/left) will switch firing power. Firing power will likely be 12v but it could turn out to be 48v if voltage drop is too high. I'll be adding binding posts for each circuit and screwing the box to the main sheet of plywood.

  • looks like we'll make it...

    Aleks Clark06/29/2015 at 11:27 0 comments

    The 4th is nigh but assembly is going smoothly. Still need to do some testing, but most of the boards are mounted in place. The terminals on the left were salvaged ones I hoped to use, but after I got started soldering them, I realized it would be nearly impossible to wire them since the wire openings face downwards.

    Scraping enamel off of magnet wire has been the least favorite activity in this project.....

    Here we can see the "bus" for one of the igniter power sides: just some thick solid core wire bent into a U-shape and partially stripped.

  • Blinky Blinky

    Aleks Clark06/10/2015 at 12:26 0 comments

  • Should have read the datasheet

    Aleks Clark06/10/2015 at 12:14 0 comments

    Well, word of warning: the MCP23017 is definitely not indestructible. Second, NEVER hook up something that SUPPLIES 5v to a sainsmart 16 relay module unless the sainsmart is being supplied with 12v. The 5v will flow at high currents, seemingly powering the onboard regulator and making things "kind of" work for a bit, then the regulator gets hot, etc. It was bad.

    Read the datasheet, not just the pinout :D

    Here's the final protoboard, which ended up toast:

    You can see where I severed the 5v connection in an attempt to salvage things. Fortunately I got 5 of the MCP23017, so we're not doomed yet!.

    Subsequently, however, I put things on a breadboard:

    And finally, I wrote up some go code to make clicky-blinky things happen!

View all 13 project logs

Enjoy this project?



Hollla wrote 09/01/2016 at 11:56 point

Hi Aleks,

nice project. I have almost the same setup for my openhab. Pi, MCP23017 and the 16 relays board.

I was as surprised as you that the relay board need the input set to high to do nothing.

I wonder how you handled it. I'm using a script which is executed via /etc/rc.local:



import sys
import smbus

bus = smbus.SMBus(1) 

# set IODIR to output and set all pins to high




This works fine after the pi booted. Now the problem I have is that the mcp23017 keeps loosing the information that all the pins are output pins.

I couldn't find your files on github, I'd like to have a look at them, maybe you can upload them somewhere.



...btw. do you share your wives baby belly photos next to your firework photos intentionally?

  Are you sure? yes | no


[this comment has been deleted]

loldavid6 wrote 10/05/2016 at 13:32 point

I thought they were illeagal 'cause they contained mercury thiocyanate.  Well, at least they are where i'm from

  Are you sure? yes | no

Craig Hissett wrote 07/01/2015 at 10:55 point

I can't wait to see this running!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates