Generating sparks

Hello!

I´m having some issues with with my project on arduino.

What I´m trying to do is generating sparks by sending signals to four ignition coils with digital outputs. I´m using inputs to decide which coil to "activate".

I´ve used a delay of 1ms to generate a spark that I´m happy with. Example:

void loop(){
digitalWrite(coil1, HIGH);
delay(1);
digitalWrite(coil1, LOW);
delay(1);
}

This generates a perfect spark.
Problem accours when I´m using "if" to activate 2 or more coils. Example:

void loop(){
if(digitalRead(4) == LOW) {
digitalWrite(coil1, HIGH);
}
if(digitalRead(5) == LOW) {
digitalWrite(coil2, HIGH);
}

delay(1);

digitalWrite(coil1, LOW);
digitalWrite(coil2, LOW);
delay(1);
}

This makes the spark bad ("slow"), and for some reason when I´m using Uno I get no spark at all if I active both sparks at the same time. This works when using Mega.

I´ve tried using millis() method instead of delay with same result.

Any ideas of how to get this to work, activating up to 4 coils from inputs and still get the 1ms delay sparks? I understand that reading inputs takes time, but there is probably a better way to do this :slight_smile:

All help appreciated :slight_smile:

/Stefan

generating sparks = generating RFI, Radio Frequency Interference. not cool. not wise.

Use Direct Port Manipulation.

If a pin is set to be output, and you write a 1 to its input port, the output will toggle.

PIND = 0b00000100; // change state of D2 on an Uno for example (high to low, or low to high)

PIND = 0b00001100; // change state of D3 and D2 together.

Give it a shot.

Without seeing your schematic of how you have this all wired up, I can tell you you have wiring problems and POWER problems, not software problems.

Paul

This is for igniting gas to flamethrowers (for a show). Outside, far from audience and only for seconds.

CrossRoads:
Use Direct Port Manipulation.

If a pin is set to be output, and you write a 1 to its input port, the output will toggle.

PIND = 0b00000100; // change state of D2 on an Uno for example (high to low, or low to high)

PIND = 0b00001100; // change state of D3 and D2 together.

Give it a shot.

Thank you! I will give it a try.

Paul_KD7HB:
Without seeing your schematic of how you have this all wired up, I can tell you you have wiring problems and POWER problems, not software problems.

Paul

Tried making a quick "schematic" in Power Point :slight_smile:

Everyone starts somewhere.. but a flamethrower? I’m assuming you’re new to hardware and programming since you’re using PowerPoint for a schematic, quick or not.

czu001:
Everyone starts somewhere.. but a flamethrower? I’m assuming you’re new to hardware and programming since you’re using PowerPoint for a schematic, quick or not.

The flamethrowers have been used for 3 years and is working just fine. But when igniting all flamethrowers at the same time spark gets slower and sometimes fails to ignite. That´s what I need help with.

I´m not that new to hardware and programming. In this case making a Powerpoint in 2 minutes is enough to explain how its wired in a forum instead of making a serious schematic. It´s a pretty simple wiring.

Please post a link to the ignition coil that takes a 5V signal.

Steffeluring:
I understand that reading inputs takes time

It does take time, but it's measured in the microseconds. If a matter of microseconds is important for your application, then use the technique suggested by CrossRoads to get it down into the nanoseconds range. However, I have trouble believing this is the source of your problem.

Steffeluring:
The flamethrowers have been used for 3 years and is working just fine. But when igniting all flamethrowers at the same time spark gets slower and sometimes fails to ignite. That´s what I need help with.

I´m not that new to hardware and programming. In this case making a Powerpoint in 2 minutes is enough to explain how its wired in a forum instead of making a serious schematic. It´s a pretty simple wiring.

Have you given any thought to using ready made gear for spark generator?
As an example, I use a four pin CDI control box along with a CDI GY6 coil, both available on Ebay and operated via a hall effect.
In this instance the hall could quite easily be replaced by an opto isolator which would resolve any interference problems.
Code then would be rather straight forward I would imagine.
Cost of the parts is around AU$15.00 delivered.

Per your “schematic”, if the output pin of an Arduino is being fed directly to the ignition coil, look no further, there’s your problem.

if the output pin of an Arduino is being fed directly to the ignition coil, look no further, there's your problem.

Which is exactly why I asked for a link to the device, reply #9.

The posted wiring "outline" leaves a great deal to the imagination.

Of cource I´m not feeding the coil directly from the Arduino, thort that was clear when I drawed the "signal" line. If thats what you mean :stuck_out_tongue: The coils uses ~6A@12V..Or do you mean the 5V signal?

I got it to work, the slow spark was just a programming issue. But for some reason I had to use Mega. When using Uno it freezes when using all flamethrowers at the same time. Will try using optocouplers next time to see if that helps.

Here a short clip of the flamethrowers live :slight_smile:

Thanks for helping

Remember if using opto isolators, for isolation and for it to work correctly, do NOT join the common line from your uC to the opto output.

I didn't see any feedback from the gas controller to avoid gas on / no ignition.
I presume that safety function is internal to the 'certified' gas controller

  • or you have a LOT of public liability insurance (which may not pay out anyway)