The function:
Code: Select all
// function to convert Temp C to ADC counts
float TempToADC(float T)
{
return ((-0.000837 * T + 0.170202) * T + 4.565045) * T + 78.452228; // 3rd order polynomial
}
It is up to you to put in the correct formula for your system. The default formula might act weird above certain Temperatures it was intended for and as Temperature is increased return lower ADC readings.
You might temporarily replace the formula with a simple linear formula like:
Code: Select all
// function to convert Temp C to ADC counts
float TempToADC(float T)
{
return T;
Then use that to find what temperature corresponds to what ADC reading over your range of interest, create a table, fit a curve, then enter that formula.
HTH