Go Down

Topic: Thermistor Problems (Read 3358 times) previous topic - next topic


Jan 16, 2012, 11:47 am Last Edit: Jan 18, 2012, 08:13 pm by znorris Reason: 1
Problem: Thermistor readings are inaccurate. These problems are not from the Steinhart-Hart equation but from either the voltage divider circuit, the analog read or how we are determining resistance.
If we utilize this equation to determine the resistance of my thermistor I do not get an accurate resistance.
Code: [Select]
Rt = R * ( 1023.0 / (float) Vo - 1.0 ) (RT is thermistor/divider top, Vo holds the data from analog read, R is the divider bottom and is defined as float 82000.00 which matches the 82 k? resistor in Rbottom)

(Note that our Vin is = 5V, not the 9V shown in the diag.)

I've read countless PDFs and websites regarding thermistors, voltage dividers, the arduino and their use. However my group and I must be missing something.  We've taken our Temp/Resistance readings from 0C - 37.77C. This range is for testing the sensors, intended range will be between 37C - 148C. Here is the chart we've created: https://docs.google.com/spreadsheet/ccc?key=0AroU4BiUyB-odFRKclFHQlVjX0Eycy00NTRZd0lNSlE

Utilzing this calc http://www.thinksrs.com/support/Therm%20Calc/NTCCalibrator/NTCcalculator.htm we have come up with the following Steinhart-Hart coefficients: A= -1.531358897e-3, B= 4.353291903e-4, C= -2.488687432e-7.

Most of our work has come from [PDF]: http://web.cecs.pdx.edu/~gerry/class/EAS199B/howto/thermistorArduino/thermistorArduino.pdf

Any help would be GREATLY appreciated.


//EDIT Code for this project may be found on github. https://github.com/znorris/LazySmoker


In what way are they inaccurate?

Two things I will note about your circuit/readings.

1. The Rbottom - what is the accuracy percentage of that resistor?  If it's a 5% resistor (gold band) then it will be 82K? ±5% - anything from 77.9K? to 86.1K?.
2. You say it's a 5V supply, but is it really a 5V supply?  If you are running off external power through the on-board voltage regulator then yes, it will be close to 5V.  If, however, you are running off USB power, it will probably be less than 5V - anything down to about 4.2V is typical (4.5V is about bottom for USB, less one diode drop).


The computed resistance for Rt is incorrect and therefor the temperatures are wrong.

So if I take a measurement of Vo on the Arduino I get:
AnalogRead Vo= 363.00  (this ranges from 360 to 384 on a regular basis, even when the temperature stays the same)
Rt= 149,090.90 ?

But if I measure with a multi-meter:
Vo= 1.190V
Rt= 239,200 ?

1. 1% tolerance on Rbottom.
2. It is 4.79V, usb powered.


I'm not sure if you're calculating right.

I would break it down into steps.

AR = analog read value.
Van = calculated analog voltage
Vref = reference voltage - 4.79V in this case
Rt = thermister resistance
Rb = bottom resistance.

Let's start with the voltage.  This is the reference voltage divided by the resolution, and multiplied by the reading.

Van = (Vref / 1024.0) * AR;

This would be 1.698017578V for a 363 reading.

Then, let's convert that into a resistance.

Rt = ((Rb * Vref) / Van) - Rb;

Which is:

Rt = ((82,000 * 4.79) / 1.698017578) - 82,000

Rt = (392,780 /  1.698017578) - 82,000

Therefore Rt = 149316.804424742?

That is correct for a Vref of 4.79V.  Of course, that is assuming that 4.79V is actually what the ADC is working with.

Ok, so it looks like that is possibly the real value and the DMM is reading it wrong?  Or maybe the act of measuring it is changing the value (Heisenberg here we come).

For more accuracy I would seriously suggest using 3.3V for the Vref and connecting the 3.3V power to the Aref pin.  Set the Arduino to use an external reference voltage for the ADC, and you will be using regulated (and almost guaranteed) 3.3V reference.  Also, there will be less current flowing through your divider and so less self-heating will be going on.


The original formula from the PDF file is of the form:
Rt = R * ( Vs / Vo - 1 )

where Vs is the supply voltage at the top of the divider.

So, your formula
Rt = R * ( 1023.0 / (float) Vo - 1.0 )

can't be correct because you've dropped the Vs term.

Don't send me technical questions via Private Message.


Jan 18, 2012, 05:11 am Last Edit: Jan 18, 2012, 07:03 pm by znorris Reason: 1
Thank you both for your help. It's now working and accurate within a couple of degrees.

1. I changed the input voltage from 5V to 3.3V
2. Changed my equations to actually find the thermistors resistance value. This was done by being more precise with my constants and ensuring they matched my actual circuit. I also changed the equation itself. I was very close in one of my iterations but I got my analog reference to voltage equation wrong.

Things that may still be effecting the accuracy?
1. The thermistor is self heating due to the voltage I am constantly passing through it. I read somewhere that they only powered the circuit when they wanted to take a reading and it helped them a lot with this issue. Not entirely sure how I should go about this, perhaps a relay?
2.  Reference voltage isn't precise. Do as Majenko said and utilize the Aref pin.
3.  I should be able to isolate this inaccuracy by using a multi-meter to determine the actual resistance of the thermistor. Then compare this to the resistance I've calculated before I send it to the Steinhart-Hart equation.

It's exciting to do build this. This is the first time I've built anything with the arduino and I've yet to make it through my C or C++ books because I get tired of doing silly math for what I perceive as no reason. Now that I can see it and have a useful application for it I think I'll get that C++ book out again. Thanks again!


we have come up with the following Steinhart-Hart coefficients: A= -1.531358897e-3, B= 4.353291903e-4, C= -2.488687432e-7.

Which values did you plug into that calculator? I don't get anything like those coefficients.

Don't send me technical questions via Private Message.


I can't remember off the top of my head so I just updated them, running them through the calculator twice to double check. Neither of the sensors are the same anymore so I'm not entirely sure what I did the first go around.

Food Thermistor Readings:
R1: 574000   T1: 0
R2: 101600   T2: 48.888
R3: 18930     T3: 104.444

Food Thermistor Coefficients:
A = 0.9780590270E-3
B = 1.293359989E-4
C = 4.151038283E-7

Smoke Thermistor Readings:
R1: 595000   T1: 0
R2: 92900     T2: 48.888
R3: 19130     T3: 104.444

Smoke Thermistor Coefficients:
A = 0.003269196438E-3
B = 2.599827832E-4
C = 0.8546857283E-7

Utilizing the new food thermistor coefficients I did a quick measure of two liquids.
First liquid is 61F and it measures from 59.68 - 62.23.
Second liquid is 106F and it measures from 109.55 - 111.42.

How will Rbottom of the voltage divider effect everything? As long as the value is correct in my equation does it matter what the value is? I mean, I'm very certain it does effect things but I haven't quite figured out how.


The PDF where most of your work came from says:
For any specific thermistor you will need a fixed resistor [i.e. Rbottom] of nominally equal resistance.

So, you need to know the nominal resistance of the thermistor(s) you are using and then use a resistor of roughly equal value.

Don't send me technical questions via Private Message.


Yes, unfortunately we are using pre-made temperature probes that do not tell us the nominal resistance. From my readings most thermistors are measured at 25C for nominal resistance. I've utilized this for my circuit and code. This makes for a theoretical 228,617 ? on Rbottom. I've got 228,514 ? in the circuit and in the code. Double checked by a multi-meter.

I don't see much of a difference. I see that the higher my temp the less accurate the reading, or so it appears without graphing it out. May need to re-create my measurement table again.

Go Up