Hi
I am powering telosb with 3.3 V energy harvesting system made by me. I have
made a radio program which read temperature sensor from telosb board every
10sec and send it to the base station. After sending data i have powered
off radio and turn on back after 10sec by the use of timer. This program
working fine but power consumption of sleep mode is high 110uA. I have read
about lowpower sensing tutorial of tinyos but i did not find solution. You
can find my program below.
#include "SensorToRadio.h"
//#include "printf.h"
module SensorToRadioC {
uses {
interface Boot;
interface Leds;
interface Timer<TMilli>;
//Sensor
interface Read<uint16_t> as temperatureRead;
// Radio
interface Packet;
interface AMPacket;
interface AMSend;
interface SplitControl as AMControl;
//interface LowPowerListening as LPL;
//interface I2CPacke<TI2CExtdAddr>;
// interface Receive;
}
}
implementation
{
uint16_t centigrade;
bool _radioBusy = FALSE;
message_t _packet;
event void Boot.booted()
{
//call Timer.startPeriodic(1000);
call Timer.startOneShot(10000);
// call LPL.setRemoteWakeupInterval(&_packet, 0);
}
event void Timer.fired() {
//I2C_START;
//
//call LPL.setLocalWakeupInterval(1000);
call AMControl.start();
}
event void AMControl.startDone(error_t error)
{
if (error == SUCCESS)
{
//call Leds.led0On();
call temperatureRead.read();
}
else
{
// call AMControl.start();
}
}
event void temperatureRead.readDone( error_t result, uint16_t val )
{
if (result == SUCCESS){
// read from temperature sensor
if ( _radioBusy == FALSE)
{
//creating packet
MoteToMoteMsg_t* msg = call Packet.getPayload(& _packet,
sizeof(MoteToMoteMsg_t));
msg ->NodeID = TOS_NODE_ID;
msg ->Data = (uint16_t) val;
//sending packet
if (call AMSend.send(AM_BROADCAST_ADDR,
&_packet, sizeof(MoteToMoteMsg_t)) == SUCCESS)
// if (call AMSend.send(AM_BROADCAST_ADDR,& _packet,
sizeof(MoteToMoteMsg_t) == SUCCESS)
{
_radioBusy = TRUE;
}
}
}}
event void AMSend.sendDone(message_t* msg, error_t error)
{
////stop
call AMControl.stop();
//I2C_STOP;
if (msg == &_packet)
{
_radioBusy = FALSE;
}
}
event void AMControl.stopDone(error_t error)
{
call Timer.startOneShot(10000);
}
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help