How to mathematically linearize a thermister output - Page 1
Forum section: electronics / general

author: Simon
author_rank: Unknown
timestamp: March 31, 2013, 09:29:41 am
content: I'm doing a temperature control project and will use a thermister, idealy I'd have a R/C output but as we all know the scale is a bit exponential. Is there a way to mathematically back track to the original temnperature value ? say by knowing the formula that gets the resistance can i reverse it on the resistance to know the temnperature without having to write in a complete table of resistances ? or maybe that is the best thing ?

author: firewalker
author_rank: Super Contributor
timestamp: March 31, 2013, 09:34:52 am
content: There is Steinhart-Hart equation.http://en.wikipedia.org/wiki/Steinhart%E2%80%93Hart_equationI have used it several times and it is fairly accurate.Alexander.

author: IanB
author_rank: Super Contributor
timestamp: March 31, 2013, 09:36:04 am
content: Use something like this?http://ww1.microchip.com/downloads/en/DeviceDoc/21942e.pdf

author: Simon
author_rank: Unknown
timestamp: March 31, 2013, 09:39:09 am
content: but does that formula apply to any thermistor ?Ian: Nope don't really want to use one of those unless you can get them cheap embedded in 3/8" BSPT bosses with a deutsh socket on the back.

author: firewalker
author_rank: Super Contributor
timestamp: March 31, 2013, 09:41:49 am
content: Every thermistor I have used seems to follow that "rule". I am using this datasheet for the values.http://dl.dropbox.com/u/31742622/ntc.pdfAlexander.

author: mrflibble
author_rank: Super Contributor
timestamp: March 31, 2013, 09:42:31 am
content: Quote from: firewalker on March 31, 2013, 09:34:52 amThanks! Bookmarked for future reference.

author: Rerouter
author_rank: Super Contributor
timestamp: March 31, 2013, 09:46:34 am
content: so to this same end, is there some way to mathematically work out a correction curve from say 100 points? (preferably not expressed as an integral)

author: IanB
author_rank: Super Contributor
timestamp: March 31, 2013, 09:53:34 am
content: I think with 100 points you could use a lookup table.If you want a simpler mathematical formula you have to find a pattern that fits the data. Knowing something about the physics can often help.

author: Unknown
author_rank: Unknown
timestamp: March 31, 2013, 10:08:38 am
content: Fitting a polynomial of either R or log(R) as in the Steinhart-Hart equation would probably be my first guess. Polynomials are relatively cheap, since they only involve multiplication, which many uCs can do in a reasonable number of cycles.The issues with lookup tables is that you still need interpolation for values in between, unless your ADC only outputs 100 codes.

author: Rerouter
author_rank: Super Contributor
timestamp: March 31, 2013, 10:20:37 am
content: well in my case it is more to devise a sound model for automotive cross coil gauges, as i occasionally have to alter the calibration, but if i knew how the relationship as a whole shifts i could more easily calculate the values when something odd is requested,

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: March 31, 2013, 10:52:32 am
content: For the level of accuracy of a typical thermistor, a lookup table with linear interpolation will typically take less space than the maths code to calculate it. The same table can also be used to compensate for the measurement method where you don't get a linear resistance value (e.g. when using a simple potential divider).

author: Neilm
author_rank: Super Contributor
timestamp: March 31, 2013, 11:05:54 am
content: I have seen a circuit that would roughly linearise a thermistor output. I don't remember it very well. As I recall, you had an op-amp - fed a reference voltage into one pin and had the thermistor in parrallel with a resistor in the feedback path. It made it approximately linear for a certain temperature range.

author: nessatse
author_rank: Regular Contributor
timestamp: March 31, 2013, 11:34:29 am
content: It all depends on the temperature range and accuracy you require.The mere act of using a thermistor in a voltage divider configuration will linearise the output to a certain extent (for a specific temperature range). The choice of series resistor is quite important though If you use a common 10k thermistor for example, in series with a 4k7 as the 'top' of the voltage divider, you will get a fairly linear output over the 20C-80C range, within 2%. No lookup tables or complex maths required, just a simple scaling factor to convert the voltage to temperature.

author: mrflibble
author_rank: Super Contributor
timestamp: March 31, 2013, 11:43:54 am
content: Quote from: mikeselectricstuff on March 31, 2013, 10:52:32 amPretty much this. I usually write a small matlab script that calculates the datapoints and truncates it to n-bits precision. Then I do an error plot of the LUT + interpolation solution versus ideal value. If that all looks reasonable then you spit out the table with some printf's so you get some ready to include C/verilog/whatever code, and you're good to go.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: March 31, 2013, 12:02:09 pm
content: Quote from: nessatse on March 31, 2013, 11:34:29 amIt's also easy to use multiple, selectable resistors to select different ranges by connecting to different MCU pins and tristating the unused one(s).

author: firewalker
author_rank: Super Contributor
timestamp: March 31, 2013, 12:23:20 pm
content: A Sunplus (I remember Sunplus batteries, the same company?) application note.http://mcu.sunplusmcu.com/soft/75_en_Application_note/AN_SPMC75_0101_en_V1.3.pdfAlexander.