[Tinyos-help] Problem reading the temperature byte in TinyOS packet

Shuvo Debnath Shuvo.Debnath at student.uts.edu.au
Sat Jun 2 09:05:34 PDT 2007


Hello, 

I am using a mica2 mote and MTS310CA sensor running XServe, and am trying to read in the temperature byte.  I have read all the documentation, and using Java, my function that converts a raw byte -> temperature works 100%, I tested this thouroughly. However I am having trouble actually getting the correct raw byte.  When I read in the documented byte (18th in packet) I should be getting a value between 110-130 to correspond to room temperature (19-23 degrees C).  

However, instead I get very small numbers: Such as 2 or -13 depending on which sensor I read (I have multiple MTS310).   I tried running the sensors against MoteView and the results are all accurate, so it is not a hardware issue. 

I suspect this is a Java issue but I am not sure. Does anyone have any suggestions? I need to get problem solved fairly quickly due to a very imminent deadline!  

If it helps, I am reading the packet by simply doing a:

byte[] packet= reader.readPacket();
if(packet.length==32)
System.out.println("For Node:" + packet[7] + "RawTemperatureReading=" + packet[18]);

A logical AND between the raw byte and 0xFF gives more extreme results (250+ on one sensor and < 10 on others). 

Thankyou in advance,
Shuvo




More information about the Tinyos-help mailing list