Here is a simple example of how to read temperature using Mica 2 Sensing
board and display the most significant three bit on led.
Go to the folder /opt/tinyos-1,x/apps/SenseToLeds
Open the file file SenseToLeds.nc.
It should look like as shown below.
configuration SenseToLeds {}
implementation
{
components Main, SenseToInt, IntToLeds, TimerC, Photo;
Main.StdControl -> SenseToInt;
Main.StdControl -> IntToLeds;
SenseToInt.Timer -> TimerC.Timer[unique("Timer")];
SenseToInt.TimerControl -> TimerC;
SenseToInt.ADC -> Photo;
SenseToInt.ADCControl -> Photo;
SenseToInt.IntOutput -> IntToLeds;
}
Replace all Photo Component with Temp (The bold phase words need to be
replaced)
The code will look like
configuration SenseToLeds {}
implementation
{
components Main, SenseToInt, IntToLeds, TimerC, Temp;
Main.StdControl -> SenseToInt;
Main.StdControl -> IntToLeds;
SenseToInt.Timer -> TimerC.Timer[unique("Timer")];
SenseToInt.TimerControl -> TimerC;
SenseToInt.ADC -> Temp;
SenseToInt.ADCControl -> Temp;
SenseToInt.IntOutput -> IntToLeds;
}
Save the file
Further go to the folder
/opt/tinyos-1.x/tos/sensorboard/<your sensor board>/
Open sensorboard.h file
edit the line
TOSH_ALIAS_PIN(TEMP_CTL, INT2); to the following one
TOSH_ALIAS_PIN(TEMP_CTL, PW0); and Save it
After Compilation SenseToLeds program will monitor the temperature and three
MSBs of the ADC output will be displayed on the LEDs with LSB on Yellow and
MSB on Red.
We have used MIB510 Serial port programmer, MPR2400 Mote processor and
MTS310 Sensor Data Acquisition board.
Thanks to Yong, Chee Yeew" <[EMAIL PROTECTED]> for providing a
solution.
-San
On 1/29/08, G. Santhosh Kumar <[EMAIL PROTECTED]> wrote:
>
> Hi all
>
> Recently I did some programming through NesC in few crossbow MICA MOTE
> for monitoring the Light. The core program used was SenseToLed.nc in the
> apps folder as shown below
>
> configuration SenseToLeds {}
>
> implementation{
>
> components Main, SenseToInt, IntToLeds, TimerC, Photo;
>
> Main.StdControl -> SenseToInt;
>
> Main.StdControl -> IntToLeds;
>
> SenseToInt.Timer -> TimerC.Timer[unique("Timer")];
>
> SenseToInt.TimerControl -> TimerC;
>
> SenseToInt.ADC -> Photo;
>
> SenseToInt.ADCControl -> Photo;
>
> SenseToInt.IntOutput -> IntToLeds;
>
> }
>
> This works well and I could able to modify this program to communicate
> the reading over RF to a base station and further through serial port to PC.
> The Same Code I modified for temperature monitoring as shown below, But I
> always getting the 10 bit information readout of ADC as Zero.(In case of
> Photo I could able to get real values and keeps changing when the sensor
> board exposed to alternatively to dark and light)
>
> configuration SenseToLeds {}
>
> implementation
>
> {
>
> components Main, SenseToInt, IntToLeds, TimerC, Temp;
>
> Main.StdControl -> SenseToInt;
>
> Main.StdControl -> IntToLeds;
>
> SenseToInt.Timer -> TimerC.Timer[unique("Timer")];
>
> SenseToInt.TimerControl -> TimerC;
>
> SenseToInt.ADC -> Temp;
>
> SenseToInt.ADCControl -> Temp;
>
> SenseToInt.IntOutput -> IntToLeds;
>
> }
>
> I am using MIB510 Serial port programmer, MPR2400 Mote processor and
> MTS310 Sensor Data Acquisition board. The MTS310 I have carries both Photo
> Sensor and Temperature Sensor.
>
> If some one can help to sort the temperature monitoring problem.
>
> Thanks in advance,
>
>
> --
> G. Santhosh Kumar
> Lecturer
> Dept. of Computer Science
> Cochin University of Science & Technology
> Cochin - 682 022
> +914842577126 (ext 306) | Tel (Off)
> +914842212221 | Tel (home)
--
G. Santhosh Kumar
Lecturer
Dept. of Computer Science
Cochin University of Science & Technology
Cochin - 682 022
+914842577126 (ext 306) | Tel (Off)
+914842212221 | Tel (home)
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help