# NTC temperature help

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?

-
Any chance you could provide us with: a) What is the specification of the TT102? b) Where is the datasheet for the TT102? c) What is the "NTC Formula" you are using? d) What are the coefficients you are entering into it? e) What circuit have you tried to use to get your results? f) What are you trying to read the value with? Etc. The more detail you can give us the better. – Majenko Dec 18 '11 at 22:36
Converting calculations to integer math is an art, involving both trying to combine operations for efficiency and making sure that no intermediate stage can overflow or underflow. Sometimes a lookup table, with or without interpolation can also be beneficial. However, you do have floating support available from most contemporary compilers, if you have the program space available to use it. Generally extreme speed is not needed when measuring temperature by itself. – Chris Stratton Dec 18 '11 at 23:50
I Googled "NTC TT102" and arrived at this question. Until you produce a datasheet I'll assume there is no such thing as a TT102. Voting to close. – stevenvh May 23 '12 at 12:40

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.

-
Can you say something about the precision of the math library that implement the natural logarithm? Can you say that the machine precision is good enough? – thexeno Sep 26 '15 at 23:24
I can say nothing at all about that. It is all 100% dependant on what hardware and software you are using. – Majenko Sep 27 '15 at 7:33

There appears to be no such thing as a TT102, so I'll use another NTC for the solution.

NTCs are highly non-linear, and manufacturers publish long tables with resistance values against temperature. You'll have to implement that table in your microcontroller for lookup, or you can linearize the NTC. A parallel resistor plus a series resistor for the divider gives a linear behavior from 0° to 60°:

The output voltage is 8V at 0°C, and 3.2V at 60°C. So the transfer function is

$V = -0.08 \cdot T + 8V$

with $T$ in °C. If you buffer this you can scale it down to [2V, 5V] and feed that to the ADC. You could also use a difference amplifier to get a range [0V, 5V], but this will give you a higher resolution, not a higher precision, since the graph won't be perfectly linear anyway.

You can also use a Wheatstone bridge, like Johan suggests, but then again, you'll get a higher resolution which is a bit pointless if you have to interpolate the lookup table.

-

First i tried the famous voltage divider bus i soon found that it is not as good.

There is also the possibility to put the NTC in a wheatstone bridge and do the measurement over the bridge.

http://www.cs.cmu.edu/~dst/E-Meter/wheatstone.html

-