Thermocouple readings are nan

Hi,

I followed this guide on Adafruit (Arduino Code | MAX31855 Thermocouple | Adafruit Learning System) to wire my thermocouple amp and thermocouple to an Arduino Uno Wifi Rev 2. I have attached a picture of the wiring. I am using Exergen's Micro UIRT/C Series of Self Powered K Type Infrared Thermocouple, which comes with a Red wire, Yellow wire and what looks like a wire drain (I did not connect this to anything - see picture attached).

I am getting the following readings from the Serial Monitor:

17:40:37.336 -> Internal Temp = 22.81
17:40:37.336 -> Something wrong with thermocouple!
17:40:38.336 -> Internal Temp = 22.87
17:40:38.336 -> Something wrong with thermocouple!
17:40:39.320 -> Internal Temp = 22.87
17:40:39.355 -> Something wrong with thermocouple!
17:40:40.344 -> Internal Temp = 22.81
17:40:40.344 -> Something wrong with thermocouple!
17:40:41.328 -> Internal Temp = 22.81
17:40:41.365 -> Something wrong with thermocouple!
17:40:42.363 -> Internal Temp = 22.87
17:40:42.363 -> Something wrong with thermocouple!
17:40:43.349 -> Internal Temp = 22.87
17:40:43.382 -> Something wrong with thermocouple!

(I'm not sure what the internal temperature means exactly)

Here is my code:

/***************************************************
  This is an example for the Adafruit Thermocouple Sensor w/MAX31855K

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

  These displays use SPI to communicate, 3 pins are required to
  interface
  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 <SPI.h>
#include "Adafruit_MAX31855.h"

// Default connection is using software SPI, but comment and uncomment one of
// the two examples below to switch between software SPI and hardware SPI:

// Example creating a thermocouple instance with software SPI on any three
// digital IO pins.
#define MAXDO   3
#define MAXCS   4
#define MAXCLK  5

// initialize the Thermocouple
Adafruit_MAX31855 thermocouple(MAXCLK, MAXCS, MAXDO);

// Example creating a thermocouple instance with hardware SPI
// on a given CS pin.
//#define MAXCS   10
//Adafruit_MAX31855 thermocouple(MAXCS);

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

  while (!Serial) delay(1); // wait for Serial on Leonardo/Zero, etc

  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.readFahrenheit());

   delay(1000);
}

These are my connections (I followed the Adafruit tutorial linked above):
VIN on thermocouple to 5V on the UNo
GND on thermocouple to GND on the UNo
DO on thermocouple to Pin 3 on the UNo
CS on thermocouple to Pin 4 on the UNo
CLK on thermocouple to Pin 5 on the UNo

It seems that the readings it is getting is "not a number" as "nan" suggests, but I don't know what to do resolve this. Any help is appreciated!!

The MAX31855 is telling you that the connections to the thermocouple are wrong.

Consult the chip data sheet for the details on the proper connections, but I suspect that the problem is the totally nonstandard "thermocouple" sensor that you are trying to connect to it.

This is what you should be using:

The spec for the sensor says impedance 17-45 kOhm which is way higher than a normal two wire thermocouple so the chip probably thinks it's disconnected and hence the error.

Unfortunately the datasheet doesn't tell you what resistance threshold is used for the open circuit detection algorithm so you'll need to contact Maxim. Alternatively search for a thermocouple chip that allows the open circuit resistance threshold to be configured, or ignored entirely.

I guess the problem relates to this comment in the data sheet: "As a result, when the Exergen IRT/C is wired into a conventional t/c input device, the target temperature (Tt) displayed will be the same as the surface (Ts).".

You are NOT using a conventional t/c input device. That might be a Fluke DVM, or a device made specifically for thermocouples.

Paul

Thank you all for your replies!

@mikb55 I tried adding some 10nF capacitors in series with the t/c wires, but to no avail.

Could I please get some suggestions on a couple K-type NON-CONTACT thermocouples that will work easily with the MAX31855 and have ideally less than +/-1°C uncertainty.

Thanks!

mikb55 clearly explained why those sensors will not work with the Max chip.

Either use a genuine thermocouple (at 1/100 the cost) or a noncontact temperature sensor with a more sensible type of output.

Thanks, any specific suggestions on which ones will work for from anyone who has experience with any?

There is a better library for MAX31855 - GitHub - enjoyneering/MAX31855: Arduino library for 14-bit MAX31855 K-thermocouple to digital converter

It will tell you the following things:

  • MAX31855_THERMOCOUPLE_OK
  • MAX31855_THERMOCOUPLE_SHORT_TO_VCC
  • MAX31855_THERMOCOUPLE_SHORT_TO_GND
  • MAX31855_THERMOCOUPLE_NOT_CONNECTED
  • MAX31855_THERMOCOUPLE_UNKNOWN

Not all MAX31855 from China will work due to PCB error, see topic