[Tinyos-help] About Temperature
Yanchuan Li
dreamramon at hotmail.com
Wed May 14 14:13:28 PDT 2008
Anyone knows how to convert a ADC reading into real Degrees for temperature?
On the Manual, it's said like following:
The mote’s ADC output can be converted to degrees Kelvin using the following approximation over 0-50 °C: 1/T(K) = a + b × ln(Rthr) + c × [ln(Rthr)]3
where:
Rthr = R1(ADC_FS-ADC)/ADC
a = 0.00130705
b = 0.000214381
Page 10 Doc. # 7430-0020-03 Rev. B
MTS/MDA Sensor Board User’s Manual
Wireless Sensor Networks
c = 0.000000093
R1 = 10 kΩ
ADC_FS = 1023
ADC = output value from mote’s ADC measurement.
BUT I always got readings like between 500-600. And when I using the function above, I got some really weird numbers after calculation.
double a = 0.00130705;
double b = 0.000214381;
double c = 0.000000093;
double r1 = 10;
double adc_fs = 1023;
double adc = 600;
double rthr = (r1 * (adc_fs - adc))/adc;
double temp = Math.log10(rthr);
double temp1=Math.pow(temp, 3);
double temp3=a+b*temp+c*temp1;
System.out.println(1/temp3);
RESULT: 671.6176617203942
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20080514/84c211ff/attachment.htm
More information about the Tinyos-help
mailing list