Page 1 of 1

Pt100 rtd sensor with Max3165 and nodemcu givin random value

PostPosted: Mon Jan 07, 2019 9:02 am
by sharadregoti15
the sensor gives proper values when in use arduino uno.
but using nodemcu it gives 1 correct result then 3 incorrect values
This is the code i have used

i have connected jumper wire for 3 wire rtd sensor on max31865


max31865 nodemcu
vin 3.3
gnd gnd
3v3 nc
clk d5
sdo d6
sdi d7
cs d8
drdy nc
Code: Select all#include <SPI.h>

  This is a library for the Adafruit PT100/P1000 RTD Sensor w/MAX31865

  Designed specifically to work with the Adafruit RTD Sensor
  ----> https://www.adafruit.com/products/3328

  This sensor uses SPI to communicate, 4 pins are required to
  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.
  BSD license, all text above must be included in any redistribution

#include <Adafruit_MAX31865.h>

// Use software SPI: CS, DI, DO, CLK
Adafruit_MAX31865 max1 = Adafruit_MAX31865(15, 13, 12, 14);
// use hardware SPI, just pass in the CS pin
//Adafruit_MAX31865 max1 = Adafruit_MAX31865(10);

// The value of the Rref resistor. Use 430.0 for PT100 and 4300.0 for PT1000
#define RREF      430.0
// The 'nominal' 0-degrees-C resistance of the sensor
// 100.0 for PT100, 1000.0 for PT1000
#define RNOMINAL  100.0

void setup() {
  Serial.println("Adafruit MAX31865 PT100 Sensor Test!");
  SPI.begin();  /* begin SPI */
  max1.begin(MAX31865_3WIRE);  // set to 2WIRE or 4WIRE as necessary

void loop() {
  uint16_t rtd = max1.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(max1.temperature(RNOMINAL, RREF));

  // Check and print any faults
  uint8_t fault = max1.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");

Re: Pt100 rtd sensor with Max3165 and nodemcu givin random v

PostPosted: Thu Feb 21, 2019 2:33 pm
by ghuseby

Try to change the CS pin to another. Instead of using pin 15 (D8), try anoter, ie: 4 (D2) or 2 (D4). I think that will get you out. With the pin selection you have for the other pins, the hardware SPI will also work for the ESP8266.


Re: Pt100 rtd sensor with Max3165 and nodemcu givin random v

PostPosted: Sun May 12, 2019 2:06 pm
by Robothaler
Hi sharadregoti15,

did this solve your Problems?

Could you please share your Code?
I´m trying to find a working solution to connect 2 PT1000 Sensors via MAX31865-Shields.


Re: Pt100 rtd sensor with Max3165 and nodemcu givin random v

PostPosted: Wed May 18, 2022 3:11 am
by Lucki1000
Hi guys!

(sorry for not presenting, but not the time at this moment :mrgreen: )

I had exactly the same issue with the strict same wiring (lol). Moving CS from D8 to D2 solved it! I think we both used a deprecated definition for pinout without RX2/TX2

Thanks for the help!