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
else
{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