Electronic – NTC temperature help

avrmicrocontrollerthermistor

I just started writing a program that represents the temperature of an NTC TT102 thermistor. First I tried the famous voltage divider, but I soon found that it is not good. So I decided to uses the NTC formula to get the temperature but it seems not to work. Since the formula results in float numbers, I tried such float variables but still no good results.
What do you think I should do?

Best Answer

The steps I usually use with an NTC thermistor and an Arduino are as follows:

  1. Set the thermistor up as one half of a voltage divider between Vcc and GND.
  2. Use the ADC to read the value at the center point.
  3. Use some mathematics to calculate the voltage the reading represents.
  4. Use that voltage to calculate the current resistance of the thermistor.
  5. Feed that value into the NTC formula along with the specifics for the thermistor.

The code I usually use to do the latter is:

double Res2Kelvin(double R, double A, double B, double C)
{
    double T;
    T = (1 / (A + B * log(R) + C*(pow(log(R),3))));
    return T;
}

R is the resistance, and A, B and C are the coefficients for the NTC Thermistor. (For the thermistor I use these are 0.0015205025, 1.0875337E-4 and 3.2368632E-7 respectively - the datasheet should give you these.)

Which returns the current temperature in Kelvin. Then I have to convert from Kelvin to whatever you want to work in - say for Celcius, just subtract 273.15.