DIY Spotwelder - Part 2
I want to make a spot welder for battery packs or other stuff that cannot be soldered.
Components and supplies
1
RGB Backlight LCD - 16x2
1
Arduino Micro
Tools and machines
1
Soldering iron (generic)
Apps and platforms
1
Arduino IDE
Project description
Code
LCD Spot Welder
c_cpp
1#include <LiquidCrystal.h> 2 3int power = 1920; // power of the battery in Watts 4int MOSFETpin = 3; 5int piezopin = 13; 6int lightpin = 4; 7int footswitchorbutton = 2; 8 9int dlay = 0; 10unsigned long timetilnext; 11unsigned long locksec; 12int oneafterlocked; 13int prevdlay; 14int prevlock; 15int joule; 16 17const int rs = 8, en = 7, d4 = 9, d5 = 10, d6 = 11, d7 = 12; 18LiquidCrystal lcd(rs, en, d4, d5, d6, d7); 19 20void setup() { 21 pinMode(MOSFETpin,OUTPUT); 22 pinMode(footswitchorbutton,INPUT_PULLUP); 23 pinMode(A0,INPUT); 24 pinMode(lightpin,OUTPUT); 25 digitalWrite(lightpin,HIGH); 26 timetilnext = millis(); 27 locksec = 0; 28 lcd.begin(16,2); 29 lcd.clear(); 30 31} 32 33void loop() { 34 35 if(millis() <= timetilnext){ 36 locksec = (timetilnext-millis())/1000; 37 if(locksec != prevlock){ 38 lcd.clear(); 39 lcd.setCursor(2,0); 40 lcd.print("locked for:"); 41 lcd.setCursor(7,1); 42 lcd.print(locksec); 43 lcd.print("s"); 44 prevlock = locksec; 45 } 46 oneafterlocked = 1; 47 } 48 49 50 dlay = map(analogRead(A0),0,1023,1,15); 51 dlay = dlay*10; 52 53 if(millis() >= timetilnext){ 54 55 if(dlay != prevdlay || oneafterlocked == 1){ 56 joule = dlay/.1000*power/10000; 57 lcd.clear(); 58 lcd.setCursor(0,0); 59 lcd.print("Pulse:"); 60 lcd.print(dlay); 61 lcd.print("ms"); 62 lcd.setCursor(0,1); 63 lcd.print("Energy:"); 64 lcd.print(joule); 65 lcd.print("J"); 66 oneafterlocked = 0; 67 prevdlay = dlay; 68 } 69 if(digitalRead(footswitchorbutton) == LOW){ 70 tone(piezopin,1000); 71 delay(500); 72 noTone(piezopin); 73 delay(500); 74 tone(piezopin,1000); 75 delay(500); 76 noTone(piezopin); 77 delay(500); 78 tone(piezopin,1000); 79 delay(500); 80 noTone(piezopin); 81 delay(500); 82 tone(piezopin,2000); 83 delay(1000); 84 noTone(piezopin); 85 delay(500); 86 digitalWrite(MOSFETpin,HIGH); 87 delay(dlay); 88 digitalWrite(MOSFETpin,LOW); 89 timetilnext = 5000+millis(); 90 } 91 } 92 93} 94
LCD Spot Welder
c_cpp
1#include <LiquidCrystal.h> 2 3int power = 1920; // power of the battery in Watts 4int MOSFETpin = 3; 5int piezopin = 13; 6int lightpin = 4; 7int footswitchorbutton = 2; 8 9int dlay = 0; 10unsigned long timetilnext; 11unsigned long locksec; 12int oneafterlocked; 13int prevdlay; 14int prevlock; 15int joule; 16 17const int rs = 8, en = 7, d4 = 9, d5 = 10, d6 = 11, d7 = 12; 18LiquidCrystal lcd(rs, en, d4, d5, d6, d7); 19 20void setup() { 21 pinMode(MOSFETpin,OUTPUT); 22 pinMode(footswitchorbutton,INPUT_PULLUP); 23 pinMode(A0,INPUT); 24 pinMode(lightpin,OUTPUT); 25 digitalWrite(lightpin,HIGH); 26 timetilnext = millis(); 27 locksec = 0; 28 lcd.begin(16,2); 29 lcd.clear(); 30 31} 32 33void loop() { 34 35 if(millis() <= timetilnext){ 36 locksec = (timetilnext-millis())/1000; 37 if(locksec != prevlock){ 38 lcd.clear(); 39 lcd.setCursor(2,0); 40 lcd.print("locked for:"); 41 lcd.setCursor(7,1); 42 lcd.print(locksec); 43 lcd.print("s"); 44 prevlock = locksec; 45 } 46 oneafterlocked = 1; 47 } 48 49 50 dlay = map(analogRead(A0),0,1023,1,15); 51 dlay = dlay*10; 52 53 if(millis() >= timetilnext){ 54 55 if(dlay != prevdlay || oneafterlocked == 1){ 56 joule = dlay/.1000*power/10000; 57 lcd.clear(); 58 lcd.setCursor(0,0); 59 lcd.print("Pulse:"); 60 lcd.print(dlay); 61 lcd.print("ms"); 62 lcd.setCursor(0,1); 63 lcd.print("Energy:"); 64 lcd.print(joule); 65 lcd.print("J"); 66 oneafterlocked = 0; 67 prevdlay = dlay; 68 } 69 if(digitalRead(footswitchorbutton) == LOW){ 70 tone(piezopin,1000); 71 delay(500); 72 noTone(piezopin); 73 delay(500); 74 tone(piezopin,1000); 75 delay(500); 76 noTone(piezopin); 77 delay(500); 78 tone(piezopin,1000); 79 delay(500); 80 noTone(piezopin); 81 delay(500); 82 tone(piezopin,2000); 83 delay(1000); 84 noTone(piezopin); 85 delay(500); 86 digitalWrite(MOSFETpin,HIGH); 87 delay(dlay); 88 digitalWrite(MOSFETpin,LOW); 89 timetilnext = 5000+millis(); 90 } 91 } 92 93} 94
CD_spot_welder_Serial.ino
c_cpp
1int power = 1920; // power of the battery in Watts 2int MOSFETpin = 3; 3int piezopin = 13; 4 5int footswitchorbutton = 2; 6 7int dlay = 0; 8unsigned long timetilnext; 9unsigned long locksec; 10int oneafterlocked; 11int prevdlay; 12int prevlock; 13int joule; 14 15void setup() { 16 pinMode(MOSFETpin,OUTPUT); 17 pinMode(footswitchorbutton,INPUT_PULLUP); 18 pinMode(A0,INPUT); 19 Serial.begin(9600); 20 timetilnext = millis(); 21 locksec = 0; 22} 23 24void loop() { 25 26 if(millis() <= timetilnext){ 27 locksec = (timetilnext-millis())/1000; 28 if(locksec != prevlock){ 29 Serial.print("locked for:"); 30 Serial.print(locksec); 31 Serial.println("s"); 32 prevlock = locksec; 33 } 34 oneafterlocked = 1; 35 } 36 37 38 dlay = map(analogRead(A0),0,1023,1,15); 39 dlay = dlay*10; 40 41 if(millis() >= timetilnext){ 42 43 if(dlay != prevdlay || oneafterlocked == 1){ 44 joule = dlay/.1000*power/10000; 45 Serial.print("Pulse:"); 46 Serial.print(dlay); 47 Serial.println("ms"); 48 Serial.print("Energy:"); 49 Serial.print(joule); 50 Serial.println("J"); 51 oneafterlocked = 0; 52 prevdlay = dlay; 53 } 54 if(digitalRead(footswitchorbutton) == LOW){ 55 tone(piezopin,1000); 56 delay(500); 57 noTone(piezopin); 58 delay(500); 59 tone(piezopin,1000); 60 delay(500); 61 noTone(piezopin); 62 delay(500); 63 tone(piezopin,1000); 64 delay(500); 65 noTone(piezopin); 66 delay(500); 67 tone(piezopin,2000); 68 delay(1000); 69 noTone(piezopin); 70 delay(500); 71 digitalWrite(MOSFETpin,HIGH); 72 delay(dlay); 73 digitalWrite(MOSFETpin,LOW); 74 timetilnext = 5000+millis(); 75 } 76 } 77 78} 79
Downloadable files
The scematic
The scematic
The scematic as PDF
The scematic as PDF
The scematic
The scematic
The scematic as PDF
The scematic as PDF
Comments
Only logged in users can leave comments