NTC Thermistor circuit, ADC conversion, compute temperature

Here's the schematics of my NTC - ADC circuit,

Vin = 5V

Someone can explain me how i get RT, the value of resistance of NTC from ADC value? thanks.

I'm using the voltage divider formula:

Vout = ADCVCC * ADC_value / 1024
BETA = 3950
R25 = 4700
RT = 10K / (Vin - Vout - 1)
T = (1 / (1/298.16 + 1/BETA * ln(RT/R25 )) - 273.15


But I got wrong results:

the range of my temperatures are:

adc = 1    -> T = 344 °C;
adc = 1023 -> T = 8


How I have to set up the ADC in AVR? with internal voltage reference or not?

do i have wrong formula?

I need to read "exact" temperature in range of -10°C to +30°C more or less.

I've tried already with SH equation with coefficent A,B,C but i've got worst results!!!

I think I've don't understand the schematics of NTC - ADC circuits...

And set up my ATMega with wrong parameters.

Someone can try to explain me how to convert my ADC value to Resistence of thermistor with this schematics?

[EDIT]

ADMUX |= (1<<REFS0) | (1<<REFS1);


and the formula used to get Resistance from ADC value: Vin = 5V Vref = 2,56V (AREF)

Vout = adc_val * (Vref / 1024.0))
RT   = 10k / (Vin / Vout - 1.0)


This code match the schematics? Is it correct my ADC set up with those schematics? thanks in advice.

• First assumption to clear..the resistance of the NTC get's lower as it warms up So when cold NTC is at high resistance . When hot the resistance goes lower. The voltage at the thermistor will drop as temperature rises ... Is this what you want? I haven't run the calculation but your results show that you can't get the range you want... does the Beta and R25 match your NTC? They are different depending on the model numbers... And was the opamp there in case level shifting and scaling are needed? Commented Oct 19, 2013 at 23:37
• My Beta and R25 values are correct. I've taken from datasheet. I've set up ADC with internal voltage reference 2.56 V (AREF) so in AVR-C Code is: ADMUX |= (1<<REFS0) | (1<<REFS1); and the adc value, is transformed with voltage divider formula: Vref=2.56V Vin=5V Vout=(adc_val * (Vref / 1024.0)) RT= 10k / (Vin / Vout - 1.0) [I've edit my question with more info] Commented Oct 20, 2013 at 9:52

Someone can try to explain me how to convert my ADC value to Resistence of thermistor with this schematics?

Firstly, the op-amp circuit is doing very little other than adding a small error. If it had gain, you could argue it had a benefit.

Secondly, this circuit benefits from using the supply voltage as its analogue reference because then you remove another error term that being the variable difference between supply voltage on R1 and the reference voltage of the ADC.

So then, the value of the ADC represents the ratio $\dfrac{thermistor \space resistance}{thermistor\space resistance + 10k\Omega}$

Can you take it from here?

• I suppose the op-amp circuit is thought as a "noise filter" to take better results. But I'm not sure. I don't know the decision for that... :) for equation you suggest, i've edit my question with more info. but is the voltage divider formula right? Vin/Vout = R1/(R1+R2) Commented Oct 20, 2013 at 10:06
• if R1 is the thermistor and R2 is the resistor feeding it from the supply that's the formula for the voltage across the thermistor relative to the supply but, if your ADC uses supply as its reference then the formula is the ADC value divided by 1024. Commented Oct 20, 2013 at 12:42

I ran your code in Python and got 285 for adc_val = 1 and -84 for adc_val = 1023. With an adc_val of 318, I get 25.9. RT at that point is 4504. So it looks like your equations should be right. Are you sure it is being implemented correctly in terms of types? It has to be all floating point. If something is being cast to an integer or something, you could get some strange results.

>>> BETA = 3950
>>> R25 = 4700
>>> Vin = 5
>>> Vref = 5
>>> Vout = adc_val * (Vref / 1024.0)
>>> RT   = 10000 / (Vin / Vout - 1.0)
>>> T = (1 / (1/298.16 + 1/BETA * log(RT/R25 ))) - 273.15
>>> T
285.3553121325664
>>> Vout = adc_val * (Vref / 1024.0)
>>> RT   = 10000 / (Vin / Vout - 1.0)
>>> T = (1 / (1/298.16 + 1/BETA * log(RT/R25 ))) - 273.15
>>> T
-84.45667531777428