Go Down

Topic: Is temperature linear to analog readings? (Read 675 times) previous topic - next topic

mixania

Feb 17, 2013, 09:40 pm Last Edit: Feb 17, 2013, 09:59 pm by mixania Reason: 1
Hi Arduino Forum! I want to begin a project so I just got 5 pieces of 10K Thermistors from ebay and now I'm figuring out how to get some valuable temperature readings from the analogRead() function.  :smiley-roll-sweat:

I considered the Steinhart-Hart equation  http://en.wikipedia.org/wiki/Steinhart%E2%80%93Hart_equation but it sounded a bit complicated. If there is a simpler equation please suggest one :)

I'm hoping on getting some suggestions about how to simply get temperature readings from a thermistor. If yes, please show me how. And is temperature relation is linear to the analog readings? Because if so, it would simplify things)) Thanks!
Arduino Uno R3
Mac OSX Lion

MarkT

You mean analogRead(), not analogWrite()  :)

I think it depends on the range of temperature you are looking at - the smaller the range the simpler
the curve needed to fit to the device's response over that range.

For a very small range a linear approximation might be enough, somewhat larger you could try a
quadratic curve or cubic.

For a large range of temperature the Steinhart-Hart equation will be best simply because it has the right
form and fewer parameters are needed to get a good fit - otherwise a polynomial or rational function
approximation with more parameters would be needed.
[ I won't respond to messages, use the forum please ]

arbutus

Thermistors do not show a linear relationship of temp <> resistance over their entire range. 

Thermistors are either PTC (positive temperature coefficient) where R increases with T, or NTC which does the opposite.

Most PTC thermistors that can work in the ambient range - say 0C to 30C exhibit a fairly linear response, so a simple 3 point interpolation would give a fairly accurate answer.  NTC thermistors generally show a significant exponential variation with temperature.

So to use your thermistors, measure resistance (or analog voltage on the Arduino) at 0C, 25C, 50C, 75C and 100C. Plot a curve and apply a little high school math to interpolate between the values.

Most folks working with temperature sensors use digital devices which are internally compensated for non-linear effects.

Hope this helps!
Don't breath in the magic smoke!

Docedison

#3
Feb 17, 2013, 10:06 pm Last Edit: Feb 17, 2013, 10:11 pm by Docedison Reason: 1
Look here: it's a good article about thermistors, includes math and a table as I remember...
http://www.phanderson.com/picaxe/lin_thermistor.html.
This has been my Go-to for thermistors.That having been said it is very possible to use a 3 point calibration. Ends of a piecewise linear section of interest and midpoint and split the difference to the middle point...{Edit RKJ}

Bob
--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

mixania

#4
Feb 17, 2013, 10:07 pm Last Edit: Feb 17, 2013, 10:10 pm by mixania Reason: 1

You mean analogRead(), not analogWrite()  :)


O thanks for the correction))


For a large range of temperature the Steinhart–Hart equation will be best simply because it has the right
form and fewer parameters are needed to get a good fit - otherwise a polynomial or rational function
approximation with more parameters would be needed.



So to use your thermistors, measure resistance (or analog voltage on the Arduino) at 0C, 25C, 50C, 75C and 100C. Plot a curve and apply a little high school math to interpolate between the values.


Hmm, I guess that's a good idea. I would need to break my head a little thought to figure out the numbers, but i'm sure it would be worth for killing my week-end time :smiley-yell:

Arduino Uno R3
Mac OSX Lion

mixania


Look here: it's a good article about thermistors, includes math and a table as I remember...
http://www.phanderson.com/picaxe/lin_thermistor.html.



Wow! Thanks! This looks awesome :smiley-surprise: I guess I will start reading it  8)
Arduino Uno R3
Mac OSX Lion

pito

Quote
Plot a curve and apply a little high school math to interpolate between the values.

Or you may use excel - it calculates the math for you. Most probably you will be not measuring the thermistor's resistance but voltage on a divider (gnd - 10k thermistor -V- 10k resistor - Vcc). So the values will differ.
(below an example only).

Tumbleweed

I just order these, http://www.digikey.com/product-detail/en/MCP9700-E%2FTO/MCP9700-E%2FTO-ND/1212509,  $.30,  linear temperature IC, with 10mv spread for each degree celcius. Plenty accurate for anything I do.
TomJ
Einstein once said you don't really understand anything until you can explain it to your Grandmother

Veco

There's a rather nice example on one of the Arduino pages:

I've been using this with my 4k7 thermistor to test my code before i got my big expensive temperature/relative humidity probe.

http://playground.arduino.cc//ComponentLib/Thermistor2

I don't think it's the most accurate thing in the world, but it agrees with the also cheap temperature sensor in my room (+-1c).

Good enough to test a PID on my electric heater!

Go Up