Arduino Spark Coil control for Wire Fence

Hy I am working on a Wire Fence project where Spark Coil will be used as energizer...

Will this work?
Voltage Reg. would be controled over PWM for Spark Coil voltage.
8kHz Switching is necesery for Coil to make spark...

Is this ok?
Thank you all!

No it will not work.
You don't use a voltage regulator like that.
You have no capacitors on the voltage regulator.
You do not feed a starter coil with PWM.
Just use one FET to control the spark coil and just piles it slowly in software, once every two seconds is enough.

5V Voltage regulator is used correctly. Dont know what could be wrong here?
The upper tranzistors are 2N3055. The right one works for voltage regulation, and the left one for switching frequency which is necessary for Spark Coil to work.

Why wouldent this work?

I need to regulate voltage on the spark coil from 0V - 24V.

5V Voltage regulator is used correctly

OK you asked and I answered. You obviously know more that me I have only been doing electronics for 45 years so what do I know?

If you are not willing to accept the answer then why ask the question.

I will try one more time.
The voltage regulator at the top is used incorrectly, I don't know what you think it is doing but it is not the way to use a voltage regulator. The are used for supplying power to a circuit not for conditioning signals.

The voltage regulator at the bottom has no capacitors on input or output, it may function but will probably oscillate. In either event it is not stable.

Sory, I didnt want to offend you in anny wey. I am a great programer but a bead electrician. It's just frustrating me, it should be so easy but it is not :frowning:

Grumpy_Mike:

5V Voltage regulator is used correctly

OK you asked and I answered. You obviously know more that me I have only been doing electronics for 45 years so what do I know?

If you are not willing to accept the answer then why ask the question.

I will try one more time.
The voltage regulator at the top is used incorrectly, I don't know what you think it is doing but it is not the way to use a voltage regulator. The are used for supplying power to a circuit not for conditioning signals.

The voltage regulator at the bottom has no capacitors on input or output, it may function but will probably oscillate. In either event it is not stable.

OK, loose the top regulator. Put a resistor in series with the base of the transistor, and add 0.1uF caps on each side of the 5V regulator, then feed it in the +5 pin not the Vin.
Add a reverse biased diode across the start up coil.

You don't need to switch this coil with PWM. Just turning it on and then off is enough to generate the spike you need. I assume there is some other circuit that actually connects to the fence.

Thank you for your help! I appreciate it.
I'll look into about voltage regulators and capacitors.
The resistor on base is for current limiting, thank you. I forgat about that :wink:

My Coil doesent make a spark if i only tourn it on and then off. Its from an old car :blush:

It would be great if i could control the length of spark time (how long the spark is active). That means it has to be switched for longer period of time (max 1second) at some frequency (8khz?). Is this posible with Arduino? Can this switching be done with PWM? And how?

I hope this isnt to much of a project for me hh, i usually don't give up on any project :blush:

There is no additional circuit. The coil is connected directly to the fence. I already have a program that will control this, but it lacks the switching part of coil.

/*
 * This is Arduino code for driving the StartupCoil
 * It is using 3 Potentiometer for Voltage, On time and Off time control.
 * And one button for switching betwean Run and Setup mode.
 */
 
 /* Coil must be switched at 8kHz for making sparks */

//Devices pins
byte VoltOutPin = 1;					//PWM output to the switching transistor
byte VoltRegPin = 2;					//Potentiometer for output voltage control
byte TimeIntRegPin = 4;					//Potentiometer for off time delay
byte TimeDelayRegPin = 5;				//Potentiometer for on time delay

byte SetupPin = 6;						//Pin for enabling Setup process
byte SetupModePin = 7;					//LED for indicatin Setup mode
byte RunModePin = 8;					//LED for indicating Run mode

//Variables
byte OutVoltage = 130;					//Voltage on Coil
byte OnDelay = 100;						//How long the spark is ON
byte OffDelay = 1000;					//OFF time - 0V to the Coil

void Setup() {
	pinMode(SetupPin, INPUT);			//Mode button PinMode setup
	pinMode(SetupModePin, OUTPUT);		//LED PinMode setup
	pinMode(RunModePin, OUTPUT);		//LED PinMode setup
	analogWrite(VoltOutPin, 0);			//Set output voltage to 0
	digitalWrite(RunModePin, LOW);		//LED off
	digitalWrite(SetupModePin, LOW);	//LED off
	delay(5000);						//Delay 5s before startup
}

void Loop() {
	if(SetupPin == HIGH)
		SetupMode();					//Go to Setup mode
	else
		RunMode();
}

void SetupMode() {
	digitalWrite(RunModePin, LOW);
	digitalWrite(SetupModePin, HIGH);										//Indicate Setup mode
	while(SetupPin != HIGH) {												//Read values until SetupButton is pressed
		OutVoltage = map(analogRead(VoltRegPin), 0, 1023, 0, 255);			//Out voltage from 0 to 255 (PWM)
		OnDelay = map(analogRead(TimeDelayRegPin),0, 1023, 0, 1000);		//On time for safety limited from 0 - 1000ms
		OffDelay = map(analogRead(TimeIntRegPin), 0, 1023, 0, 5000);		//Off time limited from 0 - 5000ms
		delay(200);															//Delay 200ms betwean reading values
	}
	digitalWrite(SetupModePin, LOW);
	delay(5000);															//Delay 5s befor startup of program
	digitalWrite(RunModePin, HIGH);											//Indicate Run mode
}

void RunMode() {
	analogWrite(VoltOutPin, OutVoltage);									//Power ON the Spark Coil
	delay(OnDelay);															//Spark Coil ON for x ms
	analogWrite(VoltOutPin, 0);												//Turn Spark Coil OFF
	delay(OffDelay);														//Switchin interval
}

/*
 *analogRead = 0 - 1023
 *map(value, fromLow, fromHigh, toLow, toHigh)
 */

Well you don't want a fence to produce a spark.
Anyway, yes just feed that transistor with PWM and then stop to give it bursts.

Gee, what is the voltage of the fence going to be here?

dgibum:
My Coil doesent make a spark if i only tourn it on and then off. Its from an old car :blush:

It will do if it's working properly, but if you're left it powered up for too long you may have damaged it. If it's from an old car, it may have been knackered in the first place.

dgibum:
It would be great if i could control the length of spark time (how long the spark is active). That means it has to be switched for longer period of time (max 1second) at some frequency (8khz?). Is this posible with Arduino? Can this switching be done with PWM? And how?

You don't want a spark, you want a high tension pulse. The pulse will be almost instantaneous and you don't get to 'control the length'. 8 KHz is too fast - the coil will need a couple of milliseconds to charge up, and when you break the LT circuit it will produce a small voltage spike on the LT side and a much bigger spike on the HT side. In any case you don't want or need to produce pulses continuously - it will use loads of power and make overheating problems much worse. You only need to produce one pulse every few seconds.

You probably want a capacitor across the transistor you're using as a switch on the LT side to soften the voltage spike on the LT side and reduce the energy the transistor has to deal with, it will also give you a stronger pulse on the HT side. Make sure you don't ever leave the coil powered on for longer than about 100ms at a time.

dgibum:
There is no additional circuit. The coil is connected directly to the fence. I already have a program that will control this, but it lacks the switching part of coil.

There must be a connection from the coil HT terminal to the fence, and the coil ground to a ground spike or other good earthing point near the fence. These need to be high tension connections with insulation good for several tens of thousands of volts.

By the way, an Arduino is massive overkill for this - all you need is a timer configured as an oscillator.

The spark voltage will be around 10-15kV @ 12V supply.

This
This is an example of what i am trying to do. But with voltage and time control.
I am sure, that with the nawlage you gave me, i can build something like that :slight_smile:

Thank you all!