Go Down

Topic: Bi-directional square wave generator. (Read 222 times) previous topic - next topic

ebweiss2

I need one.  I figure it's easy to generate a square wave to send to a transistor.  But what about a bi-directional wave?  Could I just use 2 transistors fired one then the other?

I'm converting a DC welder current into an AC square wave to TIG weld aluminum.  The AC wave (backwards current) breaks the oxidation layer so a violent signal should be fine.  I also need to be able to adjust the time spent in the + vs - waves because you want more of the forward than you do reverse or "cleaning." 

Adjusting the amplitude individually would be desirable as well (not sure why yet but they say it's a feature you want).  I figure two separate transistors would give me the freedom do this.  I'm just not sure if that's the right way to do it or am I way off?  Can I just use two pins to fire two different gates and program the Arduino to flip back and forth?  Standard frequency is only around 120HZ except for a start up arc.

I'm far from an expert in electronics so any help would be appreciated.  I'll be switching some IGBT transistors.

Oh, and this would be a great project for anyone else who wants to build a good aluminum capable TIG welder from a cheap DC one.  Thanks in advance.

hzrnbgy


MarkT

Just a little terminology thing: you mean a _bipolar_ square wave - bidirectional applies to the direction the infomation flows, not the voltage.  You can have bidirectional signalling using a unipolar bus, for instance.

You'd probably be using two signals to drive a massive H-bridge to generate AC square wave, so bipolar
drive signals may not be useful.
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

ebweiss2

There's not a lot of reference online on what this TIG welding wave pattern is but I found this

https://www.practicalmachinist.com/vb/attachments/f30/201907d1498275664-why-do-i-keep-getting-bad-argon-wave-shape.jpg

Is this correct?

Yes, that's it exactly.  The point is of course to generate a high current ark to melt metal.  Aluminum spontaneously develops a very tough oxide layer which withstands greater heat than the material under it.  So, they use an AC square wave because the - flow pulls the oxide layer out and the + flow puts heat into the work.

ebweiss2

Just a little terminology thing: you mean a _bipolar_ square wave - bidirectional applies to the direction the infomation flows, not the voltage.  You can have bidirectional signalling using a unipolar bus, for instance.

You'd probably be using two signals to drive a massive H-bridge to generate AC square wave, so bipolar
drive signals may not be useful.

Yes, I need to construct an H-bridge.  I also need to have independent control of the waves.  I'm not sure what to make of your comment though.  Are you saying I'm on the right track if I use alternating signals from the Arduino to drive two MOSFETS , one + one - ?  I only need around 120HZ so I don't suspect there would be a timing issue.  But I could be wrong.


hzrnbgy

#5
Jan 17, 2021, 06:40 pm Last Edit: Jan 17, 2021, 07:02 pm by hzrnbgy
This would be a perfect application of the TIMER hardware present on most MCUs. The signal is basically two PWMs complimentary of each other



There's a section on the datasheet of the Atmega328P that allows you to generate this kind of signal using a single timer by configuring the two output compare units opposite with each other. It's on page 108

If all you want is to generate the signal, and maybe learn a little in the process, you can try the code below. It will output the two signals on D9 and D10 of the Arduino Nano (16 MHz version)

Code: [Select]
void setup(void)
{
// set OC1x output pins
DDRB |= 1<<PORTB1 | 1<<PORTB2;

// set TIMER1 for Fast PWM mode, opposite output on OC1x pins
TCCR1A = 1<<WGM11 | 0<<WGM10 | 1<<COM1A1 | 1<<COM1A0 | 1<<COM1B1 | 0<<COM1B0;
TCCR1B = 1<<WGM13 | 1<<WGM12;

// disable interrupts
TIMSK1 = 0<<OCIE1B | 0<<OCIE1A | 0<<TOIE1;

// set TOP value to generate 120 Hz
ICR1 = (16667 - 1);

// set duty cycles
OCR1A = 8333;
OCR1B = 8333;

// start TIMER1 at 2 MHz (16MHz/8)
TCCR1B = 1<<WGM13 | 1<<WGM12 | 0<<CS12 | 1<<CS11 | 0<<CS10;
}

void loop(void)
{

}


Quote
I also need to be able to adjust the time spent in the + vs - waves because you want more of the forward than you do reverse or "cleaning."
You can do this just by changing the values of OCR1A and OCR1B in the code. Whatever value you decide, it must be for both. The percentage is related to the ICR1 value above

IF you want a 50% - 50%, then OCR1A = OCR1B = 50% of ICR1
For 25 % - 75 %, then OCR1A = OCR1B = 25% of ICR1 (or 75% of ICR1), depending on which output gets the 25%



ebweiss2

I appreciate the help but this is way above my skill level.  It looks like you are underneath the Arduino code.  I don't know how to do that.

hzrnbgy

As Mando would say

Quote
This is the way...
It does look intimidating, but this is how a commercial product would implement it (I think). They key is doing whatever you can in hardware instead of emulating it in software.

Go Up