Westpol
Published

DIY Spotwelder - Part 2

I want to make a spot welder for battery packs or other stuff that cannot be soldered.

IntermediateWork in progress3,690
DIY Spotwelder - Part 2

Things used in this project

Hardware components

Arduino Micro
Arduino Micro
×1
RGB Backlight LCD - 16x2
Adafruit RGB Backlight LCD - 16x2
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

The scematic

The scematic as PDF

Code

CD_spot_welder_Serial.ino

C/C++
int power = 1920;       // power of the battery in Watts
int MOSFETpin = 3;
int piezopin = 13;

int footswitchorbutton = 2;

int dlay = 0;
unsigned long timetilnext;
unsigned long locksec;
int oneafterlocked;
int prevdlay;
int prevlock;
int joule;

void setup() {
  pinMode(MOSFETpin,OUTPUT);
  pinMode(footswitchorbutton,INPUT_PULLUP);
  pinMode(A0,INPUT);
  Serial.begin(9600);
  timetilnext = millis();
  locksec = 0;
}

void loop() {
  
  if(millis() <= timetilnext){
    locksec = (timetilnext-millis())/1000;
    if(locksec != prevlock){
    Serial.print("locked for:");
    Serial.print(locksec);
    Serial.println("s");
    prevlock = locksec;
    }
    oneafterlocked = 1;
  }
  
  
  dlay = map(analogRead(A0),0,1023,1,15);
  dlay = dlay*10;
  
  if(millis() >= timetilnext){

  if(dlay != prevdlay || oneafterlocked == 1){
  joule = dlay/.1000*power/10000;
  Serial.print("Pulse:");
  Serial.print(dlay);
  Serial.println("ms");
  Serial.print("Energy:");
  Serial.print(joule);
  Serial.println("J");
  oneafterlocked = 0;
  prevdlay = dlay;
  }
  if(digitalRead(footswitchorbutton) == LOW){
    tone(piezopin,1000);
    delay(500);
    noTone(piezopin);
    delay(500);
    tone(piezopin,1000);
    delay(500);
    noTone(piezopin);
    delay(500);
    tone(piezopin,1000);
    delay(500);
    noTone(piezopin);
    delay(500);
    tone(piezopin,2000);
    delay(1000);
    noTone(piezopin);
    delay(500);
    digitalWrite(MOSFETpin,HIGH);
    delay(dlay);
    digitalWrite(MOSFETpin,LOW);
    timetilnext = 5000+millis();
  }
  }
  
}

LCD Spot Welder

C/C++
#include <LiquidCrystal.h>

int power = 1920;       // power of the battery in Watts
int MOSFETpin = 3;
int piezopin = 13;
int lightpin = 4;
int footswitchorbutton = 2;

int dlay = 0;
unsigned long timetilnext;
unsigned long locksec;
int oneafterlocked;
int prevdlay;
int prevlock;
int joule;

const int rs = 8, en = 7, d4 = 9, d5 = 10, d6 = 11, d7 = 12;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup() {
  pinMode(MOSFETpin,OUTPUT);
  pinMode(footswitchorbutton,INPUT_PULLUP);
  pinMode(A0,INPUT);
  pinMode(lightpin,OUTPUT);
  digitalWrite(lightpin,HIGH);
  timetilnext = millis();
  locksec = 0;
  lcd.begin(16,2);
  lcd.clear();
  
}

void loop() {
  
  if(millis() <= timetilnext){
    locksec = (timetilnext-millis())/1000;
    if(locksec != prevlock){
    lcd.clear();
    lcd.setCursor(2,0);
    lcd.print("locked for:");
    lcd.setCursor(7,1);
    lcd.print(locksec);
    lcd.print("s");
    prevlock = locksec;
    }
    oneafterlocked = 1;
  }
  
  
  dlay = map(analogRead(A0),0,1023,1,15);
  dlay = dlay*10;
  
  if(millis() >= timetilnext){

  if(dlay != prevdlay || oneafterlocked == 1){
  joule = dlay/.1000*power/10000;
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Pulse:");
  lcd.print(dlay);
  lcd.print("ms");
  lcd.setCursor(0,1);
  lcd.print("Energy:");
  lcd.print(joule);
  lcd.print("J");
  oneafterlocked = 0;
  prevdlay = dlay;
  }
  if(digitalRead(footswitchorbutton) == LOW){
    tone(piezopin,1000);
    delay(500);
    noTone(piezopin);
    delay(500);
    tone(piezopin,1000);
    delay(500);
    noTone(piezopin);
    delay(500);
    tone(piezopin,1000);
    delay(500);
    noTone(piezopin);
    delay(500);
    tone(piezopin,2000);
    delay(1000);
    noTone(piezopin);
    delay(500);
    digitalWrite(MOSFETpin,HIGH);
    delay(dlay);
    digitalWrite(MOSFETpin,LOW);
    timetilnext = 5000+millis();
  }
  }
  
}

Credits

Westpol
8 projects • 22 followers

Comments