Pages: [1]   Go Down
Author Topic: Firework Launch System.  (Read 1548 times)
0 Members and 1 Guest are viewing this topic.
Horwich, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I have recently purchased an Arduino Mega, with the view of using it to control a firework show on November 5th at home.

My concept is to have a firing panel :



From this i am hoping to use the Arduino to control relays via the digital outputs, to switch 18V across the ignitors for the fireworks.

I have been reading through a few threads on the net where others have done similar things using Arduino, and i have got some ideas for coding and usage,  I am hoping what i wish to achieve is actually possible.

I would like to use this code on each level of my firing system menu:

Code:
#include <stdio.h>
#include <stdlib.h>
// Written by: Steve Ries http://steveries.com on 2/23/12 Rev v1.1
// Please feel free to change and distribute freely, however I do ask that these credits remain intact
// Only ADD to the credits if you ADD code, but NEVER REMOVE anyones credits.
// Thanks ~Steve~


// Define Global Vars and Sets up unit for your particular hardware

// Set this number to your Start Fire Input Pin
#define StartFire 0
// Set this number for your TOTAL number of Firing Ques in the system, 0 does not count as a number here. 13 means 13 (ALSO HAS NO RELATION TO ANY PIN NUMBERS AT ALL).
int NumCues = 13;
// Define ALL your Output pins, and WHAT ORDER THE PINS FIRE IN! You must have exactly the same number of these as you have NumCues defined above
int PinFireOrder[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
// Define ALL your Delays BETWEEN each Pin. IE: The first delay number here is wedged after Que 1 fires and before Que 2 starts
// So TOTAL you should have 1 less than your TOTAL Number of ques, Because there is no delay before Que1 and No Delay after the Last Que (Only in between Ques)
// Delay times are in Miliseconds, There's 1000 ms in 1 Second (IE: 500 is 1/2 Second)
int PinFireDelay[] = {500, 200, 500, 200, 500, 200, 500, 200, 500, 200, 500, 200};
// Set this to your desired Firing Output (Pulse) Time in ms (This time MUST complete before the PinFireDelay Time STARTS to count down.
// IE: PinFireDelay is set to 500, SO Pin will go high for 250 ms and then start to count down the 500 ms
// Meaning if your que actually lights up in 5 ms into the 250ms pulse, your next que will not fire for 245ms + 500ms = 745ms!!!
int PulseTime = 250;


//All Code Below THIS LINE should NOT be changed or adjusted!!!! (Unless you REALLY know what you are doing!)
int PinSetup = 0; //Dont change this! It's for seting up outputs later in the code
int CurrentPos = 0; // Dont change this!! It's for keeping track of what que the system is on in the sequence

//Declare Pins as Input or Output
void setup()
{
  //Sets Sequencer Input as Input
  pinMode(StartFire, INPUT);
  
  //Sets all previously defined firing Pins as Outputs
  PinSetup = 0;
  {pinMode(PinFireOrder[PinSetup], OUTPUT);}
  for (PinSetup = 0; PinSetup < (NumCues - 1); PinSetup++)
  {pinMode(PinFireOrder[PinSetup], OUTPUT);}
}

// Code for Running the Full Sequence
void StartSeq()
{
  // Fires first Que with requested pulse time.
  digitalWrite((PinFireOrder[CurrentPos]), HIGH);
  delay(PulseTime); // Waits requested pulse time before shutting off pin (Firing)
  digitalWrite((PinFireOrder[CurrentPos]), LOW);
  
  // First Que is done, now looks for ques in a loop to fire and delay, until it reaches the max number of ques defined above
  // Loop looks to see if any Ques left, if so; then waits requested delay time in between ques, then fires next que for requested pulse time, then loops
  for (CurrentPos = 0; CurrentPos < NumCues; CurrentPos++)
  {
    delay(PinFireDelay[(CurrentPos -1)]);  // Waits requested Delay time in between Ques before firing
    digitalWrite((PinFireOrder[CurrentPos]), HIGH);
    delay(PulseTime); // Waits requested pulse time before shutting off the pin (Firing)
    digitalWrite((PinFireOrder[CurrentPos]), LOW);
  }
}

//Main Program Loop (Just Keep Looking For Firing Input Until It sees it)
void loop()
{
  //Monitor If Fire0 Goes High, Then Start FireNextCue Code
  if (digitalRead(StartFire) == HIGH) {StartSeq();}
}

I will maybe have to tweak this for the ground show, as i dont want everything going off to quick and ending up with 10/15 roman candles all running at once..

I need to figure out my firing system menu, and how to code this and include the firing steps.

Any help or guidance would be greatly appreciated.

Moderator edit: quotes swapped for CODE TAGS.
« Last Edit: October 24, 2012, 11:45:37 am by AWOL » Logged

Horwich, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My proposed firing menu.

Quote
**** Firework Firing Menu ****

> Rockets >> Rockets Tier 1
   Ground      Rockets Tier 2 >>> Ready To Launch ?  >>>>  ARMED       (Fire Button Used to Initiate Firing sequence)
              Rockets Tier 3   





**** Firework Firing Menu ****

   Rockets     Ground Group 1
> Ground  >> Ground Group 2 >>> Ready To Fire ?  >>>>  ARMED       (Fire Button Used to Advance Firing sequence through cues)
                   Ground Group 3   




I want to use the N button as a back/No button which will drop the menu back one step.
Logged

PA
Offline Offline
Newbie
*
Karma: 0
Posts: 24
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Base on your drawing it looks like you have a lcd, though I don't see any lcd code. Jsut a side note to your question.

I am not a a arduino master though I have learned a lot of the last few years of making projects using them and I am not a fire works expert. Frankly I was shocked I can buy e-fuse and other pieces off line with no questions asked. Now based on that statement I will give you some insight to save you some headache and issues later.

1: When wiring the the e-fuse to the relay make sure you wire it so it is in the off position to the button is pushed. (lesson learned), test the relay wiring with a sensor or something else to see the state of it before wiring the fuse to it.

2: Make sure your buttons have debounce statements in them as not to get confused on pushing them, vs holding them and so on. this is a common issue when using buttons and the arduino and could cause pre-mature firing. The example code you provided looks to have this functionality. Make sure if you change the code around you keep that.

3. I like the idea of the N button like an abort. You could possibly add a time out too. If a option is not selected in 10 seconds then back out. I would suggest maybe adding some security to it as well so not any one can use it. For example a keycode or a electronic lock that when you insert the key closes the circuit allowing the firing button to be used with the program.

That is just my two cents. Good luck.
Logged

USA
Offline Offline
God Member
*****
Karma: 14
Posts: 644
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm not a firework expert, but with this type of project it's always good to have redundant safety systems.  You didn't mention any physical interlocks on this unit.  I would include at least one on either the main power or the signal out of the control unit.  You can get a key switch/key lock fairly inexpensively (don't let the first few items listed in the link scare you smiley-wink, Sparkfun also has some though they don't have voltage and current ratings).  Of course you'd generally have to pay a bit extra for non-generic keys, but that likely isn't a requirement for this project.  Otherwise, the most basic are similar to what you'd find on bike locks or locks on IT equipment.
Logged

New Hampshire
Offline Offline
Full Member
***
Karma: 4
Posts: 179
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Not that it'll be much help. I will say that menu systems can be a bit annoying (lotsa if then statements)

As far as your LCD dispaly, It might help to mention what kind you're gonna try. Theres several pretty easy ones https://www.sparkfun.com/products/256 Is quite easy to use. though you might have trouble putting your whole menu system on it.

For this you could probably do somethign like this

***FIRING MENU***
Rockets>>>
>Ground>>>    

as 1 screen, (the > before ground would be the indicator you move around to choose). Then say after picking ground. It clears the screen and does somethign like this.

***Ground Menu***
>Ground Group 1
Ground Group 2
Ground Group 3

Then picking Group 1

***Ground Group 1***
Ready To Fire? (Displays, then when clickign yes the next line)
**ARMED** (holds here until fire is pressed, then shows next line for a couple seconds)
**FIRE!!** (Shows for a couple seconds, then brings back to the ground menu or something)






Oh yeha you said you have a mega, this will be very important, but never tell the thing to try and display !!!, theres somethign wrong with the 3! that causes a problem with the code, Hence why I only put 2 of them after FIRE


My worthless 2 cents though. I can give you a bit of a sample of a previous menu code that i had for a datalogger project before to show you my (albiet inefficient way) of navigating menu screens.
« Last Edit: October 24, 2012, 12:16:33 pm by Nikarus » Logged

Horwich, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Base on your drawing it looks like you have a lcd, though I don't see any lcd code. Just a side note to your question.

Hi, yes received a 20*4 LCD Today.

Just been playing with the LCD learning scripts this morning, and now need to write the firing menu script.

Logged

Horwich, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I do plan to have a safety system, and this will be built into the firing circuit by way of a key switch to isolate the power for the ignition side.

@Nikarus if you do have some snippets of code i can look at for the menu system that would be great.

I will pop my circuit ideas up shortly.
Logged

USA
Offline Offline
God Member
*****
Karma: 14
Posts: 644
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I do plan to have a safety system, and this will be built into the firing circuit by way of a key switch to isolate the power for the ignition side.

Great, I just wanted to make sure you thought about it.
Logged

Maine
Offline Offline
Sr. Member
****
Karma: 14
Posts: 417
Caution: Explosives in use.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I just read through this quickly, so I apologize if this has already been mentioned, but another good thing to do is to separate the Arduino power supply from the supply used for ignition. That way if the igniters cause the voltage to drop below the acceptable threshold for the 5v regulator on the Arduino,  your control box wont reboot on you. It might also be a good idea to have the igniters physically disconnected from the control box while the Arduino is booting, so floating pins wont cause a misfire.
Logged

"Anyone who isn't confused really doesn't understand the situation."

Electronic props for Airsoft, paintball, and laser tag -> www.nightscapetech.com

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8524
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

One of the guys here (liudr) has an LCD menuing system, he sells the hardware which of course you could buy to save a lot of time but maybe the software is OS if you want to DIY.

http://liudr.wordpress.com/libraries/phi_prompt/

EDIT: From his site

Quote
The library is free for personal use.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Horwich, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Rob, that looks like a great idea. Hope i can find a UK stockist of his PCB.

I will have a look at this a bit more tonight.
Logged

Pages: [1]   Go Up
Jump to: