Tuesday, July 21, 2015

Foot controlled TIG welding with 80 Amp Harbor Freight welder

I have a cheapo 80 amp Harbor Freight DC welding machine for which I'd purchased a TIG torch and adapted it as I'd seen explained here to a scratch start TIG machine. It worked pretty well for a cost of less  than $500 all said and done, including the argon tank, but it was a bear starting and stopping because I couldn't adjust the amperage on the fly easily. The end of the weld would always be iffy because I had to lift off while at full power, leaving the hot metal without shielding gas and sometimes leaving holes in the welds and sometimes allowing a lot of oxygen contamination.

I saw this video here where a home-made on-off foot pedal made with a car battery knife switch is demonstrated. Seeing that flipped a switch in my head and I though hey - wouldn't it be neat to just put a potentiometer on the hinge of that foot pedal and somehow use that signal to adjust the amperage? This is essentially what commercial welding foot pedal controllers do, but they're generally crazy expensive, at least several hundred dollars. I fiddled with adjusting the amperage dial while welding and it seemed to work and the machine didn't seem to complain. I couldn't find anywhere on the vast reaches of the internet that advised against it, so I figured that I could hook up a servo to the dial and rotate the servo in accordance with the desired amperage, using an Arduino to control the servo and read the pot.

I get the rubegoldbergidity of using a potentiometer to control a servo to control a potentiometer. Alternatively, I could have opened up the welding machine and tapped the amperage control potentiometer, and put a circuit around it that would spoof the potentiometer reading. I was leery of making any permanent modifications to the welding machine wiring, but I may yet go back and do this.

I started by making the foot pedal. I bought a car battery disconnect switch here and mounted it to the foot pedal (itself just a few pieces of scrap wood with a hinge). I mounted a standard 10K potentiometer with a knob on the other side.




On the welding machine, I drilled a hole in the case to mount the servo body, and attached the servo actuator to the welding machine amperage knob with the highly advanced "Rubber Band" technique. The servo actuator has holes in in, through which I placed small nails and tightened them around the knob with the rubber band. The servo can slip on and off of the welding machine very easily like this.



Code wise, it's pretty simple. I used a Makershield I had sitting around with a 5V regulator already wired in to power the servo, and the foot pedal potentiometer is measured with one of the analog pins. When a button on the shield is pressed, it enters a learning mode for ten seconds. During that time, it records the maximum and minimum readings of the potentiometer and maps those to the minimum and maximum servo positions.

The full 10 amp to 80 amp range is a little more than 180 degrees on the welding machine so it's not quite capable of swinging the machine's full range, but it does allow a much better degree of current control than before. Using a 270 degree servo would allow the full range to be used.

How well does it work? See it in action!





Here's the code:
#include <Servo.h>

Servo myservo;

int angle = 0;  //servo angle

int potpin = 0;  //pot connected to Analog Pin 0

int potval;      //potentiometer reading

int btn = 4;  //digital pin 4 is button on MakerShield. This button, when pressed, will reset the high and low range of the potentiometer and re-map those to the servo's working range.

long RangingTime = 10000; //time during which pedal will learn its range

int highrange = 268; //default value for high range of pot

int lowrange = 104; //default value of low range for pot

int LED =5;    //LED is lit when arduino is learning new potentiometer range

int servopin = 6;  //Servo connected to pin 6

long ButtonPressTime;  //For debouncing learning button

void setup()
{

  myservo.attach(servopin); 
 // Serial.begin(9600);
  pinMode(btn, INPUT); 
  pinMode(LED, OUTPUT);

}


void loop()
{
  //button press for setting high and low range of pedal
  
  if (1-debounce(btn)){
    
    digitalWrite(LED, HIGH);
    ButtonPressTime = millis();
    highrange = 0; //reinitialize high and low range
    lowrange = 1024;
    while(millis() < ButtonPressTime + RangingTime){
       
      potval = analogRead(potpin);
      if (potval > highrange){
        
        highrange = potval;
        
      }else if (potval < lowrange){
        lowrange = potval;
      }
    }
    
    digitalWrite(LED, LOW);
    
   // Serial.print("High Range = ");
   // Serial.println(highrange);
    
  //  Serial.print("Low Range = ");
  //  Serial.println(lowrange);
  }

  potval = analogRead(potpin);
  if (potval > highrange){
    potval = highrange;
  }else if (potval < lowrange){
    potval = lowrange;
  }
  
  //Convert the pot reading to a servo angle, turn the servo to that angle. This servo is a 180 degree servo, but I cut it a bit short to keep it from straining at the end.
  angle = map(potval, lowrange, highrange, 0, 170);

  myservo.write(angle);

  //Serial.println(potval);

  //poll every 200 milliseconds. If this time is too short, the servo gets a bit twichy
  delay(200);


}

boolean debounce(int pin){
 boolean state;
boolean previousState;
const int debounceDelay = 10;
previousState = digitalRead(pin);
  for(int counter = 0; counter < debounceDelay; counter++)
  {  
    delay(1);
    state = digitalRead(pin);
    if(state != previousState)
    {
      counter = 0;
      previousState = state;
    }
  }
  return state;
  
}

No comments:

Post a Comment