Go Down

### Topic: AC for running the transformer (Read 2510 times)previous topic - next topic

#### zoom

##### Feb 14, 2013, 07:47 pm
Have a 230V to 11V transformer. Want to run it to have a spark gap.
First thought creating an Sine Wave would be easy with arduino but apparently not that easy.

Idea is quite simple but the value I monitor fluctuates around 280 rather than going all the way up to 255 and then falling to 0 in a loop
Quote
int out = 9;
int i=0;

void setup()
{
pinMode(out, OUTPUT);
Serial.begin(9600);
}

void loop()
{
for(i;i<256;i++)
{
analogWrite(out, i);
}
for(i;i>-1;i--)
{
analogWrite(out, i);
}
}

#### AWOL

#1
##### Feb 14, 2013, 08:20 pmLast Edit: Feb 14, 2013, 08:24 pm by AWOL Reason: 1
Code: [Select]
`for(i;i<256;i++)`

Analogue out 9 != analogue in 9
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

#### BillO

#2
##### Feb 14, 2013, 08:23 pm
First, I assume you are using a mega, right?

As far as I know you cannot read back the PWM signal you wrote to the pin.  As soon as you execute the analogRead() it will change the configuration of the pin away from PWM mode (which will not give you an analog output voltage anyway) to ADC mode.  So all you are seeing is the float voltage on pin 9.

I think for this you'd either;
1) Just output a square wave and filter it a bit and amplify it (not very efficient, there would be lots of loss in the transformer)

2) Use PWM and a sin() function, filter and amplify that to drive the transformer.

3) Use a real DAC converter, the SIN() fucntion, and amplify that to drive the transformer.

In all cases, the output frequency of the final wave would have to match what the transformer was designed for.

#### Retroplayer

#3
##### Feb 14, 2013, 08:56 pm
Using a Half Bridge on the transformer would help. Not sure if you are doing that.

#### BulletMagnet83

#4
##### Feb 14, 2013, 09:04 pm

Have a 230V to 11V transformer. Want to run it to have a spark gap.
First thought creating an Sine Wave would be easy with arduino but apparently not that easy.

Just a couple of thoughts here... first, don't use "normal" transformers this way. They're not very good at it. If you want a spark gap, use a high-frequency ferrite core transformer, like the baby flybacks you find in plasma globes. You may get a painful shock/small burn if you're not careful, but you're quite unlikely to die unless you decide to experiment with it naked covered in salt water.... so don't do that :p

Also, don't throw a microcontroller at a project that doesn't need one. It'd be easy enough to knock together a 555-based oscillator with some big fat power transistors to make an appropriate driver circuit, and a lot less hassle if you burn something out. Google "flyback driver 555" for some ideas, it's not difficult. You can vary the output voltage by varying the duty cycle of the 555 oscillator.

#### BillO

#5
##### Feb 14, 2013, 09:08 pm
Yes, that's a better idea altogether.

#### zoom

#6
##### Feb 14, 2013, 09:43 pm
Actually I have a circuit built on a matrix board working with 555 timer to get a square wave, however couldn't get it worked.
Thought programming the arduino on computer to get an AC current , but apparently not that easy to do.

Have a 230V to 11V transformer. Want to run it to have a spark gap.
First thought creating an Sine Wave would be easy with arduino but apparently not that easy.

Just a couple of thoughts here... first, don't use "normal" transformers this way. They're not very good at it. If you want a spark gap, use a high-frequency ferrite core transformer, like the baby flybacks you find in plasma globes. You may get a painful shock/small burn if you're not careful, but you're quite unlikely to die unless you decide to experiment with it naked covered in salt water.... so don't do that :p

Also, don't throw a microcontroller at a project that doesn't need one. It'd be easy enough to knock together a 555-based oscillator with some big fat power transistors to make an appropriate driver circuit, and a lot less hassle if you burn something out. Google "flyback driver 555" for some ideas, it's not difficult. You can vary the output voltage by varying the duty cycle of the 555 oscillator.

#### BulletMagnet83

#7
##### Feb 14, 2013, 10:28 pm
Did you look for other examples to check where you might have gone wrong? 555 circuits are one of the first things anyone should learn about. Using two 100ohm resistors and a 200nf cap will give you 24khz at 66% duty cycle. I find that with a suitable transistor to drive the primary winding it works quite well.

It's not really AC you need anyway, more like pulses of DC. You want to get the transformer core to store as much energy as possible then collapse the magnetic field as quickly as possible so you get nice big spikes of voltage for your arcs and sparks!

Go Up