This experiment is not conducted in avrora or any emulator.
Mote used- Micaz- CC2420 Radio (Zig-Bee compliant) : The range was much better than Telosb. It gave 21metres compared to 8 metres in telosb.
Following image shows Micaz mounted with MTS310 sensor board
Sensor Board- MTS310 ( light, temp, acoustic,acoustic actuator, seismic, magnetometer sensors)
Programming board- MIB520CB USB/JTAG
The first program came to my mind was to make buzzer on. After searching for the platform files, in mts300 board folder (/opt/tinyos-2.1.0/tos/sensorboards) I found Sounder file.
The application I wrote has 2 files BuzzerC and BuzzerP
BuzzerC
configuration BuzzerC {
}
implementation {
components MainC, BuzzerP, LedsC,SounderC ,new TimerMilliC() as MyTimer;;
MainC.Boot <- BuzzerP;
BuzzerP.Mts300Sounder -> SounderC;
BuzzerP.Leds -> LedsC;
BuzzerP.Beep -> MyTimer;
}
BuzzerP
module BuzzerP
{
uses
{
interface Boot;
interface Mts300Sounder;
interface Timer
interface Leds;
}
}
implementation
{
uint8_t count=0;
event void Boot.booted()
{
call Beep.startPeriodic(500);
}
event void Beep.fired()
{
count++;
if((count==2))
{
call Leds.led0Toggle();
call Leds.led1Toggle();
call Leds.led2Toggle();
count=0;
call Mts300Sounder.beep(10);
}
}
}
The code is self explanatory....
Following was the error came while compiling
"Programmer is not responding"
This is because MIB520 has 2 usb ports. One used for programming and other for data.
The "motelist" command will not list any mote connected to MIB520. Instead you have to go to system log and check for the two usb ports activated after pluging in the board. Assuming that first one is usb0 and second one is usb1, the syntax for uploading a new program is "make micaz reinstall.2 mib510,/dev/ttyUSB0" where 2 is the node id
Now you can test the "Antitheft" application which worked fine after giving /dev/ttyUSB1:micaz for serialforwarder