PT100 Sensor Not Reading Correctly with MAX31865 - Need Help!

Hello everyone,

I’m currently working on a project using an ESP32 microcontroller, a PT100 temperature sensor, and a MAX31865 temperature-to-digital converter. However, I'm experiencing an issue where the temperature readings remain consistently at 0°C.

Hardware Setup:

  • Microcontroller: ESP32 (WROOM32-D)
  • Temperature Sensor: PT100
  • ADC: MAX31865

Wiring:

The wiring appears to be correct, and I have checked the connections multiple times. The PT100 sensor is connected to the MAX31865 as per the standard 3-wire configuration. The wiring is connected to the corresponding pins on the MAX31865 and the ESP32, which I have verified are correct.

Software:

I am using the Adafruit MAX31865 library to interface with the sensor. Here is a brief overview of what I've done so far:

  1. Initial Code: I started with a basic example from the Adafruit library, which initializes the MAX31865 in 3-wire mode.
  2. Testing Outputs: When running the code, I consistently receive a reading of 0Ω for the RTD value and no change in temperature readings, even when I physically heat the PT100 sensor.

Troubleshooting Steps Taken:

  1. Check the Multimeter: I measured the resistance of the PT100 sensor using a multimeter and found a reading of 109.2Ω, which is consistent with the expected value at approximately 31°C. This suggests that the PT100 sensor itself is functioning correctly.
  2. MAX31865 Connection Verification: I double-checked the connections on the MAX31865 board and ensured that the wiring was secure and correct.
  3. Referencing Resistor: I verified that the reference resistor (Rref) on the MAX31865 is the correct value (430Ω).
  4. Library Initialization: I attempted to initialize the MAX31865 in both 2-wire and 3-wire modes within the code, but the readings remained at 0.

Request for Assistance

Despite all the above steps, I am still unable to get a valid reading from the MAX31865. Has anyone experienced similar issues or have any suggestions for further troubleshooting? Any help would be greatly appreciated!

Thank you!

#include <Adafruit_MAX31865.h>

// Pin configuration
#define MAX31865_CS 5    // Chip select pin for MAX31865
#define MAX31865_MISO 23  // Master In Slave Out pin
#define MAX31865_MOSI 19  // Master Out Slave In pin
#define MAX31865_CLK 18   // Clock pin

// Create the MAX31865 object
Adafruit_MAX31865 thermo = Adafruit_MAX31865(MAX31865_CS, MAX31865_CLK, MAX31865_MOSI, MAX31865_MISO);

void setup() {
  Serial.begin(115200);
  thermo.begin(MAX31865_3WIRE);  // Initialize MAX31865 in 3-wire mode
}

void loop() {
  uint16_t rtd = thermo.readRTD();  // Read the RTD value
  Serial.print("RTD Value: ");
  Serial.println(rtd);

  float temperature = thermo.temperature(100.0, 430.0);  // Calculate temperature (PT100, Rref = 430Ω)
  Serial.print("Temperature: ");
  Serial.print(temperature);
  Serial.println(" °C");

  delay(1000);  // Wait for a second before the next reading
}







Do you have a wiring diagram?

This looks thorough...

I already read that article. I‘ll send the Diagramm soon👍🏻

Have you tried using the hardware SPI?

Why don't you use the Adafruit example code. It checks for faults and will tell you what is wrong.
In the IDE click on Files->Examples->Adafruit MAX31865 library

Hey buddy, thanks for the reply. here is the schemetic

Hey jim-p, thanks for your reply. always a helpful hand! <3

just ran the adafruit code.

#include <Adafruit_MAX31865.h>

// Use software SPI: CS, DI, DO, CLK
Adafruit_MAX31865 thermo = Adafruit_MAX31865(5, 23, 19, 18);
// 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      430.0   //meassured: 429Ohm
// The 'nominal' 0-degrees-C resistance of the sensor
// 100.0 for PT100, 1000.0 for PT1000
#define RNOMINAL  100.0

void setup() {
  Serial.begin(115200);
  Serial.println("Adafruit MAX31865 PT100 Sensor Test!");

  thermo.begin(MAX31865_3WIRE);  // set to 2WIRE or 4WIRE as necessary
}


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));

  // 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);
}

Serial Monitor :

Adafruit MAX31865 PT100 Sensor Test!
RTD value: 0
Ratio = 0.00000000
Resistance = 0.00000000
Temperature = -242.02

RTD value: 0
Ratio = 0.00000000
Resistance = 0.00000000
Temperature = -242.02

RTD value: 0
Ratio = 0.00000000
Resistance = 0.00000000
Temperature = -242.02

I have no idea how to set it up correctly. Do you have an example? :slight_smile:

Your schematic does not show a connection to SDO (pin 5) on the MAX31865 module. Looks like it should go to IO19 of the ESP according to your setup code. If that is true, you are not getting any data back from the MAX31865.

it does. its yellow. i am sorry for using that color haha

Yeah, hard to see.

It sounds like you've already done a thorough job troubleshooting so far! Here are a few additional steps that might help you resolve the issue.

  1. Verify SPI Communication:

    • Ensure that the SPI communication between the ESP32 and MAX31865 is functioning correctly. Double-check the SPI pin connections and ensure they match the pin definitions in your code.
  2. Check Power Supply:

    • Verify that the MAX31865 is receiving a stable power supply. Fluctuations in power can cause erratic readings.
  3. Use Hardware SPI:

    • If you are using software SPI, try switching to hardware SPI for more reliable communication. Update your code to use the hardware SPI pins on the ESP32.
  4. Test with a Known Resistor:

    • Replace the PT100 sensor with a known resistor (e.g., 100Ω) to see if the MAX31865 can read the resistance correctly. This can help determine if the issue is with the sensor or the MAX31865.

Example Code with Fault Detection:

#include <Adafruit_MAX31865.h>

// Pin configuration
#define MAX31865_CS 5    // Chip select pin for MAX31865
#define MAX31865_MISO 23  // Master In Slave Out pin
#define MAX31865_MOSI 19  // Master Out Slave In pin
#define MAX31865_CLK 18   // Clock pin

// Create the MAX31865 object
Adafruit_MAX31865 thermo = Adafruit_MAX31865(MAX31865_CS, MAX31865_CLK, MAX31865_MOSI, MAX31865_MISO);

void setup() {
  Serial.begin(115200);
  thermo.begin(MAX31865_3WIRE);  // Initialize MAX31865 in 3-wire mode
}

void loop() {
  uint16_t rtd = thermo.readRTD();  // Read the RTD value
  Serial.print("RTD Value: ");
  Serial.println(rtd);

  float temperature = thermo.temperature(100.0, 430.0);  // Calculate temperature (PT100, Rref = 430Ω)
  Serial.print("Temperature: ");
  Serial.print(temperature);
  Serial.println(" °C");

  // Check for 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();
  }

  delay(1000);  // Wait for a second before the next reading
}

as u can imagine i am already through chat cpt answers my dear friend haha

I don't know anything else, ChatGPT did do a good job of spoofing my answer into a good long essay though.

sure.

  1. the wireing is correct. i double checkt every conection with an multimeter.

  2. the max31865 is connected to an 2A power supply, that gets shared with the esp and a relay module. should be more then enough.

  3. still dont know how to do that, as you can see from my post #8.

  4. Unfortunately I don't have another temp sensor here.

Too bad you're stuck with a clone. I imagine a real Adafruit module would work just fine.

that sucks! then i w'll buy a adafruit one. one with a 4300 ref haha xD

but its more like i also want to know and understand why the "clone" aint working"

I have another max31865 board here, but with an 431 href. so i would have solder the two resistors out and switch them. maybe u are right and the second board is just shit :frowning:

That is probably a good idea. You can play around with the clones after you get the system you were aiming for done.

where to buy the adafruit board? on theier website i have around 40$ shipping costs haha

amazon also not selling to my country for some reason lol