10 posts / 0 new
Author
Message

Hi Folks,

I'm planning to read an NTC temperature sensor as per attached image

The resistance is not linear with temperature, so the first thing that would come to mind is to use a look up table with 1C steps.

I'm wondering if there is a better way to do this?

Thanks

## Attachment(s):

A lookup table is the common way to do this. Usually one would use an interpolation table which is smaller at, say, 16 entries. The adc value goes in, the temperature comes out. There are online calculators that compute the resistance etc at various temperatures. You choose a resistor to ensure the temperature of most interest gives the best adc resolution.

We see our fair share of threads here with equations that model that kind of curve.

(personally I'm with you and Kartman and would just use a table).

BTW I know my eyes are old and tired but doesn't that function actually look pretty linear? I know it's on a log scale. But presumably the "equation" is pretty close to one call to exp() or log() or something?

Oh and did you know you can just paste images into the editor here? No need to use "attach" any more. And they are just "easier to see" if you just do this...

I think the decision to use simple equation or complicated steinhart equation depends on accuracy. Steinhart eqn fits the 3 temps and resistances to within .1 deg. A lookup table that interpolates has max error in between 2 temps. If you wanted accuracy to .1 deg using linear interpolation, you need the temp readings real close together and you fill up flash with a giant table. A cheap dial thermometer seems real accurate from 0 deg F to about 220 deg F. I'd like my fancy NTC electronic thermometer to be as good as as \$1 barbeque thermometer. 1% or so? 3%? I have a half dozen auto water temp sensors that I can line up on the bench and I get a different R from all of them at room temp. Totaally impractical to take 3 readings at 0,25,and100 deg C from each sensor just to use it as a sensor. Need sensors that are 1% which are pricier. Seems like we would would want to read 212 deg F in boiling water, so that one part in 200 or .5%. Your interp table error right in the middle of the two actual values in the table needs to be less than that.

Imagecraft compiler user

Last Edited: Mon. Mar 16, 2015 - 06:12 PM

As I recall there is a nice tutorial in the tutorial forum on NTC temp measurements!!    Check that out.

Jim

FF = PI > S.E.T

There are apps and there are apps.

In a number of production apps, we use a "bias resistor" to pull the curve "close enough" to linear, and then use linear interpolation.

I have a spreadsheet that aids in this.  It generates a resistance vs. temperature table using thermistor datasheet values.  Then, various bias resistor values can be chosen and the resulting curve shown.  Excel then calculates the R2 value.  IME above .98 it is usually "good enough" over a range of interest.

https://www.avrfreaks.net/comment...

https://www.avrfreaks.net/comment... and links therein

But yes, I have a number of apps that have ~10 entry lookup table, linear interpolation.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

Bob and I posted NTC Steinhart routines HERE

JC

From work with a spreadsheet implementing Steinhart-Hart (from Measurement Specialties Inc. msi Web site), I speculated that the detailed resistance-temperature tables in NTC datasheets were generated from similar/same equation and not tested at e.g. each degree C.

Bob, I'll throw the challenge back at you re the \$1 dial thermometers.  You don't need a lab; just do the boiling and ice water slurry test (you don't have much altitude to worry about), and I'll ow you a virtual cold one if each is within 3%.  And double-or nothing if >>ANY<< of your three are within 2%.

Look at the curve above in post #3.  then imagine line segments each 10 degrees C.  How far are these segments going to stray off that path?  Not much.

Now imagine applying a bias resistor to further pull the curve straighter over the are of interest, as we do.

We get readings with both linear and interpolation within one degree F over the area of interest.  Close enough for our production apps are part of the process.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

That was my point.... when I'm trying to get the 100 deg C ohms reading from my TU165 automotive NTC sensors, I note the little dial thermometer is sitting right on the bold line at 212 deg F. And I'm solving the darn Steinhart eqn using logs and cant get within a couple of deg. "Within a degree" at 212 degress is 0.5% right?

Imagecraft compiler user