[AVR-Chat] Temperature measurement on STK502
2008-01-14 by I B
Hello Everyone,
I am trying to measure the temperature on STK502 on
Atmega169P. I have followed the diagrams and I believe
the connections are right, but I am getting the wrong
results! The function I am using to do the
calculations is:
float Temp_calculation(int ADC_value)
{
float V_ADC;
float Temperature;
char oper;
if((ADMUX & 0x1F) == SingleEnded) // check
if Single_ended operation
V_ADC = (ADC_value * V_ref)/1024; //
calculate the voltage over the NTC
else if((ADMUX & 0x1F) == Differential) // check
if Differential operation
V_ADC = (ADC_value * V_ref)/512; //
calculate the voltage over the NTC
Temperature = (Beta /
(((log(V_ADC/(V_ref-V_ADC))/log(__E)) +
(Beta/T_amb)))) - T_zero; // calculate the
temperature
return Temperature;
}
where V_ref 1.263 voltage-reference
Beta (3450.000) // the Beta-value for
the NTC transitor
R_th (10000.00) // the thermistor
resistance @ 25 degree Celsius
T_amb (298.0000) // the temperature in
Kelvin for 25 degree Celsius
T_zero (273.0000) // the temperature in
Kelvin for 0 degree Celsius
log(__E) (2.303)
This is the formula given in the manual, so I am not
sure why this is not working! Please let me know what
formula you may have used in your code.
Thanks,
Irene
____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping