Show Posts
Pages: [1] 2
1  Using Arduino / Sensors / Re: Thermocouple problem on: August 22, 2014, 07:30:30 am
Hello Mantzas,

Another thing to check is that you are using the correct MAX31855 chip for your thermocouple. For example a MAX31855T should be used for T types, a MAX31855K for K Types etc. it may be that your thermocouple is falling out of range when its heated. The thermocouples are colour coded usually....

Good luck, let us know how you get on.

2  Using Arduino / Sensors / Re: MAX 31855 and Thermocouple Errors on: August 22, 2014, 07:25:07 am
Hello All,

Just to rekindle things here's the code I settled on to derive the voltage from the MAX 31855 chip and then re-calculate the corrected temperature using a 7th order polynomial.

It's a bit of hack and it works better than anything I've tried at these low (~150C) temperatures, but it's still not perfect.

Any suggestions  welcome...!


//Non Linear Thermocouple Compensation Coefficients
//Used to calculate actual temp from voltage from the MAX31855

// 0 to -200
const float c0=0;
const float c1=25.949192;
const float c2=-0.21316967;
const float c3=0.79018692;
const float c4=0.42527777;
const float c5=0.13304473;
const float c6=0.020241446;
const float c7=0.0012668171;
// 0 to 400
const float d0=0;
const float d1=25.928;
const float d2=-0.7602961;
const float d3=0.04637791;
const float d4=-0.002165394;
const float d5=0.00006048144;
const float d6=-0.0000007293422;
const float d7=0;

//SUB to get Compensated Thermocouple Value from Junction Value & Reference Values
float TCComp(float external, float internal)
  //do the Non Linear Temp Compensation Calculation here
  float TCTemp;
  float Vout=MAXc * (external-internal)/1000; //calculate  volts out from the MAX in millivolts
//Now calculate the corrected temperature
    if (Vout<0)
      {TCTemp=internal-c0+(c1*Vout)+(c2*pow(Vout,2))+(c3*pow(Vout,3))+(c4*pow(Vout,4))+(c5*pow(Vout,5))+(c6*pow(Vout,6))+(c7*pow(Vout,7));} //Below Zero
      {TCTemp=internal-d0+(d1*Vout)+(d2*pow(Vout,2))+(d3*pow(Vout,3))+(d4*pow(Vout,4))+(d5*pow(Vout,5))+(d6*pow(Vout,6))+(d7*pow(Vout,7));}  //Above zero
  return TCTemp;
}//end of TCComp
3  Using Arduino / Sensors / Re: MAX 31855 and Thermocouple Errors on: June 16, 2014, 10:21:35 am
Ahh, hang on....

Is the temperature derived from the tables the variation from the reference temperature and not the absolute temperature?

So that:

Actual temp = TAMB-(d0+d1*VOUT+d2*VOUT^2+ etc. +d7*VOUT^7 )


4  Using Arduino / Sensors / Re: MAX 31855 and Thermocouple Errors on: June 16, 2014, 10:00:15 am

I'm struggling to get this to work out - can you help me out here?

Using the equation in the MAX data sheet :  VOUT= (52.186 uV/degC) x (TR- TAMB) (here for a T  type)

I'm using TR as the (incorrect) 'external' temperature returned by the MAX (say 20 deg C) and TAMB as the reference (internal chip) temperature of 24 dec C. This gives me a VOUT = 0.20872mV.

Using this value in the NIST polynomial equation T=d0+d1*VOUT+d2*VOUT^2+ etc. +d7*VOUT^7 using the following coefficients:

d0   0.0000000000000
d1   25.9280000000000
d2   -0.7602961000000
d3   0.0463779100000
d4   -0.0021653940000
d5   0.0000604814400
d6   -0.0000007293422
d7   0.0000000000000

I get a 'real temperature of  -5.445 C which is plainly wrong.

I suspect Im doing something wrong in calculating the VOUT - any ideas that point me on the right direction?


5  Using Arduino / Sensors / Re: MAX 31855 and Thermocouple Errors on: June 11, 2014, 05:37:45 pm
Thanks Istadniy,
 I never thought to look on YouTube. I watched the clips, really useful thanks and it seems to make sense. I'll try it out as I'de really like to get it working more accurately than I have it now.

I appreciate you taking the time to reply, thanks

6  Using Arduino / Sensors / Re: MAX 31855 and Thermocouple Errors on: May 23, 2014, 05:48:51 pm
OK, (anyone who's still got the patience to listen!) here's the latest in my attempts to understand this weird thermocouple behaviour....

I've tried every combination of the following:

Cory J Fowler's library
George Matthew's library
Adafruit library
Rob Tilliart's library
(Many thanks to the above for all their efforts and help - it's much appreciated)

A T-Type thin wire thermocouple
A K-Type thin wire thermocouple

A 'BBTech' T Type amplifier breakout
A 'Playing with Fusion' K Type 4 Channel breakout
An 'Adafruit' 31855K breakout.

Everything seems OK at or around room temperature down to 0C, but my domain is in liquid nitrogen around -188C and warmer.

All the combinations (and an Adafruit RTD PT100) seem to give similar results, the attached graph (THERMO TEST.JPG) shows a calibrated meter (fitted with two K Types) against a 'BBTech' breakout fitted with a T type and a 'Playing with fusion' with a K Type (four actually and averaged). All the libraries give similar results.

The test involved dunking all the thermocouples into liquid nitrogen (-188C) and allowing to warm back up to room temperature whilst logging the output. This was repeated many times with different combinations of library and hardware.

After looking at the first graph, I worked out can 'fudge' the results by applying the following  'correction factor'
Corrected Reading = Actual Reading+(0.71*Actual Reading)

This results in the second graph (FUDGED.JPG) output, which is probably near enough for what I need, but I'm really like to know what the problem is.....

Any thoughts anyone?


7  Using Arduino / Sensors / Re: MAX 31855 and Thermocouple Errors on: May 03, 2014, 04:13:13 pm
Thanks again George,

I tried your library, neat, but same result. I'm now convinced its hardware problem rather than software. I love to hear from anyone who has successfully used a  MAX 31855T with a T Type as I'm beginning to suspect the chip as both the the BBetch and Playing with Fusion breakouts give similar results, the common factor being the MAXIM chip. Or perhaps its the way I've wired it - did your K Type set up work OK on a breadboard? 

I suspected perhaps a mis-labelled thermocouple, was a K type masquerading as a T type? I tried a brand new one. Nope same thing.

I wish I could use a K Type, but the application demands a T type.

Thanks for your post....

8  Using Arduino / Sensors / Re: MAX 31855 and Thermocouple Errors on: May 03, 2014, 07:57:58 am
Well my new 'Playing with Fusion' T type board and bi-directional level shifter arrived from US the other day so I rebuilt the circuit as the attached picture, connected up a T Type, loaded the sketch supplied by the guys at playing with fusion....

...and it reads with the same kind or error as the BBTech board.... arghh now I'm wondering if there is something fundamentally wrong with the MAX 31855. Has anyone out there ever got reliable readings from this chip?   

I tried the code below based on Cory Fowler's library too, same result.

Noticing that the board doesnt like to be poked or moved (it results in error readings) I also wonder if there is something wrong with building this circuit on a breadboard - I've seen a few posts on the forum suggesting this can be problematic with some devices. Any experience of this anyone?

Any other suggestions anyone? This is driving me bonkers.....

Here's the hardware Im now using:

Playing with Fusion Level shifter :
Playing with Fusion 4 Channel T Type MAX31855T board :
There's a Playing with Fusion sketch at the site too.

...and here's the code adapted from Cory's example.

#include <SPI.h>
#include <MAX31855.h>

const int csPin1 = 10;//the pin asked to read  CS
const byte scale = 0;   // 0 is Celsius/Centigrade, ~80µs. 1 is Kelvin, ~108µs. 2 is Fahrenheit ~100µs. 3 is Rankine, ~100µs.
byte error;
double external;
double internal;

MAX31855 TC1(csPin1);

void setup(){
  pinMode(csPin1, OUTPUT);
  digitalWrite(csPin1, HIGH);

void loop(){
  TC1.getTemp(external, internal, scale, error);
  Serial.print("Cold Junction Temp: ");
  Serial.print("C   ");
  Serial.print("Thermocouple Temp: ");
  if (error & 0x01){
    Serial.println("ERROR: Thermocouple Open!!");
  }else if (error & 0x02){
    Serial.println("ERROR: Thermocouple Shorted To Ground!!");
  }else if (error & 0x04){
    Serial.println("ERROR: Thermocouple Shorted To Power!!");
9  Using Arduino / Sensors / Re: MAX 31855 and Thermocouple Errors on: April 30, 2014, 04:20:03 pm
Thanks George,

I'm pretty sure that I am using a T type thermocouple (they are labelled 'T' Type) and a T type board (the chip is suffixed 'T'). I've tried several makes of T type thermocouple, all give the same result, so I suspect the board.

Black Box Tech MAX31855 T Type breakout board, details here:

T Type thin wire Thermocouple:

Curiously I've just noticed that increasing the temperature of the MAX31855T (by putting my finger on it) increases the reported temperature of the thermocouple too - to the correct temperature of the room. I'll try this when I get back in the lab with some liquid N2.

Im waiting for the postman to deliver some new 'Playing with Fusion' T type boards, so we'll see how those work.

Thanks for posting...

10  Using Arduino / Sensors / Re: MAX 31855 and Thermocouple Errors on: April 27, 2014, 04:32:32 am
The chip operates only at 3V3 (according to the datasheet, page 2: absolute maximum ratings for Vcc is 4.0V), so maybe that information is just wrong and you have to drive it with not more than 3.3V to get reliable results. It's possible that the module includes a voltage regulator but we don't know it. You might measure the voltage between pin 1 and 4 of the chip during operation.

When operating the voltage between pin 1 and 4 of the MAX31855T on the breakout board is 3.109 V, which I think is just within the recommended operating range of the chip as per spec sheet (3.0v to 3.6v). Im feeding the breakout board with 5.06v from Vcc on the Arduino so I guess there must be a voltage regulator on the board.


11  Using Arduino / Sensors / Re: MAX 31855 and Thermocouple Errors on: April 25, 2014, 04:13:10 am
Thanks again Pylon,

Im coming to the same conclusion as the other reviewer I think - (the review has strangely disappeared)  but I'll try the voltage measurement. Its a shame as the boards feel and look nicely made.

In the meantime I've ordered one of these:

I'll report back on how that one performs....

12  Using Arduino / Sensors / Re: MAX 31855 and Thermocouple Errors on: April 23, 2014, 04:09:47 pm
Hello jremington,

Here at home I'm at 600ft ASL (so should be about 99.3 C  I reckon) and my thermo peaked at 88.75C, but at my previous test  I was only at about 40ft ASL and the thermocouples still read only about 88\89C in a boiling kettle - then I had a calibrated Fluke in there too which read a shade under 100C.

I'm stumped.....!? My next test will be to use a different make of breakout board as that seems to be the only common factor.


13  Using Arduino / Sensors / Re: MAX 31855 and Thermocouple Errors on: April 23, 2014, 02:34:57 pm
Thanks Pylon,

Yes I think K types are very similar - my knowledge of thermocouples has only started in the last few weeks so most of it is new to me.

I'm away from my liquid nitrogen supply for a few days, but attached is a couple of print outs using Cory's library in DEBUG mode, hopefully it means more to you than me!

I'm a bit limited to what temperatures I can use here at home - my cooker and my freezer.... smiley-confuse

Attached are printouts from both, any use?

This is on a Micro Pro 5v wired very simply as per the attached photo.

Thanks for your help,

Also attached is a Boiling water file set - about 88.5C but measured as 100C with an (uncalibrated) cooking thermometer from my kitchen drawer...

14  Using Arduino / Sensors / Re: MAX 31855 and Thermocouple Errors on: April 23, 2014, 07:55:02 am
Hello Pylon,

Thanks for taking the time to reply, much appreciated

I didn't time the response between Corry Fowlers and Rob Tilliaart, but both are much faster than I need. In the finished state Im sampling at about 1 Hz. I'll have another look at Corry's but the output is the same anyhow.

I measured the 'actuals' using two other devices:  A JUMO digital thermostat and also a hand held Fluke fitted with a thermocouple probe. Both are calibrated and gave very similar readings. Im pretty sure they are correct.

I also put the Fluke probe and my probe in a kettle and boiled it. The fluke read 99.8C my probe 80C and I've done the same with some liquid N2, Fluke measured -140C, mine read -80C.

I've tried four ways of connecting the probes physically as described in my original post but there's a photo attached - all methods seem to result in the same reading.

With a magnifying glass I can just read 'MAX31885 T' on the chip on the breakout board. Does the T signify T type I wonder ? On the reverse side they have 'Type T' written on them.


15  Using Arduino / Sensors / MAX 31855 and Thermocouple Errors on: April 23, 2014, 06:21:15 am
Hello All,

I've been struggling with this for a week now and tried everything I can find here and elsewhere, so its time to turn to the help of the gurus.....

I'm working on a cryogenic application that uses 6 T-Type thermocouples running through 6 MAX31855 breakout boards and while everything seemed OK at room temperature it quickly became apparent that all the thermocouples were reading low at temperatures above around room temp and high at temperatures below that :
at +100C they read +88C
at +38C they read +32C
at +20C they read +20C - Which lulled me into a false sense of smugness....
at  -22C they read -10C
at -140C they read -80C

To simplify things I stripped off everything else and just left one MAX31855 fitted with a T Type thermocouple and connected as follows:

GND : 0v Breadboard Rail
CS : D2 on NANO
V : +5v Breadboard Rail
SCK : D13 on NANO
SO : D12 on NANO
GND : 0v Breadboard Rail

Nano is connected thus:
GND : 0v Breadbaord Rail
5v : 5v Breadboard Rail

I've tried several MAX31855 libraries and also one solution with a library-less read but all report similar results:

I settled on Rob Tillaarts solution as its fast....

Here's what I've tried:
I've tried several different brands of thermocouple, no significant change.
I've tried a range of capacitors across the terminals of the thermocouple connection, no change.
I've tried connecting the thermocouple directly with bared wire, with crimps and by clamping the connector pins under the screw terminals, no change.
I added the TRACO power brick instead of running of the NANO supply, no change.
I tried replicating everything on really small breadboard using a Micro Pro 5v and really short wires, no change.
 I tried using an old MAX6675 I had lying about and got similar results but Im not sure if it would be valid for a T-Type
I tried connecting a K Type but that was similar.

By a process of elimination I guess the only consistent thing is the breakout board, but I'm unsure of how I can test\validate this?

Any suggestions  gratefully received....

Black Box Tech MAX31855 T Type breakout board, details here:

T Type thin wire Thermocouple:

TRACO Power 24v to 5v power brick: TEN 5-2411 here:

My code (with thanks to Rob Tillaart):
#include "MAX31855.h"

const int clPin = 13;//CLK. SCK
const int doPin = 12;//DO, Data Out
const int csPin1 = 2;//the pin asked to read  CS

MAX31855 tc1(clPin, csPin1, doPin);

void setup()
  Serial.print("MAX31855 Ver:\t ");

  //CS pins high to turn off
  digitalWrite(csPin1, HIGH);

  digitalWrite(csPin1, LOW); //Switch ON CS
  uint32_t start = micros();
  for (int i=0; i< 10; i++);//After a you can do tc.getTemperature() and tc.getInternal()
  uint32_t stop = micros();
  //After a you can do tc.getTemperature() and tc.getInternal()
  //repeated getTemperature() will give the same value until a new
  digitalWrite(csPin1, HIGH); //Switch OFF CS 
  Serial.print("10 x reads in :\t"); // \t is a TAB
  Serial.print(stop - start);
  Serial.println(" mSecs\t");
  float t1 = tc1.getTemperature();
  Serial.println(t1, 2);


void loop()
  digitalWrite(csPin1, LOW); //Switch ON CS;
  float t1 = tc1.getTemperature();
  digitalWrite(csPin1, HIGH); //Switch OFF CS
  Serial.print("T1: ");
  Serial.println(t1, 2);

Pages: [1] 2