Since searching never seems to answer many of the questions I have with poorly documented TinyOS, I am going to post solutions to irritating problems so others can use them. Most of the time, I’ll do a search for a particular problem and notice many TinyOS mailing list posts with the same question, but no answer. It is obvious that many people out there know how to solve some of this stuff, but they aren’t willing to contribute. Those who know the answer act as though they are in a “secret club” and don’t want you to know. Those who try to give an explanation spit out some obtuse response or just cite a paper instead of explaining the answer intelligibly in their own words.
My current project involves reading sensor data using Crossbow Iris motes and Crossbow MTS310 sensor boards. I was able to get accelerometer and light data using the AccelXC(), AccelYC(), and PhotoC() interfaces without any problems. Another issue entirely is how to convert the uint16_t raw data readings to meaningful information (force, degrees, etc), but I digress.
Upon trying to use the TempC() interface, each call to Read() was returning “0″ as raw data. Searching the TinyOS mailing lists revealed many others were having the same problem reading temperature from the MTS310, but of course, those in the “answer club” didn’t want those of us who didn’t understand to join them. Now, I think I’ve figured out how to fix this, but until I can convert the data correctly, I won’t be sure.
Perusing the $TOSDIR/tos/sensorboards/ TinyOS directory, there is a folder for the MTS300 sensorboard drivers. There isn’t anything specific for the MTS310, but compiling and running with everything but the temperature sensor works fine. Looking at the Crossbow Sensor Board User’s Guide, the section for the MTS300/310 says that the temperature and light sensors use the same power control, so only one can be used at a time. However, this didn’t seem to be the problem because the PhotoC() and TempC() interfaces use some kind of blocking mechanism so that both can be used.
Instead, I noticed in the manual that the power controls for the temperature sensor are different on some MTS310 sensorboards. So, according to the manual, I opened the file $TOSDIR/tos/sensorboards/mts300/PhotoTempDeviceC.nc and changed the line:
TempControl.Power -> MicaBusC.Int2;
to:
TempControl.Power -> MicaBusC.PW0;
I recompiled and installed onto the mote, and now the raw data returned is nonzero. Of course, this data makes no sense to me, but that’s the next problem to tackle.
#1 by Dimi on April 30, 2009 - 11:00 am
THANK YOU!!
#2 by He Zhu on January 8, 2010 - 11:33 am
Thanks man, that’s really of great help. You are my hero~!
#3 by ever on January 26, 2010 - 8:25 pm
It really helps me, I also check the MTS manual from Xbow and then did as you told. The Photo and temperature sensor works.
#4 by Alessandro on February 27, 2010 - 5:10 pm
Thanks man, that’s really of great help!!!!!