Re: Max 31855 Reading High Temperatures
Re: Max 31855 Reading High Temperatures
Re: Max 31855 Reading High Temperatures
Re: Max 31855 Reading High Temperatures
Note that the MAX31855 assumes a linear relationship between temperature and voltage. Because all thermocouples exhibit some level of nonlinearity, apply appropriate correction to the deviceās output data
Note 3: Guaranteed by design; not production tested.
Note 4: Not including cold-junction temperature error or thermocouple nonlinearity.
Re: Max 31855 Reading High Temperatures
Re: Max 31855 Reading High Temperatures
adafruit_support_mike wrote:[...] this page from Maxim has a fair amount of information: http://www.maximintegrated.com/app-note ... vp/id/5032
Re: Max 31855 Reading High Temperatures
coryjfowler wrote:The coefficients listed on that page by Maxim have different decimals than what is printed here from Omega... http://www.omega.com/temperature/z/pdf/z198-201.pdf
The Omega coefficients expect a microvolt input and the Maxim coefficients expect millivolt input... given that information, I would expect the decimals to only be off by 3.
Re: Max 31855 Reading High Temperatures
ashurbr wrote:Greetings diemkae,
I know all about this. Please see a post I did previously - search for 31855 chip transplant. The MAX 31855 modules use a constant conversion from measured emf to temperature. The actual emf is not linear. What you can do is back out the emf using the measured temperature and reference junction temperature, then use the primary NIST emf data as a lookup/interpolation or regress the NIST data to a better polynomial.
Adafruit support - this issue has arisen several times - do you want to work with me to develop a "better" library?
const double pTofEMF_K[23] = {0.1848013805, 26.0040600894, -0.6659309757, -0.0950680281, 0.0470137601, 0.0077148174, -0.0038861697, 0.0002252546, 8.02620899467851E-005, -1.53997722795589E-005, 6.70120567745449E-007, 1.18557275279114E-007, -2.32089040330256E-008, 2.11696476207507E-009, -1.26202276209997E-010, 5.36096010213247E-012, -1.67449721896137E-013, 3.87519041444531E-015, -6.58496406083465E-017, 7.99924246322705E-019, -6.58394029689987E-021, 3.29246264672238E-023, -7.55726972137995E-026};
const double MAXTEMF_K = 0.041276; // mV/deg C
const double MAXRJEMF_K = 0.040730; // mV/deg C
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);
}
double emf = MAXTEMF_K*c - (MAXTEMF_K - MAXRJEMF_K)*thermocouple.readInternal(); //the key line
double output= correctedT(emf);
Serial.print("Corrected Temp = ");
Serial.println(output);
Serial.print(emf);
Serial.println(" mv/C");
Serial.println("");
delay(1000);
}
double correctedT (double EMF){
double temp = 0;
for (int k=0; k<23; k++){
temp += pTofEMF_K[k]*pow(EMF, k);
}
return temp;
}
Internal Temp = 21.69
C = -131.25
Corrected Temp = -174.53
-5.45 mv/C
emf = MAXTEMF_K*(c - thermocouple.readInternal());
emf = MAXTEMF_K*c - MAXRJEMF_K*thermocouple.readInternal();
Re: Max 31855 Reading High Temperatures
Re: Max 31855 Reading High Temperatures
jh421797 wrote:Hi Pete,
Did you ever resolve this problem to your satisfaction?
I am trying to monitor a -80 degC freezer with a k-type thermocouple and the MAX31855 breakout board.
My readings are about 10 degC higher on the circuit than what the freezer & a fluke thermocouple reader are reporting. It sounds like a similar issue you were experiencing.
Thanks,
- Jeff
Simulator: +1370
53001640
14C0
Internal Temp = 22.25
Raw Temp = 1328.00
Raw Temp - Internal = 1305.75
Thermocouple voltage: 53.89614
Internal voltage: 0.88896
Total voltage: 54.78509
Corrected Temp = 1369.05
Simulator +977.5
3D2C1630
F4B
Internal Temp = 22.25
Raw Temp = 978.75
Raw Temp - Internal = 956.50
Thermocouple voltage: 39.48049
Internal voltage: 0.88896
Total voltage: 40.36945
Corrected Temp = 976.81
Simulator: +585
24C01650
930
Internal Temp = 22.25
Raw Temp = 588.00
Raw Temp - Internal = 565.75
Thermocouple voltage: 23.35190
Internal voltage: 0.88896
Total voltage: 24.24086
Corrected Temp = 584.39
Simulator: +300
127C1640
49F
Internal Temp = 22.31
Raw Temp = 295.75
Raw Temp - Internal = 273.44
Thermocouple voltage: 11.28641
Internal voltage: 0.89148
Total voltage: 12.17789
Corrected Temp = 299.27
Simulator: +192.5
BDC1640
2F7
Internal Temp = 22.25
Raw Temp = 189.75
Raw Temp - Internal = 167.50
Thermocouple voltage: 6.91373
Internal voltage: 0.88896
Total voltage: 7.80269
Corrected Temp = 191.59
Simulator: +100
6341640
18D
Internal Temp = 22.25
Raw Temp = 99.25
Raw Temp - Internal = 77.00
Thermocouple voltage: 3.17825
Internal voltage: 0.88896
Total voltage: 4.06721
Corrected Temp = 99.27
Simulator: 0
1640
0
Internal Temp = 22.25
Raw Temp = 0.00
Raw Temp - Internal = -22.25
Thermocouple voltage: -0.91839
Internal voltage: 0.88896
Total voltage: -0.02943
Corrected Temp = -0.74
Simulator: -50
FD241630
FFFFFF49
Internal Temp = 22.19
Raw Temp = -45.75
Raw Temp - Internal = -67.94
Thermocouple voltage: -2.80419
Internal voltage: 0.88643
Total voltage: -1.91776
Corrected Temp = -50.79
Simulator -100
FAA01620
FFFFFEA8
Internal Temp = 22.06
Raw Temp = -86.00
Raw Temp - Internal = -108.06
Thermocouple voltage: -4.46039
Internal voltage: 0.88138
Total voltage: -3.57901
Corrected Temp = -100.82
Simulator: -150
F8901620
FFFFFE24
Internal Temp = 22.12
Raw Temp = -119.00
Raw Temp - Internal = -141.13
Thermocouple voltage: -5.82508
Internal voltage: 0.88391
Total voltage: -4.94117
Corrected Temp = -151.21
Simulator: -200
F7141640
FFFFFDC5
Internal Temp = 22.25
Raw Temp = -142.75
Raw Temp - Internal = -165.00
Thermocouple voltage: -6.81054
Internal voltage: 0.88896
Total voltage: -5.92158
Corrected Temp = -201.93
Re: Max 31855 Reading High Temperatures
// corrected temperature reading for a K-type thermocouple
// allowing accurate readings over an extended range
// http://forums.adafruit.com/viewtopic.php?f=19&t=32086&p=372992#p372992
// assuming global: Adafruit_MAX31855 thermocouple(CLK, CS, DO);
float correctedCelsius(){
// MAX31855 thermocouple voltage reading in mV
float thermocoupleVoltage = (thermocouple.readCelsius() - thermocouple.readInternal()) * 0.041276;
// MAX31855 cold junction voltage reading in mV
float coldJunctionTemperature = thermocouple.readInternal();
float coldJunctionVoltage = -0.176004136860E-01 +
0.389212049750E-01 * coldJunctionTemperature +
0.185587700320E-04 * pow(coldJunctionTemperature, 2.0) +
-0.994575928740E-07 * pow(coldJunctionTemperature, 3.0) +
0.318409457190E-09 * pow(coldJunctionTemperature, 4.0) +
-0.560728448890E-12 * pow(coldJunctionTemperature, 5.0) +
0.560750590590E-15 * pow(coldJunctionTemperature, 6.0) +
-0.320207200030E-18 * pow(coldJunctionTemperature, 7.0) +
0.971511471520E-22 * pow(coldJunctionTemperature, 8.0) +
-0.121047212750E-25 * pow(coldJunctionTemperature, 9.0) +
0.118597600000E+00 * exp(-0.118343200000E-03 *
pow((coldJunctionTemperature-0.126968600000E+03), 2.0)
);
// cold junction voltage + thermocouple voltage
float voltageSum = thermocoupleVoltage + coldJunctionVoltage;
// calculate corrected temperature reading based on coefficients for 3 different ranges
float b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10;
if(thermocoupleVoltage < 0){
b0 = 0.0000000E+00;
b1 = 2.5173462E+01;
b2 = -1.1662878E+00;
b3 = -1.0833638E+00;
b4 = -8.9773540E-01;
b5 = -3.7342377E-01;
b6 = -8.6632643E-02;
b7 = -1.0450598E-02;
b8 = -5.1920577E-04;
b9 = 0.0000000E+00;
}
else if(thermocoupleVoltage < 20.644){
b0 = 0.000000E+00;
b1 = 2.508355E+01;
b2 = 7.860106E-02;
b3 = -2.503131E-01;
b4 = 8.315270E-02;
b5 = -1.228034E-02;
b6 = 9.804036E-04;
b7 = -4.413030E-05;
b8 = 1.057734E-06;
b9 = -1.052755E-08;
}
else if(thermocoupleVoltage < 54.886){
b0 = -1.318058E+02;
b1 = 4.830222E+01;
b2 = -1.646031E+00;
b3 = 5.464731E-02;
b4 = -9.650715E-04;
b5 = 8.802193E-06;
b6 = -3.110810E-08;
b7 = 0.000000E+00;
b8 = 0.000000E+00;
b9 = 0.000000E+00;
}
else {
// TODO: handle error - out of range
return 0;
}
return b0 +
b1 * voltageSum +
b2 * pow(voltageSum, 2.0) +
b3 * pow(voltageSum, 3.0) +
b4 * pow(voltageSum, 4.0) +
b5 * pow(voltageSum, 5.0) +
b6 * pow(voltageSum, 6.0) +
b7 * pow(voltageSum, 7.0) +
b8 * pow(voltageSum, 8.0) +
b9 * pow(voltageSum, 9.0);
}
Re: Max 31855 Reading High Temperatures
Re: Max 31855 Reading High Temperatures
Re: Max 31855 Reading High Temperatures
jh421797 wrote:Wow Pete, thank you!
I've been tinkering around with this for a while thinking I was doing something wrong. This seems to have fixed it.
I was using a cheap eBay thermocouple, and switched to an Omega thermocouple thinking that was the issue. They do make very nice products.
Here are my results:
Freezer = -81 degC
Fluke Reading (same thermocouple as below) = -78.3 degC
Standard 31855 Reading vs This Corrected Reading: (2 sec intervals)
Sensor Read Time =67ms -68.25 degC Corrected Sensor Read Time =205ms -77.85 degC
Sensor Read Time =67ms -68.25 degC Corrected Sensor Read Time =206ms -77.85 degC
Sensor Read Time =66ms -68.25 degC Corrected Sensor Read Time =206ms -77.70 degC
Sensor Read Time =67ms -68.25 degC Corrected Sensor Read Time =206ms -77.85 degC
Sensor Read Time =66ms -68.25 degC Corrected Sensor Read Time =206ms -77.85 degC
Sensor Read Time =67ms -68.25 degC Corrected Sensor Read Time =206ms -77.85 degC
Sensor Read Time =66ms -68.25 degC Corrected Sensor Read Time =206ms -77.77 degC
Sensor Read Time =67ms -68.25 degC Corrected Sensor Read Time =206ms -77.85 degC
Sensor Read Time =66ms -68.25 degC Corrected Sensor Read Time =206ms -77.77 degC
Sensor Read Time =67ms -68.25 degC Corrected Sensor Read Time =206ms -77.93 degC
Sensor Read Time =66ms -68.25 degC Corrected Sensor Read Time =206ms -77.77 degC
Sensor Read Time =67ms -68.25 degC Corrected Sensor Read Time =205ms -77.85 degC
Sensor Read Time =66ms -68.25 degC Corrected Sensor Read Time =206ms -77.85 degC
[snip]
Thanks again Pete, lifesaver!
- Jeff
Re: Max 31855 Reading High Temperatures