Using three MAX31865 boards to measure three different RTDs. Have them all hooked up on the same SPI bus. If I call them individually all three work flawlessly. When I try to put them all together on the first one I initialize works!
In code below. If I comment out them individually they each work. But as shown, only the RTD board on Chip Select pin 8 works
In code below. If I comment out them individually they each work. But as shown, only the RTD board on Chip Select pin 8 works
Code:
#include <Adafruit_MAX31865.h>
// Use software SPI: CS, DI, DO, CLK
//Adafruit_MAX31865 thermo = Adafruit_MAX31865(8, 11, 12, 13);
// use hardware SPI, just pass in the CS pin
Adafruit_MAX31865 thermo = Adafruit_MAX31865(8);
Adafruit_MAX31865 thermo2 = Adafruit_MAX31865(9);
Adafruit_MAX31865 thermo3 = 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
void setup() {
Serial.begin(115200);
Serial.println("Adafruit MAX31865 PT100 Sensor Test!");
// thermo.begin(MAX31865_4WIRE); // set to 2WIRE or 4WIRE as necessary
thermo2.begin(MAX31865_4WIRE); // set to 2WIRE or 4WIRE as necessary
thermo3.begin(MAX31865_4WIRE); // set to 2WIRE or 4WIRE as necessary
thermo.begin(MAX31865_4WIRE); // set to 2WIRE or 4WIRE as necessary
}
void loop() {
uint16_t rtd_debug1 = thermo.readRTD();
float ratio1 = rtd_debug1;
ratio1 /= 32768;
uint16_t rtd_debug2 = thermo2.readRTD();
float ratio2 = rtd_debug2;
ratio2 /= 32768;
uint16_t rtd_debug3 = thermo3.readRTD();
float ratio3 = rtd_debug3;
ratio3 /= 32768;
Serial.println("Res1 Res2 Res3");
Serial.print(RREF*ratio1,2); Serial.print(" "); Serial.print(RREF*ratio2,2); Serial.print(" "); Serial.println(RREF*ratio3,2);
Serial.println("Temp1 Temp2 Temp3");
Serial.print(thermo.temperature(RNOMINAL, RREF)); Serial.print(" "); Serial.print(thermo2.temperature(RNOMINAL, RREF)); Serial.print(" "); Serial.println(thermo3.temperature(RNOMINAL, RREF));
// 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");
}
if (fault & MAX31865_FAULT_LOWTHRESH) {
Serial.println("RTD Low Threshold");
}
if (fault & MAX31865_FAULT_REFINLOW) {
Serial.println("REFIN- > 0.85 x Bias");
}
if (fault & MAX31865_FAULT_REFINHIGH) {
Serial.println("REFIN- < 0.85 x Bias - FORCE- open");
}
if (fault & MAX31865_FAULT_RTDINLOW) {
Serial.println("RTDIN- < 0.85 x Bias - FORCE- open");
}
if (fault & MAX31865_FAULT_OVUV) {
Serial.println("Under/Over voltage");
}
thermo.clearFault();
}
Serial.println();
delay(1000);
}