MAX31855 giving NaN after some readings In my current project I am measuring temperature using K-type thermocouple and MAX31855 breakout board and Arduino uno.

I have used Adafruit-max31855 library and example code from that library. But monitoring on serial monitor after some reading it is giving NaN.

Here is the code I have used:

#include "Adafruit_MAX31855.h"

int thermoDO = 5;
int thermoCS = 6;
int thermoCLK = 7;

Adafruit_MAX31855 thermocouple(thermoCLK, thermoCS, thermoDO);

void setup() {
  Serial.begin(9600);

  Serial.println("MAX31855 test");
  // wait for MAX chip to stabilize
  delay(500);
}

void loop() {
  // basic readout test, just print the current temp
   Serial.print("Internal Temp = ");
   Serial.println(thermocouple.readInternal());

   double c = thermocouple.readCelsius();
   if (isnan(c)) {
     Serial.println("Something wrong with thermocouple!");
   } else {
     Serial.print("C = "); 
     Serial.println(c);
   }
   //Serial.print("F = ");
   //Serial.println(thermocouple.readFarenheit());

   delay(1000);
}


Circuit Diagram:



Output:



What could be the possible error for this and how can I solve this?
Try to Serial.println(thermocouple.readError()). It will give you an
error code, which is a bit field:


1 = open circuit
2 = short to ground
4 = short to Vcc


C.f. the
datasheet.