Pages: [1]   Go Down
Author Topic: AC for running the transformer  (Read 559 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 46
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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);
    Serial.println(analogRead(out));
  }
  for(i;i>-1;i--)
  {
    analogWrite(out, i);
    Serial.println(analogRead(out));
  }
}
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 290
Posts: 25756
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
for(i;i<256;i++)
How about initializing "i"?

Analogue out 9 != analogue in 9
« Last Edit: February 14, 2013, 02:24:31 pm by AWOL » Logged

"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.

Canada
Offline Offline
God Member
*****
Karma: 7
Posts: 600
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Facts just don't care if you ignore them.

Offline Offline
God Member
*****
Karma: 27
Posts: 829
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Using a Half Bridge on the transformer would help. Not sure if you are doing that.
Logged

South England
Offline Offline
Full Member
***
Karma: 3
Posts: 205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Canada
Offline Offline
God Member
*****
Karma: 7
Posts: 600
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, that's a better idea altogether.
Logged

Facts just don't care if you ignore them.

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

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.
Logged

South England
Offline Offline
Full Member
***
Karma: 3
Posts: 205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Pages: [1]   Go Up
Jump to: