Pages: [1]   Go Down
Author Topic: 12 Volt Trigger  (Read 1280 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello all. New to the arduino and I am looking for the answer to a question that I can't seem to find anywhere. I hope you guys can help.

I am looking at building a fireworks 12 cue sequencer off an arduino that triggers off of a 12 volt pulse from another firing system that in turn runs the programmed sketch. The "main" firing system would send a 12 volt 1-2 second pulse out of it's cue triggering some sort of sensor, mabey an optoisolator, which would close the circut hooked into the arduino input(s) and run the sketch. The outputs would close another optoisolator or relay allowing 12 volts from the units internal battery to flow out and fire the e-matches. Just wondering if this could be acomplished with the any of the arduinos, making the output(s) "look" for a ,for better words, "continuity" signal to run the sketch. I've see many of the sensors that can be used, but none of the fit the project. Any help would be greatly appreciated. Thanks smiley
Logged

0
Offline Offline
Shannon Member
****
Karma: 215
Posts: 12455
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Opto isolator sounds a good choice.  Sketch just has to 'busy-wait' for its signal before doing its thing, no problem there.
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How and where in the sketch does this command need to be? I'm trying to grasp the programing of the sketches by going thru the tutorials, but I haven't seen this mentioned in any of them. I just need the arduino to wait for the trigger then output to the first pin (cue 1) immediately with a 1 second pulse. Then output to the next pin (cue 2) at a user defined timing delay with a 1 second pulse so forth and so on until all cues are fired. Any help on the programing side would be appreciated. Also how would the optoisolator be connected to the input pin on the arduino for it to read the input? Will my 12 volt source need a resistor of some sort so that the current doesn't destroy the optoisolator?  Thanks.
Logged

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

Quote
How and where in the sketch does this command need to be?
Normally in the loop() function.

Code:
void loop () {
   if (digitalRead(triggerPin) == LOW) { // assumes the opto is wired to pull pin low
       // sequence code here
   }
}

However if you only want this to run once you can put it in the setup() function.

Quote
Then output to the next pin (cue 2) at a user defined timing delay with a 1 second pulse so forth
I'll get into trouble for using delay() here but for this simple application I would suggest something like this.

Code:
void loop () {
   if (digitalRead(triggerPin) == LOW) { 
       digitalWrite (seq1Pin, HIGH)
       delay (1000);
       digitalWrite (seq1Pin, LOW)

       digitalWrite (seq2Pin, HIGH)
       delay (1000);
       digitalWrite (seq2Pin, LOW)

       digitalWrite (seq3Pin, HIGH)
       delay (1000);
       digitalWrite (seq4Pin, LOW)
   }
   while(1);  // if you don't want this to run a second time, OR put this in setup()
}

If you have a LOT of sequences (did you say 12?) then an array would be better.

Code:
byte pins [] = {2, 3, 4, 6, 8, 9, 10, 11, 18, 23, 44, 51};  // whatever pins you are using
const int N_PINS = sizeof (pins) / sizeof (pins[0]);
 
void loop () {
   if (digitalRead(triggerPin) == LOW) {
       for (int i = 0; i < N_PINS; i++) {
          digitalWrite (pins[i], HIGH)
          delay (1000);
          digitalWrite (pins[i], LOW)
      }
}

Quote
how would the optoisolator be connected to the input pin on the arduino for it to read the input?
Emitter to GND, collector through a resistor to VCC (the resistor can be omitted if you use the Arduino's inbuilt pull up resistor). Collector to Arduino pin.

Quote
Will my 12 volt source need a resistor of some sort so that the current doesn't destroy the optoisolator?
Yes, value depends on the opto's LED but about 1k should be OK.

______
Rob
« Last Edit: May 19, 2011, 05:34:49 am by Graynomad » Logged

Rob Gray aka the GRAYnomad www.robgray.com

Red Sea, Saudi Arabia
Offline Offline
God Member
*****
Karma: 12
Posts: 579
..On The Red Sea
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

...Also how would the optoisolator be connected to the input pin on the arduino for it to read the input? Will my 12 volt source need a resistor of some sort so that the current doesn't destroy the optoisolator?  Thanks.

Yes, you will need a resistor to limit the current to optoisolator inputs to an appropriate value.. Probably about .02A  (20mA).. So it would be something like 12V - OptoDiode drop (say 1 volt), so the resistor drops 11V @ .02A  so R=E/I  so R= 11/.02 =550 ohms. So 470 ohms would be good...   

For the outputs to fire typical electric matches, I think a relay would be best. I like these (disclaimer: from my shop and others) :

http://arduino-direct.com/sunshop/index.php?l=product_detail&p=156  which are also Optically isolated and could be located some distance from the Arduino, closer to the 12V firing source and matches.  You could run 4 circuits over CAT5 cable, and use standard connectors for use in the field. 

These relays have LEDs that show when the relays are active, so you can test from a distance with the firing source DISconnected.  I assume you are safety oriented and experienced and have all or most of your fingers. 

The Nomadic coder has a real good start on that...

Let is know how it all goes, or goes off.
Logged

Regards, Terry King  ..On the Red Sea at KAUST.edu.sa
terry@yourduino.com  LEARN! DO! (Arduino Boards, Sensors, Parts @ http://yourduino.com

Pages: [1]   Go Up
Jump to: