I am trying to display on a 16x02 LCD display 2 error codes. The error message is when one or both thermocouple wires get disconnected and the second error message is when the soldering iron temp goes higher than 432 C. I am using MAX6675 module. The problem is that when I disconnect one thermocouple wire (the + or the -) sometimes the displayed message is "Overheating !!!" instead of "No tc conn !!!".
Is there any way to display the correct error ?
heaterTemp = thermocouple.readCelsius();
Input = heaterTemp - 100;
//No TC connection
if (isnan(Input)) // No TC Connection
{
while (true) {
digitalWrite(relay_pin, LOW);
digitalWrite(11, LOW);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("NO TC CONN !!!");
delay(1000);
}
}
//Soldering Iron overtemperature
if (Input >= 432)
{
while (true) {
digitalWrite(relay_pin, LOW);
digitalWrite(11, LOW);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("OVERHEATING !!!");
delay(1000);
}
}
Edit: I finally decided to use the same message for both errors - no TC connection and overheating. I used the code below:
heaterTemp = thermocouple.readCelsius();
Input = 0.779828 * heaterTemp - 10.3427;
if (isnan(heaterTemp) or Input >= 432) // No TC Connection OR over-temperature
{
while (true) {
digitalWrite(relay_pin, LOW);
digitalWrite(11, LOW);
for (int i=0; i<=1; i++){
lcd.clear();
lcd.setCursor(0, i);
lcd.write((byte)0);
lcd.setCursor(1, i);
lcd.write((byte)0);
lcd.setCursor(5, i);
lcd.print("ERROR!");
lcd.setCursor(14, i);
lcd.write((byte)0);
lcd.setCursor(15, i);
lcd.write((byte)0);
delay(1000);
}
}
}
and
byte thermometer[8] = //icon for termometer
{
B00100,
B01010,
B01010,
B01110,
B01110,
B11111,
B11111,
B01110
};
The code displays the thermometer symbol at the beginning and at the end of the row and the text (including the symbols) are moving from one to another row.
Now it is sufficiently to display a error message when the thermocouple gets disconnected or when the iron temperature goes above 432 *C.
I have also left the 2 while(true) loops because I need the program to stay in the loop and display the error message until I turn off the power and start again the soldering station.
Input
? anint
?float
?unsigned
?