Is temperature linear to analog readings?

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. :cold_sweat:

I considered the Steinhart–Hart equation Steinhart–Hart equation - Wikipedia but it sounded a bit complicated. If there is a simpler equation please suggest one :slight_smile:

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!

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

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.

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!

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

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

O thanks for the correction))

MarkT:
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.

arbutus:
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 :stuck_out_tongue_closed_eyes:

Docedison:
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 :open_mouth: I guess I will start reading it 8)

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

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

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!