Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fault check cycle modes #40

Merged
merged 2 commits into from
Oct 24, 2022
Merged

Conversation

caternuson
Copy link
Contributor

For #5 and #27.

The datasheet makes it pretty clear that a fault detection cycle must be initiated to actually check for certain faults. This was totally missing from the library. And there are a few options for how to run the cycle. Enums added for the options with default being auto. It's not super clear how the manual option should be run in user code, there's like two steps. But enums for those are included as well. Can also choose none, since the auto cycle is slightly blocking.

Also not seeing anything in datasheet to indicate this comment for #27. So, for now, nothing new added to ::begin().

According to the MAX31865 data sheet (page 14) a manual or automatic fault detection cycle must be run at startup.
Without that the startup of the MAX31865 behaves arbitrarily and can prevent data reading,

Here's test sketch:

#include <Adafruit_MAX31865.h>

#define RREF      430.0
#define RNOMINAL  100.0

Adafruit_MAX31865 thermo = Adafruit_MAX31865(10);

void setup() {
  Serial.begin(9600);
  while (!Serial);
  Serial.println("MAX31865 Fault Test.");
  
  thermo.begin(MAX31865_3WIRE); 
}

void loop() {
  // 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();
  }
}

and running with one of the RTD wires disconnected:
Screenshot from 2022-06-29 16-12-23

@caternuson caternuson requested a review from a team June 29, 2022 23:40
@caternuson
Copy link
Contributor Author

@ladyada for review

@caternuson caternuson merged commit 0e08be5 into adafruit:master Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants