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?
The steps I usually use with an NTC thermistor and an Arduino are as follows:
The code I usually use to do the latter is:
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.
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.
There is also the possibility to put the NTC in a wheatstone bridge and do the measurement over the bridge.