Thermistor used as temperature sensor

Nov 07, 2005 24 Replies

I don't know how you got the transposed equation, so I can't verify that.

But I like a different function to fit temperature to divider voltage that has a natural shape that is about right.

If you treat the A/D full scale value as 1, then you can convert the fraction of 1 (called f) to temperature (with a maximum error of about .7 degrees) by this formula:

Temperature= a * (tan(f - b) + c + d*f Where a=-240.5856, b=0.5515, c=123.0738, d=-102.1026

But if you change the series resistor to 24k, The worst case error is about half as big (about +-0.3 degrees) with these constants: a=-196.0598, b=0.5532, c=106.3374, d=-96.91

tan()? It's only a bleedin' 8-bit ADC, how about a little LUT and be done with it?

Best regards, Spehro Pefhany

"it\'s the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com

;-)

Best regards, Spehro Pefhany

"it\'s the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com

I want to use an NTC thermistor as a temperature sensor in conjuction with an 8-bit ADC. The target temperature is 70C and I have chosen a 100k (@25C) thermistor and a 14k resistor to give me the best resolution around 70C.



I have constructed an Excel spreadsheet to try to determine the transfer characteristic using the ADC reading as ordinate and the equivalent temperature as abscissa. This spreadsheet is attached to my post under the same title in ABSE.



My problem is that I have used the Excel trendline function on sheets 2 & 3 of the spreadsheet and it works correctly on sheet 2 but not on sheet 3. Sheet 2 shows the scatter diagram with the temperature as ordinate and the calculated ADC reading as abcissa; the Excel trendline returns an equation which when plotted is good enough to use. However the trendline returned on the transposed scatter diagram on sheet 3 is rubbish, as demonstrated by the plot of the equation returned.



What am I doing wrong?


John B

That would work just fine. Only 255 values needed.

Either or both extreme ones should probably be replaced with thermistor open and thermistor shorted cases. ;-)

It's not even too bad with 10 bits in many cases these days.

Which value do you propose omitting?

Best regards, Spehro Pefhany

"it\'s the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com

I'm afraid these constants won't work at all. They are the solution to a different, but related function.

If you really want to plug these in, just for fun, the first set should have been: a=-797.4246, b=0.551, c=-316.7359, d=696.1691

and the case with the 24k series resistor: a=-653.0378, b=0.5539, c=-255.8475, d=556.9077

And for an even better fit, change the resistor to 30k and plug these constants into temperature=a* tan(d*(f-b)) + c Where: a=-43.504, b=0.5526, c=47.3743, d=2.1974

Actually, the curve is not fit to temperature for A/D values below 62 or above 240, so the table could be 179 values and cover the entire fitted range from 10 to 105 C. This allows for half degree resolution with 8 bit values, or 1/3rd degree if you waste just a bit of the range.

Indeed. Probably a few near each end, so a comparison would be more efficient.

Best regards, Spehro Pefhany

"it\'s the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com

.

That's the equation produced by Excel. However I have just taken another look and found I had used the wrong columns in the check plot on sheet 3!! It should have been column D for the ordinate and column E for the abcissa. It now looks better but is still incorrect. I'll need to do some more work on it tomorrow.

. I'll have a look at that too, but I'm only using an Atmel 8-bit ATmega32 so the floating point library will be a bit OTT.

Thanks anyway for your help.

John B

. .

I have lost count of the number of times I have told other people to go this way. I got so wrapped up in the challenge that I didn't even consider it.

Thanks.

John B

Almost all of that tolerance is in the absolute resistance of the thermistor - a good single point calibration ( in a well stirred ice bath where the ice has been made from distilled/de-ionised water) can get you to accuracies of some millidegrees.

You can buy trimmed "interchangeable" thermistors which offer unadjustaed accuracies of +/-0.2C (about +/-0.8% tolerance on resistance). Farnell offered Betatherm parts, and Newark has parts from YSI - including at least one offering +/-0.05C accuracy. Thermometrics and Fenwall are also in the business.

The Steenhart-Hart fitting function is usually cllaimed to be good enough to get millidegree accuracy over a respectable temperature range.

---------- Bill Sloman, Nijmegen

Steinhart-Hart

Thanks, - Win

statement.

may not be a

Many, many millions are made with *significantly* better than +/-0.5°C accuracy near RT. That's extremely good unadjusted accuracy-- unmatched by any other inexpensive sensor. Also, they have high output and do not require a voltage reference, only a cheap reference resistance.

There are a couple market segments in which they dominate because of these unique characteristics-- and many more in which they are dubious or totally unsuitable, of course.

Best regards, Spehro Pefhany

"it\'s the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com

Without knowledge of the application requirements, this is a ridiculous statement.

NTCs are cheap and easy to interface. They are not especially accurate but that may not be a problem.

Quite possibly. But if the O.P. needs a simple function to produce a lookup table of temperatures fore A/D states, having a function that adds little additional error to that of the parts, is useful.

My point was, that just because Excel produces polynomial fits for any curve, that form may not be the best natural fit to the curve.

That kind of function models the resistance versus temperature of the thermistor pretty well (I other functions that I like better) but they get pretty ugly when expressing temperature versus the output of a divider.

Isn't that precision relatively absurd considering the manufacturing tolerance on all those things is something like 25%?

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required