Pages: [1]   Go Down
 Author Topic: Is temperature linear to analog readings?  (Read 282 times) 0 Members and 1 Guest are viewing this topic.
Westbrook, CT
Offline
Full Member
Karma: 2
Posts: 128
"Why should I bother with made-up games when there are so many real ones going on." (c) Kurt Vonnegut
 « on: February 17, 2013, 03:40:50 pm » Bigger Smaller 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.

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!
 « Last Edit: February 17, 2013, 03:59:31 pm by mixania » Logged

Arduino Uno R3
Mac OSX Lion

0
Offline
Tesla Member
Karma: 71
Posts: 6611
Arduino rocks
 « Reply #1 on: February 17, 2013, 03:49:27 pm » Bigger Smaller Reset

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

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

Offline
Newbie
Karma: 0
Posts: 28
PICs, Arduinos and Pi, Oh My!
 « Reply #2 on: February 17, 2013, 03:59:42 pm » Bigger Smaller 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
Edison Member
Karma: 31
Posts: 2307
Experienced old Whitebeard with a Full head of Hair...
 « Reply #3 on: February 17, 2013, 04:06:24 pm » Bigger Smaller 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

“The solution of every problem is another problem.” -Johann Wolfgang von Goethe

Westbrook, CT
Offline
Full Member
Karma: 2
Posts: 128
"Why should I bother with made-up games when there are so many real ones going on." (c) Kurt Vonnegut
 « Reply #4 on: February 17, 2013, 04:07:08 pm » Bigger Smaller Reset

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

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

Arduino Uno R3
Mac OSX Lion

Westbrook, CT
Offline
Full Member
Karma: 2
Posts: 128
"Why should I bother with made-up games when there are so many real ones going on." (c) Kurt Vonnegut
 « Reply #5 on: February 17, 2013, 04:09:22 pm » Bigger Smaller 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 I guess I will start reading it
 Logged

Arduino Uno R3
Mac OSX Lion

Rapa Nui
Offline
God Member
Karma: 16
Posts: 888
Pukao hats cleaning services
 « Reply #6 on: February 17, 2013, 04:12:54 pm » Bigger Smaller 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).
 Logged

alabama
Offline
Full Member
Karma: 1
Posts: 168
 « Reply #7 on: February 17, 2013, 08:16:23 pm » Bigger Smaller 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
Newbie
Karma: 0
Posts: 28
 « Reply #8 on: February 18, 2013, 03:26:16 am » Bigger Smaller 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