Pages: [1]   Go Down
Author Topic: Is temperature linear to analog readings?  (Read 615 times)
0 Members and 1 Guest are viewing this topic.
New York, NY
Offline Offline
Full Member
***
Karma: 2
Posts: 142
"Why should I bother with made-up games when there are so many real ones going on." (c) Kurt Vonnegut
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley

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!


* DSC_9768.JPG (2087.7 KB, 3872x2592 - viewed 19 times.)
« Last Edit: February 17, 2013, 03:59:31 pm by mixania » Logged

Arduino Uno R3
Teensy 3.0
Mac OSX Yosemite

0
Offline Offline
Shannon Member
****
Karma: 222
Posts: 12717
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You mean analogRead(), not analogWrite()  smiley

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.
Logged

[ I won't respond to messages, use the forum please ]

Mayne Island, BC, Canada
Offline Offline
Jr. Member
**
Karma: 0
Posts: 67
PICs, Arduinos and Pi, Oh My!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Don't breath in the magic smoke!

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 48
Posts: 2935
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: February 17, 2013, 04:11:49 pm by Docedison » Logged

--> 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

New York, NY
Offline Offline
Full Member
***
Karma: 2
Posts: 142
"Why should I bother with made-up games when there are so many real ones going on." (c) Kurt Vonnegut
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You mean analogRead(), not analogWrite()  smiley

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

« Last Edit: February 17, 2013, 04:10:35 pm by mixania » Logged

Arduino Uno R3
Teensy 3.0
Mac OSX Yosemite

New York, NY
Offline Offline
Full Member
***
Karma: 2
Posts: 142
"Why should I bother with made-up games when there are so many real ones going on." (c) Kurt Vonnegut
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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  smiley-cool
Logged

Arduino Uno R3
Teensy 3.0
Mac OSX Yosemite

Rapa Nui
Offline Offline
Edison Member
*
Karma: 60
Posts: 2086
Pukao hats cleaning services
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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).


* temp.jpg (29.01 KB, 624x362 - viewed 22 times.)
Logged

alabama
Offline Offline
Full Member
***
Karma: 1
Posts: 183
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Einstein once said you don't really understand anything until you can explain it to your Grandmother

Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Pages: [1]   Go Up
Jump to: