MAX31855 thermocouple read-out, nan at high T

Hi everybody,

I’m new to the community and just started using the Arduino to monitor a high-temperature - high-pressure system in out lab in the University (up to 950 °C / 1 kbar ). I’m doing my PhD in Volcanology, performing many experiments which I’m trying to monitor reliably.

For this purpose I have hooked up an Arduino nano with two Adafruit MAX31855 break-out boards. Each board has got its own three dedicated pins. We’re using high quality K-type thermocouples from Omega which work really well with handheld thermocouple-readers. We used these with great success up to temperatures above 1000 °C.

In addition to the temperatures I’m also using one analog input to read the analog voltage coming from an Omega pressure sensor amplifier. It gives 0 - 10 V so I’ve included a 10k/10k voltage divider to half the voltages. The pressure read-out is working nicely and gives the same results as our other barometers.

When I tested the system lately everything seemed to work pretty well, the temperatures were quite accurate and were printed to the serial monitor reliably. But I recognised that at higher temperatures, say above 800 °C mainly one of the thermocouples would produce many “nan” values. Sometimes three measurements in a row would be an actual temperature, but then again 10 nans. I read the temperature every 2 minutes but changing the interval didn’t change anything.
Interestingly, the nans were only printed from one of the thermocouple-boards, so I tried swapping the couples around, but it still was the same board producing the nans.

I tried running the readError command but got varying results, even showing numbers that are not explained in the datasheet.

The thermocouples are not in contact with ground.

However, here is the code I used to read the temperatures during a 6 day period:

#include <SPI.h>
#include <Adafruit_MAX31855.h>

#define tcDO1    5
#define tcCS1    6
#define tcCLK1   7
#define tcDO2    8
#define tcCS2    9
#define tcCLK2   10


Adafruit_MAX31855 couple1(tcCLK1, tcCS1, tcDO1);
Adafruit_MAX31855 couple2(tcCLK2, tcCS2, tcDO2);

int P_pin = A0;
int P_value = 0;
int P = 0;


void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  analogReference(DEFAULT);
  delay(1000);

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

int x = 0;
void loop() {
  // put your main code here, to run repeatedly:

  

  P_value = analogRead(P_pin);
  P = (2068/1023)*P_value;
 // Serial.print("T(int) =    ");
 // Serial.print(couple1.readInternal());
  Serial.print(x);
  Serial.print("    T_1 =     ");
  Serial.print(couple1.readCelsius());
  Serial.print("    T_2 =     ");
  Serial.print(couple2.readCelsius());
  Serial.print("    P =     ");
  Serial.println(P);
  //Serial.println(couple2.readError());
  x++;


delay(120000);

//T1_value = analogRead(T1_pin);


}

And here’s a typical example of what the output in the Serial monitor looked like (instead of “#N/A” the actual value was “nan”, but I changed it in Excel):

1465 T_1 = #N/A T_2 = 947 P = 1002
1466 T_1 = #N/A T_2 = 947 P = 1002
1467 T_1 = #N/A T_2 = 947 P = 1002
1468 T_1 = #N/A T_2 = 946.75 P = 1002
1469 T_1 = #N/A T_2 = 947 P = 1002
1470 T_1 = #N/A T_2 = 946 P = 1000
1471 T_1 = #N/A T_2 = 947.25 P = 1004
1472 T_1 = #N/A T_2 = 946.25 P = 1000
1473 T_1 = 938.25 T_2 = 946.75 P = 1004
1474 T_1 = #N/A T_2 = 946.5 P = 1002
1475 T_1 = #N/A T_2 = 946.25 P = 1002
1476 T_1 = #N/A T_2 = 947.25 P = 1002
1477 T_1 = #N/A T_2 = 947 P = 1000
1478 T_1 = 938 T_2 = 946.25 P = 1004
1479 T_1 = 937 T_2 = 946 P = 1002
1480 T_1 = #N/A T_2 = 947.5 P = 1002
1481 T_1 = #N/A T_2 = 946.75 P = 1000
1482 T_1 = #N/A T_2 = 946.5 P = 1002
1483 T_1 = #N/A T_2 = 947.5 P = 1002
1484 T_1 = 939.25 T_2 = #N/A P = 1000
1485 T_1 = #N/A T_2 = 946.25 P = 1002

I also tried to hook everything up so that two of the three pins of the boards are shared, but this didn’t help either.

Okay, that’s it. I’d be really happy if somebody would have an idea of what I could try to get this thing running reliably. Or is it just that I can’t expect such a simple system to work reliably at those hot conditions?

Ah, the thermocouples are attached with a special thermocouple-wire to each board. The wire on T1 is about 1m , the wire on T2 is about 40cm.
I tried inserting a cap (47n, didn’t have a 10n on hand) across the couple-terminals, without success.

Ah, the thermocouples are attached with a special thermocouple-wire to each board. The wire on T1 is about 1m , the wire on T2 is about 40cm. I tried inserting a cap (47n, didn't have a 10n on hand) across the couple-terminals, without success.

How long are the wires from the Arduino to the MAX31855 boards?

NaN is returned only if the hardware reported a serious error (thermocouple shorted go GND, to Vcc or not connected at all). If you're sure that your thermocouple wiring is OK, I guess your problems are on the communication side. As the interface is SPI the bus length must not exceed about 0.5m, everything above that might end in transmission errors which you might see.

pylon: How long are the wires from the Arduino to the MAX31855 boards? [...]

The wires between the boards are around 8cm each, so they should be fine. The USB cable I'm using is longer, maybe 1m. I'm pretty sure the thermocouple wiring is correct because I didn't get as many nans at lower temperatures.

I might do another test today to confirm that everything works right at low temperatures.

Okay, I recorded some T-values today using the exact same code and setup. The thermocouples are just lying around in the the lab so the values are always room temperature. Here's what I got:

136 T_1 = 23.75 T_2 = 23.00 P = 0 137 T_1 = 23.75 T_2 = 22.75 P = 0 138 T_1 = 23.75 T_2 = 23.00 P = 0 139 T_1 = 23.75 T_2 = 22.75 P = 0 140 T_1 = 23.75 T_2 = 22.75 P = 0 141 T_1 = 23.75 T_2 = 23.00 P = 0 142 T_1 = 23.75 T_2 = 23.00 P = 0 143 T_1 = 23.75 T_2 = 23.00 P = 516 144 T_1 = 23.75 T_2 = 23.00 P = 492 145 T_1 = 23.75 T_2 = 23.00 P = 0 146 T_1 = 23.75 T_2 = 23.00 P = 0 147 T_1 = 23.75 T_2 = 23.00 P = 0 148 T_1 = 24.00 T_2 = 23.00 P = 0 149 T_1 = 23.75 T_2 = 23.00 P = 0 150 T_1 = 23.75 T_2 = 23.00 P = 0 151 T_1 = 24.00 T_2 = 23.00 P = 0

(Did a pressure test on the fly)

So, no nans at all. That's why I'm pretty sure, that the setup itself is okay. Any other ideas? Is it just that the Adafruit break-out board is not as reliable?

Thanks!

check this library - Arduino library for 14-bit MAX31855 K-thermocouple to digital converter

I tried running the readError command but got varying results, even showing numbers that are not explained in the datasheet.

If you're using the Adafruit library this is not possible. What errors did you get (only the NaN case is interesting)?

pylon: If you're using the Adafruit library this is not possible. What errors did you get (only the NaN case is interesting)?

I'm using the adafruit library which I installed from the Arduino IDE library manager. I will have to wait until I run another high-T experiment to check the error messages but I will report back then. I might also check out the library suggested by enjoyneering, but the board I'm using looks a bit different than those mentioned in that topic.

iefes: ....but the board I'm using looks a bit different than those mentioned in that topic.

It doesn't meter, as long as you connect the SPI pins right.

Hi everybody, sorry for replying to this relatively old topic but unfortunately after writing my issues here I got distracted by other work and have only lately come back to the subject. I have in the meantime installed the enjoyneering library which seemed to work first for temperatures up to ~900°C but today I started an experiment running at 1000°C and I got many errors again. The errors are all over the place from "short to GND" to short to VCC" and to "2000°C". However, shorts to Gnd or Vcc are not possible. The couple sits in an isolated corundum tube. Do you have any more ideas what to try? I mean, is the chip really able to measure these high temperatures reliably? Most of the time I'm reading only I find people working with lower temperatures without problems, but it seems that at those high temperatures the chip starts to get unstable...?

At lower temperatures up to 850 °C everything seems to work fine.

One more question regarding the enjoyneering library: Should I use the "normal" MAX31855 library or the MAX31855soft library?

Thanks a lot!

Is it still the one thermocouple that is giving you the errors? Did you try keeping the thermocouples in the same position, but swapping the interface boards with the MAX31855? I know it is a little more of a pain to swap them.

Are there any signal conditioning components on the board? I'm wondering if the part tolerances on the board that is having problems is not the same as the other one?

I hope you can get this figured out!

Thanks for your reply!

I have tested different thermocouples and also swapped the boards and tried different pins on the Arduino but it didn't help. Actually, there's no signal conditioning on the board.

I think we will buy a more convenient solution for our lab. I've checked out the Arduino shields sold by Playing with Fusion and they seem to fit the bill pretty well. Especially, if we go with the newer MAX31856 chip non-linearity at higher temperatures can be accounted for. Additionally, they have signal treating included on the board.

However, if somebody has another good suggestion I'm happy to try out more.

Thanks!