Purpose: To generate an adjustable AC Square wave from a DC source for the purpose of welding aluminum.
Aluminum develops a stubborn oxide layer. To combat this, TIG welders use an AC square wave. The 'push' does the welding, and the pull breaks the oxide layer. A preferable wave will be 70% push, and 30% pull. The frequency should be adjustable from around 60HZ to 125HZ. But a brief high frequency ark starting pulse is used momentarily. Amperage should also be controlled by a foot pedal.
This code attempts to achieve this. It uses one POT to set the 'push or up' pulse width, and another to set the pull or low PW. The lower is expressed as a percentage of the first.
The sketch begins when a switch in the foot pedal is triggered. It sends signal to turn on power and open the gas solenoid in the MIG welder. It also triggers the start pulse which should be 333KHZ for 3mS. Then it should move on to output the set frequency and PW. The high and low PW will each go to a separate POT in the foot pedal and then the up to a bank of MOSFETS for the up pulse, and the low output to a matching bank for the lower pulse.
The foot pedal POTs will modify the voltage sent to the MOSFET gates and thus control amperage. I may add an OP amp to these signals. This should give me a bi-polar AC square wave with adjustable PW above and below the 0V line.
This is a work in progress. I am uploading what I have so far. I still need to add outputs for the displays. The upper will show HZ of the wave. And the lower will show the percentage for the low wave. I think I'm pretty close to a working sketch though.
I'm not super experienced with this stuff so if anyone wishes to contribute, that would be great. Units that will do all this are stupid expensive, But DC welders are cheap. Let me know what you think. PS I'm using while loops because I want it to stay put until it shouldn't.
const int UpOutPin = 9; // Sends upper PW through pedal POT 1 and to up MOSFET gate
const int UpPotPin = A0; // Reads upper PW time from upper POT
const int LowOutPin = 8; // Sends low PW through pedal POT 2 and to down MOSFET gate
const int LowPotPin = A1; // Reads low PW POT - value of which will be a percentage of up PW.
const int PedalPin = 7; // Pedal main switch
const int OnSig = 6; // Sends on signal to power source and gas valve.
//Variables:
int value; //save analog value
void setup(){
//Upper Pulse
pinMode(UpOutPin, OUTPUT); // To Pedal Pot 1 in then up MOSFET gate
pinMode(UpPotPin, INPUT); // From up POT
//Lower Pulse
pinMode (LowOutPin, OUTPUT); // To Peedal Pot then down MOSFTET gate.
pinMode (LowPotPin, INPUT); // From low POT
// Foot Peddal
pinMode (PedalPin, INPUT);
pinMode (Trigger, INPUT);
// Main on
pinMode (OnSig, OUTPUT);
}
void loop()
{
// Startup Wave - must run one time each time the foot pedal is first pressed, then exit go to static wave below,
if (PedalPin, LOW) //Pedal Switch
{
count = 0
while (PedalPin, HIGH && count < 10000) // outputs 333KHZ wave for 0.03 seconds (10,000) loops.
{ count = count++
digitalWrite (OnSig, HIGH);
digitalWrite (UpOutPin, HIGH);
delay (.001)
digitalWrite (UpOutPin, LOW);
delay (.001)
digitalWrite (LowOutPin, HIGH);
delay (.001)
digitalWrite (LowOutPin, LOW);
}
}
while (PedalPin, HIGH)
{
digitalWrite (OnSig, HIGH); // Powers up gas valave and power supply
// Upper Pulse
value = analogRead(UpPotPin); //Read and save analog value from potentiometer
UPwidth = map(value, 0, 1023, 2.5, 25); //Map value 0-1023 to 0-25 (width of up pulse 400Hz - 40Hz)
digitalWrite(UpOutPin, HIGH); //Send up pulse out from pin
delay(Upwidth); //Small delay
digitalwrite(UpOutPin, LOW); // Turn off
//Lower Pulse
Value = analogRead (LowPotPin);
Low_width = map (value, 0, 1023, .1, 1); // Low pulsewidth percentage of high pulsewidth
digitalwrite (LowOutPin, HIGH);
LwPercent = (Low_width*Upwidth);
delay (LwPercent);
digitalWrite(LowOutPin, LOW):
}
}
TIG.ino (2.31 KB)

