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