Okay so this is what I have so far.. I only have a few temperature refrences as yet, however when the temperature probe is less than 27 Deg C, it reads "Too Cold" correctly. However if the temp is above 27 Deg, then it just seems to freeze and even the temperatue does't vary unless it drops below 27 deg again. The serial print of the tep continues to work throughought.
I like the sound of a lookuo table, however I am totaly clueless as to how I would create it.
#include <LiquidCrystal_I2C.h>
#include <Adafruit_MAX31865.h>
// Use software SPI: CS, DI, DO, CLK
Adafruit_MAX31865 thermo = Adafruit_MAX31865(10, 11, 12, 13);
// use hardware SPI, just pass in the CS pin
//Adafruit_MAX31865 thermo = Adafruit_MAX31865(10);
// The value of the Rref resistor. Use 430.0 for PT100 and 4300.0 for PT1000
#define RREF 4300.0
// The 'nominal' 0-degrees-C resistance of the sensor
// 100.0 for PT100, 1000.0 for PT1000
#define RNOMINAL 1000.0
//#define buzzer 7 //buzzer pin
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x3F for a 16 chars and 2 line display
void setup() {
Serial.begin(115200);
Serial.println("Adafruit MAX31865 PT100 Sensor Test!");
lcd.init();
lcd.clear();
lcd.backlight(); // Make sure backlight is on
thermo.begin(MAX31865_3WIRE); // set to 2WIRE or 4WIRE as necessary
lcd.setCursor(1,0); //Set cursor to character 1 on line 0
lcd.print("Coffee Boiler");
lcd.setCursor(2,1); //Move cursor to character 2 on line 1
lcd.print("Temperature");
//delay(3000);
lcd.clear();
lcd.setCursor(2,0); //Set cursor to character 2 on line 0
lcd.print("To Pressure");
lcd.setCursor(4,1); //Move cursor to character 2 on line 1
lcd.print("Sensor");
delay(3000);
}
void loop() {
uint16_t rtd = thermo.readRTD();
//Serial.print("RTD value: "); Serial.println(rtd);
float ratio = rtd;
ratio /= 32768;
//Serial.print("Ratio = "); Serial.println(ratio,8);
//Serial.print("Resistance = "); Serial.println(RREF*ratio,8);
Serial.print("Temperature = "); Serial.println(thermo.temperature(RNOMINAL, RREF));
delay(300);
//Serial.print("Temperature = "); Serial.println(TempReading);
//delay(3000); //delay of 10 seconds
if(thermo.temperature(RNOMINAL, RREF)<= 27){
lcd.clear();
lcd.setCursor(0,0); //Set cursor to character 2 on line 0
lcd.print("Temp= ");
lcd.print(thermo.temperature(RNOMINAL, RREF));
lcd.print((char)223);
lcd.print(" C");
lcd.setCursor(0,1);
lcd.print("Too Cold"); //display warning message
//digitalWrite(buzzer,HIGH); //turn on the buzzer
}
if(thermo.temperature(RNOMINAL, RREF)== 28){
//lcd.clear();
lcd.setCursor(0,0); //Set cursor to character 2 on line 0
lcd.print("Temp= ");
lcd.print(thermo.temperature(RNOMINAL, RREF));
lcd.print((char)223);
lcd.print(" C");
lcd.setCursor(0,1);
lcd.print("Press= ");
lcd.print("0.00"); //display warning message
lcd.print("Bar g");
//digitalWrite(buzzer,HIGH); //turn on the buzzer
}
if(thermo.temperature(RNOMINAL, RREF)== 29){ //check if temperature>30
//lcd.clear();
lcd.setCursor(0,0); //Set cursor to character 2 on line 0
lcd.print("Temp= ");
lcd.print(thermo.temperature(RNOMINAL, RREF));
lcd.print((char)223);
lcd.print(" C");
lcd.setCursor(0,1);
lcd.print("Press= ");
lcd.print("1.00"); //display warning message
lcd.print("Bar g");
//digitalWrite(buzzer,HIGH); //turn on the buzzer
}
// Check and print any faults
uint8_t fault = thermo.readFault();
if (fault) {
Serial.print("Fault 0x"); Serial.println(fault, HEX);
if (fault & MAX31865_FAULT_HIGHTHRESH) {
Serial.println("RTD High Threshold");
lcd.clear();
lcd.setCursor(0,0); //Move cursor to character 2 on line 1
lcd.print("RTD High Threshold");
}
if (fault & MAX31865_FAULT_LOWTHRESH) {
Serial.println("RTD Low Threshold");
lcd.clear();
lcd.setCursor(0,0); //Move cursor to character 2 on line 1
lcd.print("RTD Low Threshold");
}
if (fault & MAX31865_FAULT_REFINLOW) {
Serial.println("REFIN- > 0.85 x Bias");
lcd.clear();
lcd.setCursor(0,0); //Move cursor to character 2 on line 1
lcd.print("RTD Low Threshold");
}
if (fault & MAX31865_FAULT_REFINHIGH) {
Serial.println("REFIN- < 0.85 x Bias - FORCE- open");
lcd.clear();
lcd.setCursor(0,0); //Move cursor to character 2 on line 1
lcd.print("REFIN- < 0.85 x Bias - FORCE- open");
}
if (fault & MAX31865_FAULT_RTDINLOW) {
Serial.println("RTDIN- < 0.85 x Bias - FORCE- open");
lcd.clear();
lcd.setCursor(0,0); //Move cursor to character 2 on line 1
lcd.print("RTDIN- < 0.85 x Bias - FORCE- open");
}
if (fault & MAX31865_FAULT_OVUV) {
Serial.println("Under/Over voltage");
lcd.clear();
lcd.setCursor(0,0); //Move cursor to character 2 on line 1
lcd.print("Under/Over voltage");
}
thermo.clearFault();
}
Serial.println();
delay(2000);
}