/*******************************************************************************
* Title: RS Reflow Hot-plate Controller
* Version: 3.01 SE HP
* Date: 10-06-2013
* Author : SDS
* Brief
* =====
* This is a firmware for RocketScream's Arduino compatible reflow oven controller.
* The reflow curve used in this firmware is meant for lead-free solder profile
* Alloy -----Sn96.5Ag3Cu0.5--------- (acc. to J-STD-020D.01)
* Specially 'tuned'for led IMS/MCPCB reflow soldering .
*
* This firmware owed very much on the works of :
* ==========================================
* Brett Beauregard (
www.brettbeauregard.com)
* ==========================================
* Author of Arduino PID library. On top of providing industry standard PID
* implementation, he gave a lot of help in making this reflow oven controller
* possible using his awesome library.
*
* ==========================================
* Limor Fried of Adafruit (
www.adafruit.com)
* ==========================================
* Author of Arduino MAX6675 library. Adafruit has been the source of tonnes of
* tutorials, examples, and libraries for everyone to learn.
* ============================================
* -For Arduino shield of v1.60 & above .
* -Sends data ,over serial port ,for real time monitoring of reflow parameters
* to >>>>SimPlot Software <<<<< (Kinda like an Oscilloscope ).Up to 4 channels can be plotted.
*
* Licences
* ========
* This reflow hot-plate controller hardware and firmware are released under the
* Creative Commons Share Alike v3.0 license
*
http://creativecommons.org/licenses/by-sa/3.0/
* You are free to take this piece of code, use it and modify it.
*
* Required Libraries
* ==================
* - Arduino PID Library:
* >>
https://github.com/br3ttb/Arduino-PID-Library
* - MAX31855 Library (for board v1.60 & above):
* >>
https://github.com/rocketscream/MAX31855
* >>>>>>>>>>>>>>>>>>>For details of SimPlot go to>>>>>>>>>>>>>>>>>>>>>>>>
* >>>>>>>>>>>>>>>>>>>>>>>>>>>
www.negtronics.com/simplot <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
* Download SimPlot :
http://code.google.com/p/projectsimplot/downloads/list
***********************************************************************************/
//...
//..
//.
//Initialise
// Newer board version starts from v1.60 using MAX31855KASA+ chip
#define USE_MAX31855
// Libraries Included
#include <LiquidCrystal.h>
#include <MAX31855.h>
#include <PID_v1.h>
// ***** TYPE DEFINITIONS *****
typedef enum REFLOW_STATE
{
REFLOW_STATE_IDLE,
REFLOW_STATE_PREHEAT,
REFLOW_STATE_SOAK,
REFLOW_STATE_REFLOW,
REFLOW_STATE_COOL,
REFLOW_STATE_COMPLETE,
REFLOW_STATE_TOO_HOT,
REFLOW_STATE_ERROR
} reflowState_t;
//
typedef enum REFLOW_STATUS
{
REFLOW_STATUS_OFF,
REFLOW_STATUS_ON
} reflowStatus_t;
//
typedef enum SWITCH
{
SWITCH_NONE,
SWITCH_1,
SWITCH_2
}
switch_t;
//
typedef enum DEBOUNCE_STATE
{
DEBOUNCE_STATE_IDLE,
DEBOUNCE_STATE_CHECK,
DEBOUNCE_STATE_CHECK2,
DEBOUNCE_STATE_RELEASE,
DEBOUNCE_STATE_RELEASE2
} debounceState_t;
//
//
//
//
//
//
//******************************************************************************************************************
//*******************************USER ADJUSTABLE PID & SOLDER PROFILE PARAMETERS************************************
//******************************************************************************************************************
//____________________________________________Solder Profile : Sn96.5Ag3Cu.5________________________________________________
#define TEMPERATURE_ROOM 45 // Oven has to be < 45°C for reflowing to start
#define PREHEAT_TEMPERATURE_STEP 3 //ONLY FOR hot plate ====> !!!Δ= 2°C/sec !!! -hotplate preheat routine**
#define PREHEAT_MICRO_PERIOD 1500 // ONLY FOR hot plate =====> !!!Δ=2°C/sec -hotplate preheat routine**
#define TEMPERATURE_SOAK_MIN 150 // preheat should be done at ~2°C/sec ramp rate .For ~ 60 sec
#define TEMPERATURE_SOAK_MAX 200 // Soak ramps up to ~180°C at ~0.5 °C /sec slope..
#define SOAK_TEMPERATURE_STEP 1.25 //====> !!!Δ=~ 0,5 °C/sec %...Default FOR OVEN : 5
#define SOAK_MICRO_PERIOD 2500 //%=========>^^^^^^^^^ .......Default FOR OVEN : 9000
#define REFLOW_TEMPERATURE_STEP 2.5 // REFLOW PEAK RAMP ====> !!!Δ= 0.7-1°C/sec - peak ramp **
#define REFLOW_MICRO_PERIOD 3500 // REFLOW PEAK RAMP =====> !!!Δ=0.7°-1 C/sec -peak ramp **
#define TEMPERATURE_REFLOW_MIN 217 // Liquidus Point .Total time above is ~80 sec.
#define TEMPERATURE_REFLOW_MAX 247 // Max =260°C (Pref .Peak =245°C) .20" total within ( 245°C - 5°C )
#define TEMPERATURE_COOL_MIN 100 // Ramp-down rate : -3°C/sec .Max = -6°C/sec
//
//________________________________________ PID parameters : BASIC 1200 Watt Ceramic HOT PLATE _____________________________
// ~ Pre-heat
#define PID_KP_PREHEAT 200 // Suggested Range 100-300
#define PID_KI_PREHEAT 0.03 // Suggested Range 0.020-0.030 (STAY LOW )-Default :0.025
#define PID_KD_PREHEAT 150 // Suggested Range 150-300
// ~ Soak
#define PID_KP_SOAK 300 // Suggested Range 180-350
#define PID_KI_SOAK 0.05 // Suggested Range 0.05-0.1
#define PID_KD_SOAK 250 // Suggested Range 75-300
// ~ Reflow
#define PID_KP_REFLOW 300 // Suggested Range 150-350- Default: 300
#define PID_KI_REFLOW 0.05 // Suggested Range 0.05-0.1
#define PID_KD_REFLOW 370 // Suggested Range 100-350 Default :300-350
//~Sampling Rates
#define PID_SAMPLE_TIME 250 // Stable-DEFAULT :1000
#define SENSOR_SAMPLING_TIME 250 // Stable-DEFAULT :1000
//
//******************************************************************************************************************
//******************************************************************************************************************
//******************************************************************************************************************
//
//
//
//
//
//
//HARDWARE PARAMETERS____________________________________________________________________________________________
// Switch Debounce Limit
#define DEBOUNCE_PERIOD_MIN 50
// Buzzer
// soak-to-reflow buzz
#define BEEPDURATION_REFLOW 500
// reflow-to-cool buzz
#define BEEPDURATION_COOL 500
// cool-to-complete buzz
#define BEEPDURATION_COMPLETE 1000
// LCD Display messages
const char* lcdMessagesReflowStatus[] = {
"<READY>",
"PREHEAT",
"SOAK",
"REFLOW",
"COOL",
"COMPLETE",
"WAIT,HOT",
"CAUTION!"
};
//
// ° symbol for LCD display
unsigned char degree[8] =
{
140,146,146,140,128,128,128,128
};
//
// ___________Hardware assignment_________________________
// PINS
int ssrPin = 5;
int thermocoupleSOPin = A3;
int thermocoupleCSPin = A2;
int thermocoupleCLKPin = A1;
int lcdRsPin = 7;
int lcdEPin = 8;
int lcdD4Pin = 9;
int lcdD5Pin = 10;
int lcdD6Pin = 11;
int lcdD7Pin = 12;
int ledRedPin = 13; // <= scrape off the 'L' on-board led of Arduino UNOv3 .It draws current from pin 13 .
int ledAmberPin = 4;
int buzzerPin = 6;
int switchPin = A0;
//_______________ PID Control Variable List______________
double setpoint;
double input;
double p_input;
double slope;
double output;
double kp = PID_KP_PREHEAT;
double ki = PID_KI_PREHEAT;
double kd = PID_KD_PREHEAT;
int windowSize;
unsigned long windowStartTime;
unsigned long nextCheck;
unsigned long nextRead;
unsigned long timerPreHeat; // hot plate preheat **-hotplate preheat routine**
unsigned long timerSoak;
unsigned long SoakStartTime;
unsigned long timerREFLOW; // peak ramp **
unsigned long ReflowStartTime;
unsigned long ReflowDwellTime;
unsigned long buzzerPeriod;
// Reflow oven controller "machine state" variable
reflowState_t reflowState;
// Reflow oven controller "status"
reflowStatus_t reflowStatus;
// Switch debounce "machine state" variable
debounceState_t debounceState;
// Switch debounce timer
long lastDebounceTime;
// Switch press "status"
switch_t switchStatus;
// Seconds timer
int timerSeconds;
// PID control interface
PID reflowOvenPID(&input, &output, &setpoint, kp, ki, kd, DIRECT);
// LCD interface
LiquidCrystal lcd(lcdRsPin, lcdEPin, lcdD4Pin, lcdD5Pin, lcdD6Pin, lcdD7Pin);
MAX31855 thermocouple(thermocoupleSOPin, thermocoupleCSPin, thermocoupleCLKPin);
// _______________Simplot Data Buffer_______________________
int buffer[20];
int data1;
int data2;
int data3;
//
//Declare plot function
//******************************************
void plot ( int data1, int data2, int data3 )
{
int pktSize;
buffer[0] = 0xCDAB; //SimPlot packet header. Indicates start of data packet
buffer[1] = 3*sizeof(int); //Size of data in bytes. Does not include the header and size fields
buffer[2] = data1;
buffer[3] = data2;
buffer[4] = data3;
pktSize = 2 + 2 + (3*sizeof(int)); //Header bytes + size field bytes + data
//IMPORTANT: Change to serial port that is connected to PC
Serial.write((uint8_t * )buffer, pktSize);
}
//____________________________________________________________
//
//*******************************************************SET UP ******************************************
//
void setup()
{
// SSR pin initialization / reflow oven off
digitalWrite(ssrPin, LOW);
pinMode(ssrPin, OUTPUT);
// Buzzer pin initialization / buzzer off
digitalWrite(buzzerPin, LOW);
pinMode(buzzerPin, OUTPUT);
// LEDs pins initialization /turn on (active low)
digitalWrite(ledRedPin, HIGH);
pinMode(ledRedPin,OUTPUT);
delay(2000);
digitalWrite(ledRedPin, LOW);
digitalWrite(ledAmberPin, HIGH);
pinMode(ledAmberPin,OUTPUT);
delay(1000);
digitalWrite(ledAmberPin, LOW);
// LCD Start-up splash
digitalWrite(buzzerPin, HIGH);
delay (750);
digitalWrite(buzzerPin, LOW);
lcd.begin(8, 2);
lcd.createChar(0, degree);
lcd.clear();
lcd.print("Solder:");
lcd.setCursor(0, 1);
lcd.print("SnAgCu");
delay(2500);
lcd.clear();
// Serial communication @ 57600 bps
Serial.begin(57600);
// PWM window size
windowSize = 2000;
// Initialize time variable
nextCheck = millis();
// Initialize thermocouple input variable
nextRead = millis();
}
//*******************************************************LOOP OPERATION***************************************
//************************************************************************************************************
void loop()
{
// Current time
unsigned long now;
// Time to read thermocouple
if (millis() > nextRead)
{
// Read thermocouple next sampling period
nextRead += SENSOR_SAMPLING_TIME;
// Read current temperature
p_input = input ;
input = thermocouple.readThermocouple(CELSIUS);
slope = (input - p_input);
// If thermocouple problem detected
if((input == FAULT_OPEN) || (input == FAULT_SHORT_GND) || (input == FAULT_SHORT_VCC))
{
// Illegal operation-ERROR!
reflowState = REFLOW_STATE_ERROR;
digitalWrite (ledRedPin,HIGH );
reflowStatus = REFLOW_STATUS_OFF;
}
}
//______________________________
if (millis() > nextCheck)
{
// Check input in the next 1"
nextCheck += 1000;
// If reflow process is on going
if (reflowStatus == REFLOW_STATUS_ON)
{
// Toggle Amber LED as system's heart beat
digitalWrite(ledAmberPin, !(digitalRead(ledAmberPin)));
// Increase seconds timer for reflow curve analysis
timerSeconds++;
Serial.print("T:"); // time
Serial.print(timerSeconds);
Serial.print(" SETPOINT: "); // Set point
Serial.print(setpoint);
Serial.print(" IN:"); // input TC °C
Serial.print(input);
Serial.print(" OUT:"); // mS window PWM
Serial.print(output);
Serial.print(" RAMP:"); // Δ Slope -/+ °C /sec
Serial.print(slope);
Serial.print(" REFLOW:"); // Reflow Start
Serial.print(ReflowStartTime);
Serial.print(" DWELL:"); // Reflow Total Dwell Above liquidus State 217=>~245=>217 °C
Serial.println(ReflowDwellTime);
//Serial SimPlot Data
data1 =thermocouple.readThermocouple(CELSIUS);
data2= setpoint;
data3= slope;
plot (data1,data2,data3);
delay(10);
}
else
{
// Turn off AMBER LED
digitalWrite(ledAmberPin,LOW);
}
// Clear LCD
lcd.clear();
// Print current system state
lcd.print(lcdMessagesReflowStatus[reflowState]);
// Move the cursor to the SECOND line
lcd.setCursor(0, 1);
// If currently in error state
if (reflowState == REFLOW_STATE_ERROR)
{
// No thermocouple wire connected
digitalWrite(buzzerPin, HIGH);
delay(500);
digitalWrite(buzzerPin, LOW);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("TC Error");
lcd.setCursor(0, 1);
lcd.print("Check TC");
// Turn on green+red(amber) led .Turn on red LED
digitalWrite(ledRedPin,HIGH);
}
else
{
// Print current temperature
lcd.print(input);
#if ARDUINO >= 100// Print degree Celsius symbol in 3 digit value
lcd.write((uint8_t)0);
#else
// Print degree Celsius symbol in 2 digit value
lcd.print(0, BYTE);
#endif
lcd.print("C");
}
}
//SWITCH CASE -PID SnAgCu PROFILING **************************************************************
// Reflow oven controller state machine
switch (reflowState)
{
case REFLOW_STATE_IDLE:
// If oven temperature is still above room temperature
if (input >= TEMPERATURE_ROOM)
{
reflowState = REFLOW_STATE_TOO_HOT;
// Turn off Amber LED
digitalWrite(ledAmberPin,LOW);
// Red led on
digitalWrite(ledRedPin,HIGH);
}
else
{
// If switch is pressed to start reflow process
if (switchStatus == SWITCH_1)
{
// Send header for CSV file // Processing Software
Serial.println();
// Intialize seconds timer for serial debug information
timerSeconds = 0;
// Initialize PID control window starting time
windowStartTime = millis();
// Ramp up to minimum soaking temperature
//setpoint = TEMPERATURE_SOAK_MIN; // disabled for hot plate
// Tell the PID to range between 0 and the full window size
reflowOvenPID.SetOutputLimits(0, windowSize);
reflowOvenPID.SetSampleTime(PID_SAMPLE_TIME);
// Turn the PID on
reflowOvenPID.SetMode(AUTOMATIC);
// Proceed to preheat stage
reflowState = REFLOW_STATE_PREHEAT;
}
}
break;
case REFLOW_STATE_PREHEAT:
reflowStatus = REFLOW_STATUS_ON;
// If minimum PREHEAT temperature is achieve
if (input <= TEMPERATURE_ROOM)//-hotplate preheat routine**
{
// Chop soaking period into smaller sub-period //hot plate
timerPreHeat = millis() + PREHEAT_MICRO_PERIOD; //hot plate -hotplate preheat routine**
reflowOvenPID.SetTunings(PID_KP_PREHEAT, PID_KI_PREHEAT, PID_KD_PREHEAT);
// Ramp up to first section of preheat temperature -hotplate
setpoint = TEMPERATURE_ROOM + PREHEAT_TEMPERATURE_STEP; // hot plate -hotplate preheat routine**
}
// If micro preheat temperature is achieved-hot plate
if (millis() > timerPreHeat) //hot plate -hotplate preheat routine**
{
timerPreHeat = millis() + PREHEAT_MICRO_PERIOD; // hot plate -hotplate preheat routine**
// Increment micro-setpoint
setpoint += PREHEAT_TEMPERATURE_STEP;// hot plate -hotplate preheat routine**
// If minimum soak temperature is achieve
if (setpoint >= TEMPERATURE_SOAK_MIN)
{
// Set less agressive PID parameters for soaking ramp
reflowOvenPID.SetTunings(PID_KP_SOAK, PID_KI_SOAK, PID_KD_SOAK);
// Ramp up to first section of soaking temperature
setpoint = TEMPERATURE_SOAK_MIN + SOAK_TEMPERATURE_STEP;
// Chop soaking period into smaller sub-period
timerSoak = millis() + SOAK_MICRO_PERIOD;
// Proceed to soaking state
reflowState = REFLOW_STATE_SOAK;
SoakStartTime = timerSeconds ;
}
}
break;
case REFLOW_STATE_SOAK:
// If micro soak temperature is achieved
if (millis() > timerSoak)
{
timerSoak = millis() + SOAK_MICRO_PERIOD;
// Increment micro setpoint
setpoint += SOAK_TEMPERATURE_STEP;
if (setpoint >= TEMPERATURE_SOAK_MAX) // >= or > or == ???
{
// Set agressive PID parameters for reflow ramp
reflowOvenPID.SetTunings(PID_KP_REFLOW, PID_KI_REFLOW, PID_KD_REFLOW);
// Ramp up to first section of soaking temperature
setpoint = TEMPERATURE_SOAK_MAX + REFLOW_TEMPERATURE_STEP;
//// Chop ramping to peak period into smaller sub-period
timerREFLOW = millis() + REFLOW_MICRO_PERIOD;
// Proceed to reflowing state
reflowState = REFLOW_STATE_REFLOW;
ReflowStartTime = 0;
//BUZZER FUNCTION
buzzerPeriod = millis() + BEEPDURATION_REFLOW ;
digitalWrite(buzzerPin, HIGH);
}
}
break;
case REFLOW_STATE_REFLOW:
if (millis() > buzzerPeriod) // turn off buzzer
{
digitalWrite(buzzerPin, LOW);
}
// If micro dwell ramp temperature is achieved
if (millis() > timerREFLOW)
{
timerREFLOW = millis() + REFLOW_MICRO_PERIOD;
// Increment micro setpoint
setpoint += REFLOW_TEMPERATURE_STEP;
if ( (input >= TEMPERATURE_REFLOW_MIN) && (ReflowStartTime == 0 ) )
{
ReflowStartTime = timerSeconds ; // set Reflow Start Time
}
//**************************************************************************************************************
//**************************Adjustable Parameter: Peak temperature Safety Anti-Overshoot *******************************
if (setpoint >= (TEMPERATURE_REFLOW_MAX - 5)) //<= Adjustable parameter !!!!!!!!!!!! Range : 3 -7 !!!!!!!!!!!!!!!!!
//**************************************************************************************************************
// Also it can be set as "input" instead of "setpoint".Better for reflow oven.Not for hot-plating,though .
//**************************************************************************************************************
{
// Set PID parameters for cooling ramp
reflowOvenPID.SetTunings(PID_KP_REFLOW, PID_KI_REFLOW, PID_KD_REFLOW);
// Ramp down to minimum cooling temperature
setpoint = TEMPERATURE_COOL_MIN;
// Proceed to cooling state
reflowState = REFLOW_STATE_COOL;
buzzerPeriod = millis() + BEEPDURATION_COOL;
digitalWrite(buzzerPin, HIGH);
}
}
break;
case REFLOW_STATE_COOL:
if (millis() > buzzerPeriod) // turn off buzzer
{
digitalWrite(buzzerPin, LOW);
}
// "Wetting"-Dwell time
if ( (ReflowDwellTime == 0) && (input <= TEMPERATURE_REFLOW_MIN) )
{
ReflowDwellTime = ( timerSeconds - ReflowStartTime );
}
// If minimum cool temperature is achieve
if (input <= TEMPERATURE_COOL_MIN)
{
// Retrieve current time for buzzer usage
buzzerPeriod = millis() + BEEPDURATION_COMPLETE;
// Turn on buzzer +Green led to indicate completion
digitalWrite(buzzerPin, HIGH);
// Turn off reflow process
reflowStatus = REFLOW_STATUS_OFF;
// Proceed to reflow Completion state
reflowState = REFLOW_STATE_COMPLETE;
}
break;
case REFLOW_STATE_COMPLETE:
if (millis() > buzzerPeriod)
{
// Turn off buzzer & led
digitalWrite(buzzerPin, LOW);
digitalWrite(ledAmberPin,LOW);
// Reflow process ended
reflowState = REFLOW_STATE_IDLE;
}
break;
case REFLOW_STATE_TOO_HOT:
// If oven temperature drops below room temperature
if (input < TEMPERATURE_ROOM)
{
// Ready to reflow
reflowState = REFLOW_STATE_IDLE;
}
break;
case REFLOW_STATE_ERROR:
// If thermocouple problem is still present
if((input == FAULT_OPEN) || (input == FAULT_SHORT_GND) || (input == FAULT_SHORT_VCC))
{
// Wait until thermocouple wire is connected
reflowState = REFLOW_STATE_ERROR;
}
else
{
// Clear to perform reflow process
reflowState = REFLOW_STATE_IDLE;
}
break;
}
// If switch 1 is pressed
if (switchStatus == SWITCH_1)
{
// If currently reflow process is on going
if (reflowStatus == REFLOW_STATUS_ON)
{
// Button PRESS FOR ABORT !
// Turn off reflow process!
reflowStatus = REFLOW_STATUS_OFF;
// Turn on Red LED and beep.then turn led
digitalWrite(ledRedPin,HIGH);
digitalWrite(buzzerPin,HIGH);
delay (1700);
digitalWrite(ledRedPin,LOW);
digitalWrite(buzzerPin,LOW);
// Reinitialize state state idle
reflowState = REFLOW_STATE_IDLE;
}
}
//SWITCH CASE -DEBOUNCING **************************************************************************
// switch debounce state machine
switch (debounceState)
{
case DEBOUNCE_STATE_IDLE:
// No valid switch press
switchStatus = SWITCH_NONE;
// If switch #1 is pressed
if (analogRead(switchPin) == 0)
{
// Intialize debounce counter
lastDebounceTime = millis();
// Proceed to check validity of button press
debounceState = DEBOUNCE_STATE_CHECK;
}
if ( analogRead(switchPin) == constrain(switchPin,480,540))
{
// Intialize debounce counter
lastDebounceTime = millis();
// Proceed to check validity of button press
debounceState = DEBOUNCE_STATE_CHECK2;
}
break;
case DEBOUNCE_STATE_CHECK:
if (analogRead(switchPin) == 0)
{
// If minimum debounce period is completed
if ((millis() - lastDebounceTime) > DEBOUNCE_PERIOD_MIN)
{
// Proceed to wait for button release
debounceState = DEBOUNCE_STATE_RELEASE;
}}
// False trigger
else
{
// Reinitialize button debounce state machine
debounceState = DEBOUNCE_STATE_IDLE;
}
break;
// ......................................
//**********Setting software-based debouncing function for future use of Switch #2 ***************************
//" constrain(switchPin,480,540) " = Although switch #2 when pressed , gives a value of 510 ,when Arduino is powered through
// the USB port ,actual value may differ with other power sources .Setting a range of +/-30 ( +/- ~146 mV )
//*********************************************************************************************
case DEBOUNCE_STATE_CHECK2:
if (analogRead(switchPin) == constrain(switchPin,480,540) )
{
// If minimum debounce period is completed
if ((millis() - lastDebounceTime) > DEBOUNCE_PERIOD_MIN)
{
// Proceed to wait for button release
debounceState = DEBOUNCE_STATE_RELEASE2;
}}
// False trigger
else
{
// Reinitialize button debounce state machine
debounceState = DEBOUNCE_STATE_IDLE;
}
break;
case DEBOUNCE_STATE_RELEASE:
if (analogRead(switchPin) > 0)
{
// Valid switch 1 press
switchStatus = SWITCH_1;
// Reinitialize button debounce state machine
debounceState = DEBOUNCE_STATE_IDLE;
}
break;
case DEBOUNCE_STATE_RELEASE2:
if (analogRead(switchPin) > constrain(switchPin,480,540))
{
// Valid switch 2 press
switchStatus = SWITCH_2;
// Reinitialize button debounce state machine
debounceState = DEBOUNCE_STATE_IDLE;
}
break;
}
//***************************************************************************************
// PID computation and SSR control
if (reflowStatus == REFLOW_STATUS_ON)
{
now = millis();
reflowOvenPID.Compute();
if((now - windowStartTime) > windowSize)
{
// Time to shift the Relay Window
windowStartTime += windowSize;
}
if(output > (now - windowStartTime)) digitalWrite(ssrPin, HIGH);
else digitalWrite(ssrPin, LOW);
}
// Reflow oven process is off, ensure oven is off
else
{
digitalWrite(ssrPin, LOW);
}
}
// **********END OF LOOP *****************************
//*****************************************************
//
//
//
// *******************************************NOTES***************************************************
//****************************************************************************************************
//
//
// ============================================> SimPlot Settings <===================================
// -Set Conn speed at => 57600 <=
//
//_Input_ , _Setpoint_ & _Slope_ values, are plotted .
//
// -At tab "Plot Setup" At X axis __time set 300-480 ( 8 min =480 sec )
// ( ~8 min is >max duration< of reflow from >start to finish< ,
// according to J-STD-020D.01 standard. )................................
//
// -At Y Axis__Input/Set Temperature, set min Val @ -10 ( cooling ramp :no more than -6°C /sec. ).
// Or at Room ambient Temp ~ 20-25°C
// -Max Y Axis value set ~ 260-270 as "ceiling " of plot .
//
//-Set COM xx port.
// -Press "Connect" .
// Start Reflow sequence
//===================================================================================================
//
//