Saturday, April 8, 2017

Here's how I built my Proof of Concept Spot welder.

I have had a couple of requests for more detail on my projects, so I'll try and fulfill that request.

This is my prototype spot welder.  I use it for welding battery tabs on 18650 cells.  

I started off with a transformer from a microwave oven.  With the help of my bench vise and a hack saw, I removed the secondary winding.  I replaced it with 3 turns of 2 gauge wire I got from the local welding supply.  The primary coil is connected through one of the relays on the side board.  

It's driven by an arduino nano.  I found that it didn't have enough oomph to drive the relay module by itself, so I had to run it through a MOSFET.  IT's an NPN something-or-other, I used what I had on hand.   
I have a foot pedal that I connect to the blue and yellow leads to the lower left.  This allows me to use both hands to hold the electrodes, and still actuate the machine.


Pin d5 is attached to a 10k pull-up resistor, and also to the foot switch.  When the foot switch is engaged, d5 goes to ground.  You can see that the yellow lead to the foot switch is connected to the ground rail.

d2 is the output that connects to the gate of the MOSFET (NPN), and also a 10k pull-down.  When the gate goes high, enough power is passed to the relay module to trigger it.
Eventually I'll move all the things to a proto board. 
So, when the pedal pin goes low (I step on it), it fires the output in a pre-programmed pattern.  Right now, I do 10ms on, 10ms off, 50ms on.  Read somewhere that a shorter burst followed by a regular sized one is better for penetration without overheating.
I dunno, but it seems to work better than just 60ms, especially when I'm going through 2 layers of tabbing strip
My device is also triggered to only fire one per press.  If you hold the pedal, it won't continuously trigger.  The pedal must be released before it will rearm.
For the next version, I want to connect an LCD and a rotary encoder, so the firing timings can be modified without having to re-upload code.  Also, I'll use a single relay board.  I used a 4 relay version because it was what I had on hand at the time.

Here's my code:



// Battery tab welder code.

// When the foot switch is activated (switchPin goes to ground), the relay will trigger for a pre-configured fire time.


const int switchPin = 5;
const int relayPin = 2;
//const int relayLED = 1;
int buttonState = 0;
int relayState = 0;

void setup() {
  // put your setup code here, to run once:

pinMode(switchPin, INPUT);
pinMode(relayPin, OUTPUT);
//pinMode(relayLED, OUTPUT);
digitalWrite(relayPin, LOW);
//digitalWrite(relayLED, LOW);

}

void loop() {
  // put your main code here, to run repeatedly:
buttonState = digitalRead(switchPin);
if ((buttonState == LOW) and (relayState == LOW)) {
  relayState = HIGH;//So the circut won't continually re-trigger if the switch is held.
  //digitalWrite(relayLED, HIGH);
  digitalWrite(relayPin, HIGH);
  delay(10);//initial fire
  digitalWrite(relayPin, LOW);
  delay(10);//inter-delay
  digitalWrite(relayPin, HIGH);
  delay(50);//Welding fire
  digitalWrite(relayPin, LOW);
if ((buttonState == HIGH) and (relayState == HIGH)) {
  relayState = LOW;//resets the state, so the machine can fire again.
  delay(50);
  //digitalWrite(relayLED, LOW);
    
}
}