Approach to control 9 model "fog" cannons

Please let me know if there is a more appropriate place to post this topic.

Totally new to Arduino. Bought a starter kit and have written VERY basic sketch to flash some LED's.
Old guy, and this is not coming easy, so any help appreciated. I'll try the whole code sequence after confirming the approach (and maybe consulting some 12 year old geniuses :slight_smile:

Objective:
Use Arduino to control a series of events that will sequentially "fire" nine model ship cannons.
The cannon fire is simulated by the same approach used in e-cig's - a hot coil vaporizes a polyol fluid on a wick and an air stream then condenses it into a dense cloud of "smoke".

The board needs to output three functions for each of 9 cannons: activate heater coil (12VDC, 4A), activate solenoid air valve (12VDC, 20mA) and activate an LED (12V, 5mA).

I have relay boards to handle the heater and solenoid loads.

The approach is outlined in the attachment.

The questions I have are:

  1. Is this a reasonable control approach?
  2. What board is most appropriate?
  3. Is the relay board specified OK? (I already have 3x 8 ch boards)
  4. Does the relay output still require a damping capacitor (or whatever it's called)?
  5. Can I write just one sequence code (all cannons need the same operation) and repeat it with the starting overlap shown in the timeline?
  6. How to I start the sequence using one channel from a radio-control Tx/Rx?

Note...this is a new, simpler approach than the system I posted about a couple years ago.
Thank you.

  1. Yes
  2. If the size isn’t an issue, a Mega would make the job easy since it has enough I/O without resorting to multiplexing methods.
  3. Mosfets would much smaller and more reliable long term but relays are cheap and easy. You’re three relays short for nine cannons.
    4.Yes, the solenoids require a diode across the coil to absorb the inductive energy released from the collapsing magnetic field of the solenoid when the relay opens. The heater coils and led’s do not require diodes.
  4. Yes, it could be a table driven program where the table defines the I/O points.
  5. It doesn’t matter what or how the sequence is started. Any event will do. Switch, radio, photoeye, whatever.

Have a look in the example programs for “blink without delay” for a starting point. You do not want to attempt this using the delay() function due to the overlapping events.

  1. Probably yes.

  2. This depends on what else is connected. What triggers the firing? A button = use any Arduino. WiFi = use an Arduino that has WiFi.

  3. Probably

  4. Always good practise to include a flyback diode. Not technically required for a purely resistive load like yours.

  5. Learn to use arrays

  6. OK, here's where you introduce new information that should have been up top.

Thanks for all the quick response...much appreciated.

#3, I was planning to use relays for the heaters and solenoids, but not for the LED's. So 18 relays for the cannons, one relay for the main air solenoid - total 19. I thought the LED's could be driven right from the board?? Can they? In testing the design, I used 12V and resistor for the LEDs, but they require only 3.4V, 20mA.

#5, will look at arrays and blink without delay.....thanks for references.

#6, Now planning to use an RC Rx activated switch as a trigger.

Will do schematic next....leave the program for last....being a chicken....

Hi,
Can you post a link to the cannon smoke generator please?
I have a model railway application that it may suit.

Thanks.. Tom... :slight_smile:

DanLRC:
#6, Now planning to use an RC Rx activated switch as a trigger.

That would work. You could get by without it though and just have the arduino read the signal from your RX receiver. Sparkfun tutorial on how to do it here: tutorial

Awesome project!

You might consider Bluetooth to trigger with your phone

Also is it possible to fire the cannons with slight variations so as to not all fire exactly together?

#3) Every Micro-controller has a limit to total board power. Part of the engineering is that you determine the maximum possible current consumption. As well as the minimum possible and of course the expected power.

So the correct answer is arrived at by summing all power as if all pins were activated at the same time, then compare that to board power specs. Then add your safety margin. Some of us use 50% some use 20%.

#4 ) you did not post a link to the relay boards. Most commercial relay boards have all the proper wiring and such. All you need is to provide a signal. For the smaller boards (1-2 relays) it is often 5v, on the higher density boards you bring the signal to ground.

Based on the fact that you purchased boards I would believe that all you need is a signal and that the diode is already in the board.

==================

As for the times in the program, it appears that the firing of one smoke cannon is a set sequence of events on a rather close timing circuit.

When you set SM1 the sequence of events would be important to keep the timing for that smoke cannon and not let some other part of the program alter that timing.

It seems you have the power parts pretty well in control
it seems you have this well thought out.

lastly think I am on safe ground in that most of the answers are from people who have seen decades pass since they blew out the 12 candles on their birthday cake. I have seen half a century since......

wolframore:
Awesome project!

You might consider Bluetooth to trigger with your phone

Also is it possible to fire the cannons with slight variations so as to not all fire exactly together?

post#1 has an attachment with timing.
looks like the goal is to fire 1, pause, 2, pause, 3 pause..... just like in the movies
those pauses might be in low digit seconds or fractions thereof.

DanLRC:
#3, I,snip> I thought the LED's could be driven right from the board?? Can they? In testing the design, I used 12V and resistor for the LEDs, but they require only 3.4V, 20mA.

there lots of on-line LED calculators, no reason you cannot use 120VAC, a resistor and and LED.... the engineering allows such things. 12V is fine, and you would feed the 12V to the resistor, then the LED, then to a pin on your board and bring the power to ground to get it to light. this is not board supplied power, but it is current that the board has to pass so you do need to calculate maximum, worst case to make sure your board can handle the total current of the worst possible case use.

It sounds like you are really more into the effects and there are a lot of times you can use the data sheets and engineering to get things to dance to your tune.

a common LED has a general, steady state current consumption of 20mA..... generally speaking.....

but, you do not have a general application, you have a specific application.

if you look at the data sheets, most common LED's can take a 50mA pulse and flash a bit brighter.
there are times when we cannot power 20 LED's at a constant 20mA, but we can fool the human eye.
we perceive the flash, but then if the light is gone, there is a POV or Persistence of Vision. a repetitive flash can APPEAR to be a constant light. Ergo the POV thing. you can power 5 at a time, pulse them, but for the human eye, it would appear to be all 20 at full brightness and use a smaller power supply.

in your HollyWood use, theatrical lighting for effect... you may be able to get a bit more light out of an LED by controlling The power and timing to your advantage. pulse, but more power.
This can get more brightness, but not overheat the LED. you need to look at your timing to make sure it conforms to the spec in the data sheet.
Since this is not beginner stuff, you would need to get the LED's from a reliable source and get data sheets from a known manufacturer whose data sheet you are using.

Lastly for a bright flash, you might look at something closer to a camera flash circuit/light
not sure of the size of the model, but it might be fun to look at the options.

TomGeorge:
Hi,
Can you post a link to the cannon smoke generator please?
I have a model railway application that it may suit.

Thanks.. Tom... :slight_smile:

Hi Tom,
Have built smoke generators for RC model tanks, ships, trains, etc. PM me your email and the RR scale/size info and operating voltage and I can send you build details and parts, etc if desired.
Best,
Dan

Wow...thank you all for the quick and extensive feedback!
I have the mechanical and basic electronics (LEDs, relays, etc) covered, just not at all familiar with boards and programming.
Here's an attached video of the prototype system in operation on a 7 foot long, 1/24 scale brig. The prototype used a compressor to supply air and a custom built, multi-contact rotary switch to trigger the heat, air and flash functions. II miniaturized the air supply, improved the gun design....now I need to get rid of the rotary switch (big, unreliable, hard to optimize timing) and replace it with reliable electronics.

wildbill:
That would work. You could get by without it though and just have the arduino read the signal from your RX receiver. Sparkfun tutorial on how to do it here: tutorial

wildbill....Thank you!!! No idea the Rx could control the board directly! That opens up a ton of possibilities to control the complex sails, rigging, rudder, etc in the large model sailing ships. Amazing. I have a lot to learn.

AWESOME VID's !

I can see plans for your smoke generator on the tank for the diesel exhaust as it starts to move !

I love how the whole tank shakes a bit when it fires.

dave in nj...

Thanks for the extensive response.

  • Link to relay boards is on the drawing attachment in the original post.

  • Total power output....never thought of that. I'll post a power summary here later to see if I understand this correctly.

  • Superbright LED's were powered by 12V in prototype...forget what R value I used, but it was calculated to flash the LED's "hot", which gave sufficient light output even outdoors. I plan to power the LEDs directly off the Mega LED outputs using resistors to control LED current.
    Question 1...can the board max current output to an LED be specified in the program?...so no R
    needed?

  • Overlapping times...I'm trying to get familiar with the "blink without delay" approach. The "array" approach would be next if that doesn't work. It will take me some time to learn these approaches.
    Question 2... for the timeline that I show in the attachment, can't I just write a series sequence of commands as long as none occur at the same time? I'll re-ask this Q after laying out a command sequence.

Again, thanks all for the help.

Hey Dan I think it would be fine to trigger the led together with you air solenoid so you can reduce the pin count. You would only need 18. I imagine the heater coils need a head start. Thanks for sharing the video. It’s very cool and would love to see a mini version blowing smoke that smells like different things :smiley:

Do they have blackpowder flavored vape oil?

DanLRC:
Wow...thank you all for the quick and extensive feedback!
I have the mechanical and basic electronics (LEDs, relays, etc) covered, just not at all familiar with boards and programming.

as I see the programming
once you set smoke_Cannon_1 to fire
the heater is turned on
2.5000 seconds later the solenoid is opened
2.600 seconds from start the LED is turned on
2.7 seconds from start, the LED is turned off
2.9 seconds, the LED is turned on
3.2 seconds, it is turned off
3.3 seconds the heater is turned off
3.7 seconds the solenoid is turned off

all the while that this is going on, other cannons are in similar sequences, but at different points in them.
blink without delay is your friend here.
there is a main system clock that you can use to access for timing.

start = millis() will set start to that point in time.

fire1 gets it's value from your switch or other input.

if fire1_active == 0 ; // ready
start1=millis() // keeps start1 at 0 until fire1 command is given
if (fire1 == activated) // this is your command to fire
fire1_active = 1 ; // sets the flag to show it is in the timing cycle
digitalWrite(heater1, HIGH)

see how you set start1 with a system time.
but then it will not change that as long as you are in the active loop after the fire command is given.

fire1_timing = millis()-start1 ; // this would do the stopwatch math function and constantly set the time since start
it would be 0 all the time, until the fire1 command is given and start1=millis() is no longer being set on each loop.
start1=millis() will record the time that the fire1 command was given and not be re-set until after the entire firing sequence is complete.

if fire1_timeing >= 2500 // 2.5 seconds
digitalWrite(solenoid1, HIGH) // after 2.5 seconds open the solenoid
if fire1_timing >= 2600 // 2.6 seconds
digitalWrite(LED1, HIGH)
if fire1_timing >= 2700
digitalWrite(LED1, LOW)
if fire1_timing >= 2900
digitalWrite(LED1, HIGH)
if fire1_timing >= 3300
digitalWrite(LED1, LOW)

if fire1_timing >= 3500
digitalWrite(heater, LOW)
if fire1_timing >= 3700
digitalWrite(solenoid1,LOW)
fire1_active = 0 ; // resets the flag to show it is in the timing cycle

since after 3700 milliseconds have passed, and the entire firing sequence has run it's course, you can re-set the fire1_active flag so that this timing loop will only see a 0 millisecond result.

this is not real code but if you look at it, you can see how you have one running clock time for one cannon as the stopwatch for that cannon.

it allows you to have other cannons have their own times.
if you look at the timing, you can easily set the milliseconds at any stage so you can create the timing effect you want.

this NOT code, but a general idea of only one way you could do this.
this is more for your understanding of one way to use the system clock, millis() for your project.

this is really not working code because it does not prevent the bits to turn on when they should be off, or turn off, when they should be on.

you would want to say

if 2500 milliseconds have passed.... I want to turn on the solenoid and then leave it on
if 3700 milliseconds have passed, turn it off and leave it off

but, since 3700 is greater than 2500, the first 'turn on' will turn it on, but and instant later it would be turned off because it was over 2500, but also over 3700...

you should say, if it is over 2500 and also under 3700, turn it on.

there are other ways, but for a single timing process, I find this easy to follow and understand

or, you can add a flag that knows it is on.

if solenoid1 == LOW

if fire1_timeing >= 2500 // 2.5 seconds
digitalWrite(solenoid1, HIGH) // after 2.5 seconds open the solenoid

this would prevent it from being turned on a second time, but adds more lines (clutter) when discussing the general idea.

Dave - wow...thank you for the coaching on this. Really appreciate your time.

Here is my analysis of max current based on the timeline (attached).
At most, 4 total outputs covering three guns will occur at the same time. Here are the two max current situations:

  1. At time about 3.0 sec:
    heat relay 1 ON: 5V, 20mA
    air relay 1 ON: 5V, 20mA
    LED 1 ON: 5V, 15mA
    heat relay 2 ON: 5V, 20mA

TOTAL board output: @5V, 75mA, 0.375W for guns 1 and 2

  1. At time about 3.5 sec:
    heat relay 1 ON: 20mA
    air relay 1 ON: 20mA
    heat relay 2 ON: 20mA
    heat relay 3 )N: 20mA

TOTAL board output: @5V, 80mA, 0.4W for guns 1,2 and three (or subsequent guns in set).

EDIT: forgot relay for main air relay...add another 20mA to totals...so 100mA max total at any time.

So...given that repeat "shots" through 9 guns never requires more than 100mA total from the Mega at any time, the board is well within the spec of 40mA per pin, but what is the max spec total output for the board? I don't see that in the specs I found.

Looked back in posts....didn't list spec for the relay boards.

They are Elegoo 8Ch 5VDC Relay Module with Optocoupler.

From Amazon:
https://www.amazon.com/dp/B01HCFJC0Y/ref=biss_dp_t_asn

Loved the video, adding a scripted, random component would be also nice.

Could your power supply support 2-3 going off at once at spaced intervals?