Thursday 31 July 2014

MIG Welder rebuild update

If you don't know already, I've been busy.....bouncing baby #2 arrived in June! Her name is Ferne. All is well with her and muumy!

So plodding on with this MIG welder (kindly donated by +Jezzmund Tutu's dad. Cheers Mark!), I managed to knock a milestone down: I have managed to develop a working system on the Arduino, with a development board I knocked up!

What I'm Aiming for

I basically want to try and run this, knackered, beat-up, SIP Ideal 180 Mig Welder, by replacing the electronics (as shown ) with my own, more modern and compact system, based around the same system as the Arduino (Atmel ATMEGA328P), with ability to upload an Arduino boot-loader and then use a serial cable to upload programs.

Electronics as it stands are shot, keeps blowing the fuse to the board, I believe there is a short on the rectifier for the motor control circuit. I never liked the way these things worked, so more the reason to design my own!
Proper old-skool electronics! who needs micro controllers!

All this will be stripped out, but am leaving the connections and wires to solder to the new board

Plenty of functions for a MIG, including latch trigger mode and stitch mode with duty adjustments. I'll be recycling the pots and rotary switches.

Basically the same way as done on Arduino, Stripped down and instead of a USB to serial circuit on board, use a USB-Serial Cable, available from most electronics hardware suppliers. Similar to what's done here: Nanino.

I want it to have all the basic functions of a MIG welder: Gas delay, Wire Feed control, Wire-Inch. The welder is a Conventional type, which means it has a HUGE, tapped, step down transformer, and a selector switch on the front to adjust the welding voltage (CV welding explained Here - Wikipedia on welding power supplies). As such, I don't need to worry about controlling the welding current and voltage from the electronics, just the gas and wire control.
Pretty beat up! Confident its just cosmetic! The number in the model name usually indicates its max current.

Left to Right: Voltage adjustment, "EARTH" clamp connection MIG/Spot welder selector, 3-Phase connector (dunno if its in or out?)
I did think about having a weld mode selector for stitch mode, stitch period on & off and latching trigger but I thought to start simple and then fit mode selections later.

Dev. Platform

Schematic - NB trigger button is separate on breadboard
Setup

The board is nothing special. Just a couple of relays with LED's. Relays are driven off 5V (as specified) by some transistors which in turn are driven off the Adrunio. Screw terminals allow easy fitting/removal of the wires to and from the Arudino and also from the bread board.

The  Inch button is located on the board and the trigger button is on the bread board with a bit of de-bouncing. I found a small motor so I could test drive the motor circuit I proposed to use. The motor so small and light that the solid core wires I soldered to it can hold it in the air!

I used 2 Trim-pots as gas delay and motor control. The motor driver circuit is quite simple too: the MOSFET (Q4) is constantly driven by a PWM signal from the Arduino. The relay (RL3) in its Normally Close position, shorts the motor out through a very low value resistor (R7). When the relay is energised, the pole is switched to the 12V supply and Q4 has some power to drive the motor with. Simple and effective.

Some Theory

R7 essentially holds the motor. If you tried to turn it by hand, it won't budge as all the current generated by the motor tries to flow through R7, essentially a short circuit. 

You ever tried to generate a voltage across a short circuit? Its bloody hard! 

If R7 were 1K for example, it would allow the motor to be turned by hand a little and the current generated from the  motor would give rise to a small voltage across it (ohms law).

So in the situation where the motor is running and then you remove the power, the motor will slow down over a short period of time. This is not desirable if its feeding your wire for welding as it could get stuck to the work! you want it to stop instantly!

So by shorting the motor through the high wattage, small value resistor, all the current generated in the field of the motor windings from the momentum of turning a big spool of wire gets dissipated as heat in the resistor and the motor will stop a damn-sight quicker! exactly like the brakes on a car!

I've seen similar things done with Triacs and long pieces of track whilst repairing boards from MIG welders. They are prone to blowing the tracks and the braking Triac alot! So if your MIG welders does not stop feeding wire when it should, that's the problem!

Arudino Sketch

/*
Ardu-weld - Arduino based welder control board
Author: Tronicus
Date: 13-May-2014
Ver: 1.0
web: tron9000.blogspot.com
*/

//files to include
#include <Wire.h>
#include <stdlib.h>

//definitions & declarations
#define in_TRIG 2  //trigger pin
#define out_WS 3  //Motor speed control pin
#define out_GAS 7  //Gas relay control pin
#define out_CON 8  //Contactor relay control pin
#define out_BRK 4  //Motor brake relay control pin
#define in_WF 12  //Wire Feed button input pin
#define in_DIR 5  //Wire feed direction control input - later version of development
#define out_DIR 6  //Wire feed control output - later version of development

//Variables
int WS_MIN = 20;  //Minimum wire speed
int WS_MAX = 255;  //Maximum wire speed
int GDEL_MIN = 10;  //Minimum gas delay time
int GDEL_MAX = 1000;  //Maximum Gas Delay time
boolean welding = false;  //flag to indicate has been or finished welding

//*********************************************Main Program*******************************************//

//setup
void setup() 
{
  pinMode(out_WS, OUTPUT);
  pinMode(in_TRIG, INPUT);
  pinMode(out_GAS, OUTPUT);
  pinMode(out_CON, OUTPUT);
  pinMode(out_BRK, OUTPUT);
  pinMode(in_WF, INPUT);
  pinMode(13, OUTPUT);  //LED Alive pin
  digitalWrite(13, LOW);
  //Serial.begin(9600);
}

void loop() 
{ 
  while(digitalRead(in_WF) == LOW){inch();}  //check to see if Inch button is pressed
  while(digitalRead(in_TRIG) == LOW){weld();} //check to start welding
  if(welding == true){dis_weld();} //if you have been welding: disengage
}

//******************************************Welder control******************************//
/*
Code for controlling the welder (Wire feed, contactor, gas solenoid, trigger type) goes here
*/
void weld()  //starts welding welding
{ 
  welding = true;  //now/was welding
  digitalWrite(13, HIGH);
  digitalWrite(out_GAS, HIGH);  //turn gas on
  //Serial.println("GAS ON!");  //uncomment as neccesary
  digitalWrite(out_CON, HIGH);  //close contactor
  //Serial.println(welding);  //uncomment as neccesary
  feed_wire();  //feed wire
}

void inch()  //feeds the wire
{
  while(digitalRead(in_WF) == LOW)
  {
    feed_wire();
  }
  digitalWrite(out_BRK, LOW);  //turn on brake
}

void feed_wire()  //function that feeds wire whilst allowing speed adjustment at same time
{
 digitalWrite(out_BRK, HIGH);  //Release Brake on motor
 analogWrite(out_WS, map(analogRead(0), 0, 1023, WS_MIN, WS_MAX));  //set the output speed of feed motor
}

void dis_weld()  //stop welding and finish with gas
{
  int del = map(analogRead(1), 0, 1023, GDEL_MIN, GDEL_MAX);
  boolean FLG1 = true;
  while(del > 0)
  {
    while(FLG1 == true)
    {
    digitalWrite(out_CON, LOW);  //turn off current
    digitalWrite(out_BRK, LOW);  //apply brake to motor
    FLG1 = false;  //make flag false so this isn't done again
    }
    delay(1);  //delay 1 ms
    if(digitalRead(in_TRIG) == LOW)  //read and check that trigger has not been pressed
      {
        del = 0;
        weld();  //if so weld
      }
    //Serial.println(del);
    del--;  //decrease del
  }
  digitalWrite(out_GAS, LOW);
  welding = false;
  digitalWrite(13, LOW);
}

Breakdown of Program

so in the main loop(), I'm constantly checking the trigger and inch switches for a change in state and then calling the appropriate function when one of those switches are pressed.

When the inch button is pressed it just calls the function to turn on the wire feed motor at the speed set from the analog input, mapped against the defined max and min wire speed, this only happens while the inch button is pressed. once the inch button is release it engages the brake for the motor.

when the trigger switch is press it calls the welding function: this function first sets a flag (in the form of a Boolean variable) to acknowledge that welding has/is happening/happened. It then turns on the gas solenoid output and then the contactor (which puts power to the lance for welding) and then starts to feed the wire at the mapped speed from the analog input. It does this till the trigger is released.

Once the trigger is release, it returns to the Loop(). It then checks that the welding flag has been set, if it has then it must start the welding disengage function. 

This function basically reads in the value off the second analog input to determine how long it needs to leave the gas on for, sets another flag to indicate it has turned off the contactor and apply the wire feed brake, and then checks at 1ms intervals if the trigger has been pressed whilst the gas is left on.

If the trigger has not been pressed during this interval, it decrease the integer: del. When del = 0, it turns the gas off and set the welding flag to false and returns to the loop(). If the trigger has been pressed, it clears the timer variable (int del) and returns to the welding function.

And the results can be seen for themselves:

As it can be seen, I Press the inch button and only the motor turns. I press the trigger and the Gas (green LED), contact (red LED) and the blue LED (sequence indicator, tells me when its stopped doing things) come one and the motor turns.

When the trigger is released the gas LED stays on for a while longer. I adjust the Gas pot and the gas on interval is now a lot shorter (practically 0).

I then adjust the motor speed pot from full, to half way and then minimum, and the motor speed responds accordingly. Notice that the motor recoils a little, that's the brake circuit kicking in!

Sorry I couldn't show the speed change on the fly, but I had to hold the camera!

Expansions and Extra features

So like I said before I could have included and stitch function and a latch function like the original, I might yet include a latch function.

I was also thinking of including a motor direction switch for inching only, so you can spool the wire back a bit if required.

I would really like to add one of the LVK204-25 LCD screens on it to display current and power. I have a few analog and digital inputs left and it'd be rude not to use them!

Problem with measuring current is I need a shunt capable of taking high current (most likely up to 180A), which in this case would be a brass bar with enough metal shaved off to give the right resistance. Seen them before, will have a look around. Also with measuring shunted currents and voltages up to 5x higher than the mirco-controllers supply voltage is isolation. I've seen monitoring circuits in welders go really badly when things let go!

Anyway, food for thought, until next time.