Hi All,
I've (well actually a friend of mine) had been trying to replace the PCB that came on the Sunkko 709A sot welder and with the circuit attached and all seem to work but after building about 5 to 10 packs something went wrong and the device goes into continuous mode. It may not be the TRIAC that is smoked as it still works in continuous mode (attached sketch).
So what would be reason for the failure? is it the snubber circuit ?
byte zCd = 2; // Zero Crossing Detect
const byte TRIAC = 3; //Load Output
const byte rdy = 4;
const byte btn = 6 ;
const byte bzr = 8; // Previously 8, did not buzz at times.
const byte L8 = 9;
const byte L7 = 10;
const byte L6 = 11;
const byte L5 = 12;
const byte L4 = 13;
const byte L3 = A2;
const byte L2 = A3;
const byte L1 = A4;
const byte Pot = A5; //POT value pin
const int debounce = 10; // ms debounce period to prevent flickering when pressing or releasing the button
const int holdTime = 800; // ms hold period: how long to wait for press+hold event
int WeldCounter = 0; // prevents weld at boot
int counter1 = 0;
int counter = 0;
int WeldStepValue; // Value of POT in milliseconds
int OldWeldStepValue; // Old value of POT
int PotValue; // Actual POT value
volatile boolean zeroCrossingFlag = false;
int btnState; // value read from button
int buttonLast = HIGH; // buffered value of the button's previous state
long btnDnTime; // time the button was pressed down
long btnUpTime; // time the button was released
boolean ignoreUp = false; // whether to ignore the button release because the click+hold was triggered
void setup()
{
pinMode(Pot, INPUT);
pinMode(TRIAC, OUTPUT);
pinMode(rdy, OUTPUT);
pinMode(L1, OUTPUT);
pinMode(L2, OUTPUT);
pinMode(L3, OUTPUT);
pinMode(L4, OUTPUT);
pinMode(L5, OUTPUT);
pinMode(L6, OUTPUT);
pinMode(L7, OUTPUT);
pinMode(L8, OUTPUT);
pinMode(bzr, OUTPUT);
pinMode(zCd, INPUT_PULLUP);
pinMode(btn, INPUT_PULLUP);
attachInterrupt(0, setFlag, FALLING);//zero cross attach
delay(500);
LedRun();
Serial.begin(9600);
}
void setFlag()
{
zeroCrossingFlag = true; //interrupt sets flag true
}
void WeldStepVal() // Display POT value for Debug
{
Serial.print("Set weld time: ");
Serial.print(WeldStep());
Serial.println("ms");
}
void LedRun() // Test output from IC to all LED
{
digitalWrite(L1, HIGH);
delay(100);
digitalWrite(L1, LOW);
digitalWrite(L2, HIGH);
delay(100);
digitalWrite(L2, LOW);
digitalWrite(L3, HIGH);
delay(100);
digitalWrite(L3, LOW);
digitalWrite(L4, HIGH);
delay(100);
digitalWrite(L4, LOW);
digitalWrite(L5, HIGH);
delay(100);
digitalWrite(L5, LOW);
digitalWrite(L6, HIGH);
delay(100);
digitalWrite(L6, LOW);
digitalWrite(L7, HIGH);
delay(100);
digitalWrite(L7, LOW);
digitalWrite(L8, HIGH);
delay(100);
digitalWrite(L8, LOW);
delay(200);
}
const int Weld(int pre, int pause) //Actual weld
{
delay(400);
zeroCrossingFlag = false; //set flag false and wait for next zero crossing
while (!zeroCrossingFlag) {};
delayMicroseconds(5630); //delay to trigger at peak sine wave
digitalWrite(rdy, LOW);
digitalWrite(TRIAC, HIGH);
delay(pre); //preWeld time
zeroCrossingFlag = false; //set flag false and wait for next zero crossing
while (!zeroCrossingFlag) {};
digitalWrite(TRIAC, LOW);
delay(pause);
while (counter1 < 1) { // Set multiple Welds after Pre-weld, deault is 1
delay(50);
zeroCrossingFlag = false; //set flag false and wait for next zero crossing
while (!zeroCrossingFlag) {};
delayMicroseconds(5630);
digitalWrite(TRIAC, HIGH);
delay(WeldStep());
zeroCrossingFlag = false; //set flag false and wait for next zero crossing
while (!zeroCrossingFlag) {};
digitalWrite(TRIAC, LOW);
counter1++;
}
counter1 = 0;
zeroCrossingFlag = false;
while (!zeroCrossingFlag) {};
digitalWrite(TRIAC, LOW);
delay(300);
digitalWrite(bzr, HIGH);
delay(70);
digitalWrite(bzr, LOW);
}
void continousWeld()
{
delay(400);
digitalWrite(bzr, HIGH);
delay(60);
digitalWrite(bzr, LOW);
delay(50);
digitalWrite(bzr, HIGH);
delay(60);
digitalWrite(bzr, LOW);
while (counter < 6)
{
btnState = digitalRead(btn);
if (btnState == LOW)
{
break;
}
delay(1000);
Weld(50, 500);
counter++;
}
counter = 0;
delay(500);
digitalWrite(bzr, HIGH);
delay(500);
digitalWrite(bzr, LOW);
}
void LED_OFF()
{
digitalWrite(L1, LOW);
digitalWrite(L2, LOW);
digitalWrite(L3, LOW);
digitalWrite(L4, LOW);
digitalWrite(L5, LOW);
digitalWrite(L6, LOW);
digitalWrite(L7, LOW);
digitalWrite(L8, LOW);
}
void PulseSetLed() // Display weld time 100, 150...... as LED
{
const int wait = 200;
digitalWrite(rdy, HIGH);
// For debug
if (OldWeldStepValue != WeldStep())
{
WeldStep();
OldWeldStepValue = WeldStep();
}
PulseSetLed();
// Test for button pressed and store the down time
if (btnState == LOW && buttonLast == HIGH && (millis() - btnUpTime) > long(debounce))
{
btnDnTime = millis();
}
}