Max 31855 Reading High Temperatures

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
heypete
 
Posts: 32
Joined: Sat Jan 11, 2014 4:50 pm

Re: Max 31855 Reading High Temperatures

Post by heypete »

Declan wrote:heypete,
Thanks for your reply - I have looked at our code and it looks awesome.
However,

Code: Select all

Additionally, you would need to change several aspects of the calculations:
is way over my head...

I would be more than happy to be the guinea pig as I would learn loads and hopefully others would be able to benefit.
Ok, here's an updated version for type-J thermocouples. (Note: that's a link to the source in a specific commit. If you, the reader, are looking at this thread in the future, be sure to check later comments for a more up-to-date version, if applicable.)

I appreciate your willingness to be a guinea pig. :)

User avatar
heypete
 
Posts: 32
Joined: Sat Jan 11, 2014 4:50 pm

Re: Max 31855 Reading High Temperatures

Post by heypete »

Declan wrote:Sorry, I forgot to mention that I am only reading positive temperatures in the range 0 - 400 C
No problem: the code will use the measured temperature to select the correct coefficients to calculate the corrected temperature.

User avatar
Declan
 
Posts: 11
Joined: Mon Aug 17, 2015 4:48 am

Re: Max 31855 Reading High Temperatures

Post by Declan »

I have uploaded your j-type sketch and I still have a substantial error in the temperature reading.
Actual ambient temp is 23.5C
Serial Monitor:

Code: Select all

Corrected Temp = 32.55331

Corrected Temp = 32.28194

Corrected Temp = 32.28194

Corrected Temp = 32.83142

Corrected Temp = 32.55331

Corrected Temp = 32.28194

Corrected Temp = 32.56010

Corrected Temp = 32.56010

User avatar
heypete
 
Posts: 32
Joined: Sat Jan 11, 2014 4:50 pm

Re: Max 31855 Reading High Temperatures

Post by heypete »

Declan wrote:I have uploaded your j-type sketch and I still have a substantial error in the temperature reading.
Actual ambient temp is 23.5C
Serial Monitor:

Code: Select all

Corrected Temp = 32.55331

Corrected Temp = 32.28194

Corrected Temp = 32.28194

Corrected Temp = 32.83142

Corrected Temp = 32.55331

Corrected Temp = 32.28194

Corrected Temp = 32.56010

Corrected Temp = 32.56010
Interesting, thanks.

How are you measuring the ambient temperature?

Can you connect the same thermocouple you're using with the MAX31855 to a different thermometer and see if the readings differ?

User avatar
Declan
 
Posts: 11
Joined: Mon Aug 17, 2015 4:48 am

Re: Max 31855 Reading High Temperatures

Post by Declan »

I am measuring the ambient temp with a Gefran temperature controller and a j-type tc.
If I connect the j-type tc from the arduino to the Gefran temperature controller, I get true ambient temp.

User avatar
heypete
 
Posts: 32
Joined: Sat Jan 11, 2014 4:50 pm

Re: Max 31855 Reading High Temperatures

Post by heypete »

Declan wrote:I am measuring the ambient temp with a Gefran temperature controller and a j-type tc.
If I connect the j-type tc from the arduino to the Gefran temperature controller, I get true ambient temp.
Ok. Sounds good.

Can you try with this code? The only changes are to output the raw and internal temperatures in addition to the corrected temperatures. It'll help me figure out what's going on.

Also, can you try testing the Arduino code at higher-than-room temperatures and comparing the results between the MAX31855 and the Gefran controller?

User avatar
Declan
 
Posts: 11
Joined: Mon Aug 17, 2015 4:48 am

Re: Max 31855 Reading High Temperatures

Post by Declan »

Great, I will get hold of a small oven and then do the tests at higher temps.
I will only have access to this later.

Here is the output of the latest code:

Code: Select all

Corrected Temp = 32.05812
Raw Temp = 32.50000
Internal temp = 36.18750

Corrected Temp = 32.04450
Raw Temp = 32.50000
Internal temp = 36.31250

Corrected Temp = 32.03089
Raw Temp = 32.50000
Internal temp = 36.43750

Corrected Temp = 32.30231
Raw Temp = 32.75000
Internal temp = 36.50000

Corrected Temp = 32.01729
Raw Temp = 32.50000
Internal temp = 36.56250

Corrected Temp = 32.28872
Raw Temp = 32.75000
Internal temp = 36.62500

Corrected Temp = 32.56010
Raw Temp = 33.00000
Internal temp = 36.68750

Corrected Temp = 32.28872
Raw Temp = 32.75000
Internal temp = 36.62500

Corrected Temp = 32.28194
Raw Temp = 32.75000
Internal temp = 36.68750

Corrected Temp = 32.56689
Raw Temp = 33.00000
Internal temp = 36.62500

Corrected Temp = 32.28872
Raw Temp = 32.75000
Internal temp = 36.62500

Corrected Temp = 32.28872
Raw Temp = 32.75000
Internal temp = 36.62500

Corrected Temp = 32.56689
Raw Temp = 33.00000
Internal temp = 36.62500

Corrected Temp = 32.28194
Raw Temp = 32.75000
Internal temp = 36.68750

Corrected Temp = 32.28194
Raw Temp = 32.75000
Internal temp = 36.68750

Corrected Temp = 32.28194
Raw Temp = 32.75000
Internal temp = 36.68750

Corrected Temp = 32.55331
Raw Temp = 33.00000
Internal temp = 36.75000

Corrected Temp = 32.55331
Raw Temp = 33.00000
Internal temp = 36.75000

Corrected Temp = 32.56689
Raw Temp = 33.00000
Internal temp = 36.62500

Corrected Temp = 32.28194
Raw Temp = 32.75000
Internal temp = 36.68750

Corrected Temp = 32.28194
Raw Temp = 32.75000
Internal temp = 36.68750

Corrected Temp = 32.56689
Raw Temp = 33.00000
Internal temp = 36.62500
I really appreciate your assitance

User avatar
heypete
 
Posts: 32
Joined: Sat Jan 11, 2014 4:50 pm

Re: Max 31855 Reading High Temperatures

Post by heypete »

Declan wrote:Great, I will get hold of a small oven and then do the tests at higher temps.
I will only have access to this later.
Sounds good.
Here is the output of the latest code:

Code: Select all

Corrected Temp = 32.05812
Raw Temp = 32.50000
Internal temp = 36.18750

Corrected Temp = 32.04450
Raw Temp = 32.50000
Internal temp = 36.31250

Corrected Temp = 32.03089
Raw Temp = 32.50000
Internal temp = 36.43750

Corrected Temp = 32.30231
Raw Temp = 32.75000
Internal temp = 36.50000

Corrected Temp = 32.01729
Raw Temp = 32.50000
Internal temp = 36.56250

Corrected Temp = 32.28872
Raw Temp = 32.75000
Internal temp = 36.62500

Corrected Temp = 32.56010
Raw Temp = 33.00000
Internal temp = 36.68750

Corrected Temp = 32.28872
Raw Temp = 32.75000
Internal temp = 36.62500

Corrected Temp = 32.28194
Raw Temp = 32.75000
Internal temp = 36.68750

Corrected Temp = 32.56689
Raw Temp = 33.00000
Internal temp = 36.62500

Corrected Temp = 32.28872
Raw Temp = 32.75000
Internal temp = 36.62500

Corrected Temp = 32.28872
Raw Temp = 32.75000
Internal temp = 36.62500

Corrected Temp = 32.56689
Raw Temp = 33.00000
Internal temp = 36.62500

Corrected Temp = 32.28194
Raw Temp = 32.75000
Internal temp = 36.68750

Corrected Temp = 32.28194
Raw Temp = 32.75000
Internal temp = 36.68750

Corrected Temp = 32.28194
Raw Temp = 32.75000
Internal temp = 36.68750

Corrected Temp = 32.55331
Raw Temp = 33.00000
Internal temp = 36.75000

Corrected Temp = 32.55331
Raw Temp = 33.00000
Internal temp = 36.75000

Corrected Temp = 32.56689
Raw Temp = 33.00000
Internal temp = 36.62500

Corrected Temp = 32.28194
Raw Temp = 32.75000
Internal temp = 36.68750

Corrected Temp = 32.28194
Raw Temp = 32.75000
Internal temp = 36.68750

Corrected Temp = 32.56689
Raw Temp = 33.00000
Internal temp = 36.62500
I manually did the calculations using the last data point you mentioned (corrected temp = 32.56689) and the NIST formulas and my calculations in Excel match those output by the Arduino.

The internal temperature of the MAX31855 is, while well within specs, seems a bit high for typical rooms: is the room where you're performing the measurements particularly warm? The chip measures the temperature internally and my code uses the Adafruit library function to get that temperature. Assuming the MAX31855 is measuring the internal temperature correctly, the code should use that temperature correctly.

If the internal temperature seems unreasonably warm for the environment where the chip is located, the issue may be with the chip itself: can you try replacing it with a different MAX31855J?
I really appreciate your assitance
Glad to help!

User avatar
Declan
 
Posts: 11
Joined: Mon Aug 17, 2015 4:48 am

Re: Max 31855 Reading High Temperatures

Post by Declan »

I will replace the MAX device - will be maybe a couple of hours before I am able to get to that.
The room temperature is 24.0C (measured with the Gefran TC and also a digital thermometer - both show 24.0C
Once I have replaced the MAX device, I will upload the sketch and send you the output.

User avatar
Declan
 
Posts: 11
Joined: Mon Aug 17, 2015 4:48 am

Re: Max 31855 Reading High Temperatures

Post by Declan »

Aaaaaaaagh - just discovered my MAX device is running at 4.07V - dodgy LDO.
This could possibly be the source of the error - excessive internal temp?

How do we read the fault codes of the MAX31855?

User avatar
heypete
 
Posts: 32
Joined: Sat Jan 11, 2014 4:50 pm

Re: Max 31855 Reading High Temperatures

Post by heypete »

Declan wrote:Aaaaaaaagh - just discovered my MAX device is running at 4.07V - dodgy LDO.
This could possibly be the source of the error - excessive internal temp?
According to the datasheet the absolute maximum voltage it can withstand is 4.0V. It's possible that the chip has been permanently damaged.
How do we read the fault codes of the MAX31855?
According to page 10 of the datasheet the fault bits are the three least-significant bits (D0, D1, and D2) but they only tell if you the thermocouple is not connected, connected to ground, and connected to VCC, respectively. There's no other fault-related information communicated by the chip.

User avatar
Declan
 
Posts: 11
Joined: Mon Aug 17, 2015 4:48 am

Re: Max 31855 Reading High Temperatures

Post by Declan »

I have now replaced the MAX31855J device and also the dodgy LDO on the UNO.
I have 3V3 going to the MAX PCB.
I still have the same error in temperature readings as before

User avatar
heypete
 
Posts: 32
Joined: Sat Jan 11, 2014 4:50 pm

Re: Max 31855 Reading High Temperatures

Post by heypete »

Declan wrote:I have now replaced the MAX31855J device and also the dodgy LDO on the UNO.
I have 3V3 going to the MAX PCB.
I still have the same error in temperature readings as before
Interesting. Is the reported internal temperature still higher than ambient?

Is the thermocouple connected correctly to the chip? What if you reverse the connection?

Can you try using a different thermocouple? I've had some thermocouples that have been a bit dodgy in the past.

What happens if you put a small (0.01uF to 0.1uF) capacitor across the thermocouple leads?

Is the thermocouple reasonably accurate at high temperatures compared to room temperature or is the offset constant? You might need to add an calibration offset.

I admit it's a bit tough to figure out when I don't have the hardware in front of me. Does anyone else have any ideas?

User avatar
Declan
 
Posts: 11
Joined: Mon Aug 17, 2015 4:48 am

Re: Max 31855 Reading High Temperatures

Post by Declan »

SUCCESS

I had destroyed my MAX31855 device.

Running your code, I get:

Code: Select all

Corrected Temp = 25.19125
Raw Temp = 25.50000
Internal temp = 27.81250

Corrected Temp = 25.19125
Raw Temp = 25.50000
Internal temp = 27.81250

Corrected Temp = 25.19125
Raw Temp = 25.50000
Internal temp = 27.81250

Corrected Temp = 25.19125
Raw Temp = 25.50000
Internal temp = 27.81250

Corrected Temp = 25.19125
Raw Temp = 25.50000
Internal temp = 27.81250
The Gefran controller gives me 25.191C
Many thanks for all your assistance.

Now, for the next challenge - how do I read the fault TC Open, TC to VCC, TC to GND
Eish, life and our challenges - makes it worth living.

User avatar
heypete
 
Posts: 32
Joined: Sat Jan 11, 2014 4:50 pm

Re: Max 31855 Reading High Temperatures

Post by heypete »

Declan wrote:SUCCESS

I had destroyed my MAX31855 device.
D'oh. That's no fun. At least you figured out the problem and MAX31855s aren't terribly expensive.
Running your code, I get:

Code: Select all

Corrected Temp = 25.19125
Raw Temp = 25.50000
Internal temp = 27.81250

Corrected Temp = 25.19125
Raw Temp = 25.50000
Internal temp = 27.81250

Corrected Temp = 25.19125
Raw Temp = 25.50000
Internal temp = 27.81250

Corrected Temp = 25.19125
Raw Temp = 25.50000
Internal temp = 27.81250

Corrected Temp = 25.19125
Raw Temp = 25.50000
Internal temp = 27.81250
The Gefran controller gives me 25.191C
Outstanding!
Many thanks for all your assistance.
My pleasure. Glad to be of assistance.

I hope the code is reasonably self-explanatory and can be easily adapted to your needs.
Now, for the next challenge - how do I read the fault TC Open, TC to VCC, TC to GND
I'm not 100% sure. My code just follows Adafruit's example code and prints an error if there's any fault (if there's a fault, rawTemp = NAN, so it's easy to detect). I didn't care particularly about identifying any specific fault condition.

The Adafruit MAX31855 library (Adafruit_MAX31855.cpp, line 91 on my system) checks for errors in the "double Adafruit_MAX31855::readCelsius(void)" function thusly:

Code: Select all

  if (v & 0x7) {
    // uh oh, a serious problem!
    return NAN; 
  }
"v" is the string of 32 bits read out from the MAX31855. It does a bitwise AND check (&) against the three fault bits. If any of them are 1, it returns NAN as the temperature to indicate a fault.

You could easily split that into three checks, one for each condition:

Code: Select all

  if (v & 0x1) {
    // TC is open
    return 10000; 
  } else if (v & 0x2) {
    // TC is shorted to ground
    return 20000; 
  } else if (v & 0x4) {
    // TC is shorted to VCC
    return 30000; 
  }
In this example I return impossibly high temperatures to indicate an error condition: for open circuit, it returns 10000, for grounded it returns 20000, for shorted to VCC it returns 30000. You'd need to have your code check for such raw temperatures to detect the error before proceeding.

There's probably other ways to do such checks that are more elegant and "done right", particularly if you intend to use it in some sort of non-hobbyist control system where failure would result in Bad Things(tm). This idea was just a quick, untested hack that occurred to me. I won't be liable if you blow up whatever it is that you're working with. :)

Good luck!

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”