I have similar problems, but i got a value which is some celsius degree above 
the real temperature. My code is:
 
System.out.println("ADC Value " + average);

final double a = 0.00130705;

final double b = 0.000214381;

final double c = 0.000000093;

double Rthr = ( 10000.0 * (1023.0 - average )) / (double)average;

System.out.println("Rthr " + Rthr);

double logRthr = Math.log(Rthr);

double inverseKelvinTemp = a + b * logRthr + c * (logRthr * logRthr * logRthr);

System.out.println("Inverse Kelvin " + inverseKelvinTemp);

double celsiusTemp = 1.0 / inverseKelvinTemp - 273.15;

 
when the temperature is around 20 or 22 celsius degrees i got 29 or 30 celsius 
degrees.
 
>From the MTS and MDA manual i see that the constants are different among 
>different sensor board. I use the XBow MTS310CA sensor board 
 
Mario

________________________________

Da: [EMAIL PROTECTED] per conto di Yanchuan Li
Inviato: mer 14/05/2008 23.13
A: tinyos-help@millennium.berkeley.edu
Oggetto: [Tinyos-help] About Temperature


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
--
The information transmitted is intended for the person or entity to which it is 
addressed and may contain confidential and/or privileged material. Any review, 
retransmission, dissemination or other use of, or taking of any action in 
reliance upon, this information by persons or entities other than the intended 
recipient is prohibited. If you received this in error, please contact the 
sender and delete the material from any computer.

_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to