Documente Academic
Documente Profesional
Documente Cultură
Gautam Ankala
Jessica Curry
Joseph Roberson
Submitted
9 December 2008
Executive Summary..........................................................................................................iii
1. Introduction..................................................................................................................1
3. Technical Specification................................................................................................5
6. Project Demonstration...............................................................................................12
8. Summary.....................................................................................................................17
9. References...................................................................................................................18
Appendix A......................................................................................................................19
Appendix B......................................................................................................................22
Appendix C......................................................................................................................24
Appendix D......................................................................................................................30
Wireless sensor networks contain small devices equipped with components for
sensing, calculating, and wireless transfer. The Heat Sensor team designed a wireless
sensor network that could be used to detect hazardous thermal activity in buildings and
specifically, environmental areas such as forests. The design was implemented using the
TinyOS operating system. A java based software call Moteview was used to display the
temperature readings on a computer and the sensors were programmed using the nesC
The sensors were programmed with an algorithm that enabled the design to
implement an energy proficient network. Crossbow’s MICAz wireless sensors were used
to take data readings and the data was transferred to a computer by use of its wireless
capabilities. A prototype network was designed to show that wireless sensors could
detect hazardous temperatures, based on the varying applications, and wirelessly transfer
measurements and a personal computer to display the readings. The heat sensor system
can be provided for a total cost of $2500.00. Since each sensor has an outdoor range of
75 to 100 meters, each unit was capable of monitoring an area up to 10,000 square
meters. The heat sensing network provided reliable detection of fires and real-time
1. INTRODUCTION
Wireless sensor networks are designed for minimal power consumption, low cost,
and small volume. The sensors are small devices equipped with components for sensing,
calculating, and wireless transfer [1]. Used in devices such as thermometers, motion
detectors, and vehicle tracking systems, sensors have become a rapidly developing area in
both research and application. The team used Crossbow’s MICAz wireless sensors to
take temperature readings and transfer the data to a computer by use of its wireless
capabilities. The prototype network consisted of four MICAz sensors for temperature
measurements and a personal computer to display the readings. The design was
implemented using the TinyOS operating system. A java based software call Moteview
was used to display the temperature readings on a computer and the sensors were
programmed using the nesC language. The dimensions of each MICAz mote were 56
1.1 Objective
The Heat Sensor team designed a wireless sensor network that could be used to
square meters. The MICAz motes were adapted with heat sensors and programmed with
an energy efficient algorithm to monitor for possible fires. Sensor data was wirelessly
transmitted through the network and received at personal computer acting as a base
station. The design was a resource for wildlife services and forest agencies as well as
owners of large estates of lands who want to protect their land from possible fires.
is essential for a network to sustain itself for longer periods of time. Incorporating an
energy efficient algorithm in the design reduced power consumption and reduced
maintenance costs due to unwanted shorter network lifetimes [2]. The design team used
individual sensors and route the ciphered data to the base station.
1.3 Background
Energy aware routing algorithms are used to increase the energy efficiency of
wireless sensor networks. Today, two common kinds of energy aware routing algorithms
are being researched and implemented in wireless networks. The first type is known as
into clusters and randomly rotates the base station inside the cluster to evenly distribute
the workload. LEACH elongates the lifetime of a wireless network twice as long as the
The second type is the S-MAC, which is a routing protocol that focuses on saving
energy in the network but does not respond very well to the adaptation of network traffic
[1]. This protocol adjusts the operation cycle of sensors based on the amount of action in
the network. When a sensor is in an idle state, the protocol places the sensor in a sleep
cycle is low and the transfer rate is high, the entire network is restricted [1].
Energy Supply (GREES). This routing algorithm takes into account the realistic wireless
channel condition, such as random noise and fading, in addition to residual energy and
energy supply conditions of the individual nodes in the network [2]. Since the design
team’s network based its routing decision on heat sensing conditions of the individual
nodes, the algorithm used in the group’s wireless network was similar to the LEACH
algorithm.
The Heat Sensor team designed a prototype of a thermal detecting wireless sensor
network. The wireless sensors were programmed with an energy efficient routing
algorithm for data transmission and proper detection of high temperatures based on the
application. The wireless network consisted of three intermediate nodes, each equipped
with light sensors, and one transceiver node. The intermediate and transceiver nodes can
be visualized by the four sensors shown in Figure 1. A computer was used as the base
station for the wireless network, in which all data measurements were displayed for the
user. Each intermediate node in the network had the following functionality:
All communication between the base station and the wireless sensors in the
network were conducted through the transceiver node. The transceiver sensor,
represented by Sensor 4 in Figure 1, received the measurements and requests from the
intermediate sensors and base station, respectively. This sensor also transmitted all
measurements to the base station and communicated with the other wireless sensors. The
base station periodically requested that each node in the network take a reading using the
on board light sensors via the transceiver node. Once each node had taken the reading
and routed the measurements back to the transceiver node, the data was wirelessly sent to
the base station for proper analysis. The block diagram in Figure 1 shows the complete
wireless network communication between each sensor and the base station. If any sensor
had detected an activity higher than a specific threshold, determined by the application of
the network, the base station was alerted of the interruption and the sensor that detected
the value. The goal of the Heat Sensor team was to create a wireless network able to
detect thermal activity using an energy efficient algorithm and wireless devices equipped
3. TECHNICAL SPECIFICATIONS
The prototype presented in this project involved a cluster head which was a
transceiver node, and three intermediate nodes equipped with light sensors. The overall
are shown in Table 1 [2]. The MICAz's radio frequency (RF) transceiver offered a high
transmit data rate of 250 kbps in addition to a frequency band that was a globally
The three intermediate nodes are constructed by connecting each MICAz with a
Crossbow's MIB520 USB interface board. This board allowed the MICAz to
communicate with a base station, permitting data transfer from the MICAz to a computer.
The specifications for the MIB520 board are displayed in Table 3 [2]. This board
provided a USB connection cable and a 51-pin connector, allowing the computer and the
The design of the heat sensing wireless network was formed into a cluster group.
The transceiver sensor acted as a cluster head and the three intermediate nodes acted as
members of the cluster. TinyOS was the operating system used for the project. The
transceiver node, or cluster head, was connected to a computer or a base station having a
set of codes programmed in TinyOS. The wireless sensors were programmed with an
energy efficient routing algorithm for data transmission and proper detection of high
temperatures. All communication between the base station and the wireless sensors in
Transceiver
The most important feature of the transceiver or the cluster head was the routing
algorithm. The wireless sensors were programmed with an energy efficient routing
algorithm for data transmission and proper detection of high temperatures based on the
application. This algorithm was based on the information packets regarding heat intensity
that are sent every few seconds from the three intermediate nodes. Its decision only
depended on the most recent information packet received by the cluster head. However,
for demonstration purposes, all the received information packets were recorded and
stored in the computer connected to the transceiver node. The information packet
broadcasted from the intermediate nodes included a specific node identification number
in order to specify which node was sending the packet and whether the sensor at that
node was detecting heat. An example of how an information packet was structured is
shown in Figure 2 [2]. The adequate bit length of the node ID was determined according
information received from all the intermediate nodes and transmitted the data to the base
station. The hardware components of the transmitter node include a personal computer
serving as a base station, which records and stores the transmitted data, a MICAz that
serves as a cluster head, and a MIB520 board that allows the computer to communicate
with the MICAz. In addition, a set of code will be written and uploaded onto the MICAz
Intermediate Nodes
The intermediate nodes each required a MICAz and a light sensor. The code for
these three nodes were uploaded onto the MICAz through the MIB520 board, but once
uploaded, the MIB520 board was removed. As a result, the three intermediate nodes were
incapable of storing large amounts of data. Consequently, the only function of these
nodes was to transmit information packets regarding heat intensity to the cluster head. In
addition, these nodes were programmed to turn on a LED light whenever data was
transmitted through them, which allowed a clear display of the routing path. The
MTS400CB, a basic weather sensor board, was used to represent a heat sensor in this
design. It was connected to the MICAz at each intermediate node. The MICAz stored the
value was above a certain threshold, then the node was considered to have detected fire
not detected fire, and data was not transmitted. The result is then combined with the node
ID to form a single information packet. This packet is then sent to the cluster head. New
information was obtained every few seconds, and a packet was sent constantly with
newly acquired information. Values for threshold and time period between sequential
Crossbow MICAz was compliant with the IEEE 802.15.4 and ZigBee standards.
The IEEE 802.15.4 standard was for low data rate networks within a relatively small
area. The main feature of this standard was low power consumption to simulate an energy
efficient network. ZigBee was also a standard designed for low data rate and low power
consumption wireless networks. However, ZigBee set standards for the network and
application layer while IEEE 802.15.4 dealt primarily with the physical layer. The
MICAz operated with an open source operating system called TinyOS which used nesC
as the programming language. The nesC language was designed especially for wireless
embedded sensor networks and featured component based architecture to minimize code
size. TinyOS also had many component libraries containing codes that could be used.
The MIB520, which was also manufactured by Crossbow, was used to upload codes for a
routing algorithm and node transmission onto the MICAz. The MIB520 connected to a
Simplicity was the key factor of this project that allowed additional features to be
implemented and options for customizations. MICAz was a simple wireless unit without
any sensors that ran on two AA batteries. Unlike the MICAz, the Heliomote, which was
developed by the research group at University of California, Los Angeles, has built-in
sensors as well as the capability to acquire energy from the environment [2]. Such a
capability was called energy harvesting and was highly effective when incorporated in a
wireless network to increase energy efficiency. However, the Heliomotes have built-in
functionalities that are difficult or even impossible to modify. Also, the MICAz had more
documentations and experimental data on its application and was half the price of the
Heliomote. In order to keep the network as simple as possible and be easily adapted to
specific needs, the MICAz was a better choice for this project. One constraint associated
with the MICAz is that it ran on TinyOS, which was an open source operating system
that required engineers to learn the nesC programming language to be able to control the
MICAz. Nevertheless, TinyOS had many libraries including routing algorithm codes
that engineers can utilize as the basis for their projects and modify them accordingly
The Gantt charts for both the proposed and actual schedule of this project can be
found in Appendix A. Table 4 shows that the project was divided into the following
categories: Planning, Design, Development, and Testing. The italicized tasks at the
bottom of the table were considered milestones and were crucial to the project’s
design and the amount of research necessary. Weekly status meetings were held to
ensure that all members completed tasks as scheduled. The project was completed later
than the expected deadline due to unexpected difficulties that resulted from learning
6. PROJECT DEMONSTRATION
MICAz sensors were prototyped to represent a heat detecting wireless network. Three
the network. A personal computer functioned as the base station. Each heat sensor was
mounted on a MICAz board. The sensors were spaced equidistant from the cluster head.
Data was transmitted through the sensor that had the heat source applied. Once the heat
source was applied, the LED at that sensor flashed to verify data passing through the
node. Data reached the cluster head, Node D in Figure 4, and transferred the node
The following situations and corresponding results were performed in the demonstration
• No node detects the heat source; the receiver did not specify any location.
Moteview, a software tool that provides graphical interface and client application
between a user and a deployed network of wireless sensors motes, was used to display the
network topology. Figure 5 shows the network topology of the sensor network with three
The temperature readings were also demonstrated using a tabular form as shown in
Figure 6. An alert window was generated when the temperature of any sensor reached a
Currently, wildfire detection units exist on the market. The one closest to the goal
of using wireless sensors is the FireBug system, which is still in development [5]. The
FireBug system uses TinyOS to program the sensors, but there is no GPS device on
board. The sensor nodes will already have a predetermined location and in the event of a
fire, the node temperature and its corresponding location will be known. The FireBug
system uses the Crossbow MTS420CA board while the group’s project will use the
MTS400CB board. The only difference between the two boards is the GPS capability
between the boards [6]. Consumers will request varying numbers of sensors depending
upon the area necessary to be monitored. For simplicity, one unit will consist of three
sensor nodes and one transceiver node. Since each sensor has an outdoor range of 75m to
100m, each unit will be able to monitor an area up to 10 000 square meters [7].
A prototype of the heat sensor system can be provided for a total cost of
$14517.00. The equipment can be purchased for $1392.00 and total cost of labor is
$13125.00, which is shown in Table 5 and Table 6. Since TinyOS is an open source
Unit Total
Component Quantity Cost Cost
TinyOS 2.0 3 $0.00 $0.00
MICAz 2.4 GHZ 4 $99.00 $396.00
MIB520 2 $75.00 $150.00
MTS400CB 4 $210.00 $840.00
Pack of 8 AA Batteries 1 $6.00 $6.00
Total Equipment Cost $1,392.00
The three engineers working on this project each receive pay at a rate of $35.00 per hour.
Work hours for each engineer include lectures, reports, meetings, and design and testing.
Labor
Project Component Labor Hours Cost
Lectures 75 $2,625.00
Reports 90 $3,150.00
Meetings 60 $2,100.00
Design and Testing 150 $5,250.00
Total Labor 375 $13,125.00
The analysis for the development cost is shown in Table 7. Total development costs will
revenues for selling 400 units is expected to be $1,000,000.00 with profits of 10.44% that
8. SUMMARY
The group has successfully completed its project demo with its advisor. Three
temperature sensors, four MICAz boards, and two MIB520 devices have been used.
These three main components met all the specification stated in our proposal. All our
sensors were programmed in TinyOS using nesC as our language. Cygwin was initially
used to test these sensors output the temperature readings. The group then used Mote-
View, a software tool that provides graphical interface and client application between a
user and a deployed network of wireless sensors motes to display the network topology.
Programming in nesC was the primary time commitment of the development process for
our design.
[1] W. Liao and H. Wang, “An asynchronous MAC protocol for wireless sensor
networks,” J. Netw. Comput. Applicat., vol. 31, no. 4, pp. 807-820, Nov. 2008.
[2] T. To, M. Au, T. Nguyen, and M. Shinotsuka, “Light Sensing Wireless Network,”
Dept. Elect. Eng., Georgia Tech, Georgia, Proposal, Feb. 4, 2008.
http://webs.cs.berkeley.edu/tos/dist-1.1.0/tinyos/windows/tinyos-
1.1.15Dec2005cvs1.c gwin.noarch.rpm
Type following command on cygwin. The upgrade will start automatically, and it may
take up to an hour.
Program MICAz
To upload a program to MICAz, codes first need to be compiled. To do so, open cygwin
and move to the directory that contains a file to be compiled. Then type make micaz to
compile a file to be uploaded for MICAz motes. Last line of writing TOS image
signifies that a file compiled successfully.
Since TinyOS 1.1.15 does not support MIB520 programming board, command for
MIB510 will be used to upload a code. Once a file is compiled successfully, type
following command:
where <nodeID> is optional node ID that can be assigned to MICAz and <#-1> is larger
port number assigned to MIB520 minus 1.
module TOSBaseM {
provides interface StdControl;
uses {
interface StdControl as UARTControl;
interface BareSendMsg as UARTSend;
interface ReceiveMsg as UARTReceive;
interface TokenReceiveMsg as UARTTokenReceive;
interface Leds;
}
}
implementation
{
enum {
QUEUE_SIZE = 5
};
enum {
TXFLAG_BUSY = 0x1,
TXFLAG_TOKEN = 0x2
};
TOS_Msg gRxBufPool[QUEUE_SIZE];
TOS_MsgPtr gRxBufPoolTbl[QUEUE_SIZE];
uint8_t gRxHeadIndex,gRxTailIndex;
TOS_Msg gTxBuf;
TOS_MsgPtr gpTxMsg;
uint8_t gTxPendingToken;
uint8_t gfTxFlags;
if (Result != SUCCESS) {
atomic gfTxFlags = 0;
}
else {
call Leds.redToggle();
}
}
gTxBuf.length = 0;
gpTxMsg = &gTxBuf;
gfTxFlags = 0;
if (Msg->crc) {
atomic {
pBuf = gRxBufPoolTbl[gRxHeadIndex];
if (pBuf->length == 0) {
gRxBufPoolTbl[gRxHeadIndex] = Msg;
gRxHeadIndex++; gRxHeadIndex %= QUEUE_SIZE;
}
else {
pBuf = NULL;
}
}
if (pBuf) {
post RadioRcvdTask();
}
else {
pBuf = Msg;
}
}
else {
pBuf = Msg;
}
return pBuf;
}
atomic {
if (pBuf == NULL) {
pBuf = Msg;
}
else {
post UARTRcvdTask();
}
return pBuf;
atomic {
if (gfTxFlags & TXFLAG_BUSY) {
pBuf = NULL;
}
else {
pBuf = gpTxMsg;
gfTxFlags |= (TXFLAG_BUSY | TXFLAG_TOKEN);
gpTxMsg = Msg;
gTxPendingToken = Token;
}
}
if (pBuf == NULL) {
pBuf = Msg;
}
else {
post UARTRcvdTask();
}
return pBuf;
}
post SendAckTask();
}
}
else {
atomic {
gpTxMsg->length = 0;
gfTxFlags = 0;
}
}
return SUCCESS;
}
}
module TestMTS400M {
provides interface StdControl;
uses {
//communication
interface StdControl as CommControl;
interface SendMsg as Send;
interface ReceiveMsg as Receive;
#ifdef MTS420
//gps
// interface I2CSwitchCmds as GpsCmd;
interface GpsCmd;
interface StdControl as GpsControl;
// interface BareSendMsg as GpsSend;
interface ReceiveMsg as GpsReceive;
#endif
// Battery
interface ADC as ADCBATT;
interface StdControl as BattControl;
//Accels
interface StdControl as AccelControl;
interface I2CSwitchCmds as AccelCmd;
interface ADC as AccelX;
interface ADC as AccelY;
//Intersema
interface SplitControl as PressureControl;
//interface StdControl as PressureControl;
interface ADC as IntersemaTemp;
interface ADC as IntersemaPressure;
interface Calibration as IntersemaCal;
//Sensirion
interface SplitControl as TempHumControl;
interface ADC as Humidity;
interface ADC as Temperature;
interface ADCError as HumidityError;
interface ADCError as TemperatureError;
//Taos
interface SplitControl as TaosControl;
interface ADC as TaosCh0;
interface ADC as TaosCh1;
interface Timer;
interface Leds;
}
implementation
{
SENSOR_HUMIDITY_START = 20,
SENSOR_HUMIDITY_GETHUMDATA = 21,
SENSOR_HUMIDITY_GETTEMPDATA = 22,
SENSOR_HUMIDITY_STOP = 23,
SENSOR_PRESSURE_START = 30,
SENSOR_PRESSURE_GETCAL = 31,
SENSOR_PRESSURE_GETPRESSDATA = 32,
SENSOR_PRESSURE_GETTEMPDATA = 33,
SENSOR_PRESSURE_STOP = 34,
SENSOR_LIGHT_START = 40,
SENSOR_LIGHT_GETCH0DATA = 41,
SENSOR_LIGHT_GETCH1DATA = 42,
SENSOR_LIGHT_STOP = 43,
SENSOR_ACCEL_START = 50,
SENSOR_ACCEL_GETXDATA = 51,
SENSOR_ACCEL_GETYDATA = 52,
SENSOR_ACCEL_STOP = 53
};
char count;
TOS_Msg msg_buf;
TOS_MsgPtr msg_ptr;
bool sending_packet, WaitingForSend, IsUART;
XDataMsg *pack;
norace uint8_t iNextPacketID;
/
***********************************************************************
*****
* Task to send uart and rf message
**********************************************************************
******/
task void send_msg(){
if (sending_packet) return;
atomic sending_packet = TRUE;
pack->xSensorHeader.board_id = SENSOR_BOARD_ID;
pack->xSensorHeader.packet_id = iNextPacketID;
pack->xSensorHeader.node_id = TOS_LOCAL_ADDRESS;
// pack->xSensorHeader.rsvd = 0;
call Leds.yellowOn();
if (IsUART) {
if(call Send.send(TOS_UART_ADDR,sizeof(XDataMsg)-
1,msg_ptr)!=SUCCESS)
{
atomic sending_packet = FALSE;
call Leds.greenToggle();
}
}
else {
if(call Send.send(TOS_BCAST_ADDR,sizeof(XDataMsg)-
1,msg_ptr)!=SUCCESS)
{
atomic sending_packet = FALSE;
call Leds.greenToggle();
}
}
return;
}
atomic {
msg_ptr = &msg_buf;
gps_pwr_on = FALSE;
sending_packet = FALSE;
WaitingForSend = FALSE;
}
pack = (XDataMsg *)msg_ptr->data;
call BattControl.init();
call CommControl.init();
call Leds.init();
call Leds.greenOn();
#ifdef MTS420
call GpsControl.init();
#endif
call TaosControl.init();
call AccelControl.init(); //initialize accelerometer
call TempHumControl.init(); //init Sensirion
call PressureControl.init(); // init Intersema
return SUCCESS;
}
call CommControl.start();
call BattControl.start();
#ifdef MTS420
call GpsControl.start();
#endif
return SUCCESS;
}
/
***********************************************************************
*******
* Timer fired, test GPS, humidity/temp
* async for test only
* If gps_wait_cnt > 0 then gps is active, waiting for a packet
**********************************************************************
*******/
event result_t Timer.fired() {
uint8_t l_state;
call Leds.redToggle();
#ifdef MTS420
if (!gps_pwr_on){
//turn on GPS power, stays on for entire test
return call GpsCmd.PowerSwitch(1);
return SUCCESS;
}
#endif
if (WaitingForSend){
/*
* The GPS modules DC-DC booster can interfere with radio
communication.
* If the GPS module must be continually powered and monitored during
radio
* communication, then 3.3-3.6 volt lithium batteries are recommended
to
* power the mote. Normal alkaline batteries are not recommended unless
* the GPS module is powered down during radio communication.
*
* If GPS module is to be powered down during radio communication,
* uncomment following GpsCmd.PowerSwitch(0) line
switch(l_state) {
case START:
#if FEATURE_GPS_ONLY
call Leds.greenOff();
#ifdef MTS420
atomic state = GPS_BUSY;
return call GpsCmd.TxRxSwitch(1); //enable gps tx/rx
#else
atomic state = START;
return SUCCESS;
#endif
#else
atomic{
state = BUSY;
sensor_state = SENSOR_BATT_START;
}
call Leds.greenToggle();
return call ADCBATT.getData(); //get vref data;
#endif
break;
case BATT_DONE:
atomic{
state = BUSY;
sensor_state = SENSOR_HUMIDITY_START;
}
return call TempHumControl.start();
case HUMIDITY_DONE:
atomic {
state = BUSY;
sensor_state = SENSOR_PRESSURE_START;
}
return call PressureControl.start();
case PRESSURE_DONE:
atomic {
state = BUSY;
sensor_state = SENSOR_LIGHT_START;
}
return call TaosControl.start();
case LIGHT_DONE:
atomic {
case ACCEL_DONE:
call Leds.greenOff();
#ifdef MTS420
atomic state = GPS_BUSY;
return call GpsCmd.TxRxSwitch(1); //enable gps tx/rx
#else
atomic state = START;
return SUCCESS;
#endif
break;
#ifdef MTS420
case GPS_BUSY:
if (gps_wait_cnt >= GPS_MAX_WAIT)
{ // gps rcvd pkt before time out?
call GpsCmd.TxRxSwitch(0); // no,disable gps tx/rx
switches
atomic state = START;
return SUCCESS;
}
else {
gps_wait_cnt++; //keep waiting for gps pkt
return SUCCESS;
}
break;
case GPS_DONE:
atomic state = START;
return SUCCESS;
break;
#endif
}
return SUCCESS;
}
#ifdef MTS420
event TOS_MsgPtr GpsReceive.receive(TOS_MsgPtr data) {
uint8_t i,j,m,length,NS,EW;
uint16_t k;
uint32_t temp;
bool end_of_field;
char *packet_format;
char *pdata;
float dec_secs,dec_min;
// if gps have been scaned then stop receiving gps uart packet
if (state == GPS_DONE) return data;
// uint8_t
pack->xData.dataGps.fixed=(uint8_t)(gga_fields[6][0]-'0'); //
invalid
// uint32_t
// gga_msg.dec_sec = call extract_dec_sec(gga_fields[1]);
dec_secs = 10*(pdata[4]-'0') + (pdata[5]-'0') +
0.1*(pdata[7]-'0')
+ 0.01*(pdata[8]-'0')
+ 0.001*(pdata[9]-'0');
temp = (uint32_t)(dec_secs * 1000);
pack->xData.dataGps.dec_sec = temp;
// gga_msg.Long_dec_min = call
extract_Long_dec_min(gga_fields[4]);
dec_min = 10*(pdata[3]-'0') + (pdata[4]-'0') +
0.1*(pdata[6]-'0')
+ 0.01*(pdata[7]-'0') + 0.001*(pdata[8]-'0') +
0.0001*(pdata[9]-'0');
temp = (uint32_t)(dec_min * 10000);
pack->xData.dataGps.long_dec_min= temp;
NS = (gga_fields[3][0] == 'N') ? 1 : 0;
EW = (gga_fields[5][0] == 'W') ? 1 : 0;
pack->xData.dataGps.nsewind= EW | (NS<<4); // eg. Status=
000N000E = 00010000
return data;
}
#endif
/
***********************************************************************
*****
* Battery Ref or thermistor data ready
**********************************************************************
******/
async event result_t ADCBATT.dataReady(uint16_t data) {
pack->xData.data1.vref = data ;
atomic state = BATT_DONE;
return SUCCESS;
}
/*********************************************************************
********
* Intersema MS5534A barometric pressure/temperature sensor
* - 6 cal coefficients (C1..C6) are extracted from 4,16 bit,words
from sensor
* - Temperature measurement:
* UT1=8*C5+20224
* dT=data-UT1
* Temp=(degC x10)=200+dT(C6+50)/1024
* - Pressure measurement:
* OFF=C2*4 + ((C4-512)*dT)/1024
* SENS=C1+(C3*dT)/1024 + 24576
* X=(SENS*(PressureData-7168))/16384 - OFF
* Press(mbar)= X/32+250
**********************************************************************
******/
async event result_t IntersemaPressure.dataReady(uint16_t data) {
pack->xData.data1.pressure = data ;
atomic atomic sensor_state = SENSOR_PRESSURE_GETTEMPDATA;
return call IntersemaTemp.getData();
}
calibration[word-1] = value;
return SUCCESS;
}
/
***********************************************************************
*******
* Sensirion SHT11 humidity/temperature sensor
* - Humidity data is 12 bit:
* Linear calc (no temp correction)
* fRH = -4.0 + 0.0405 * data -0.0000028 * data^2 'RH linear
* With temperature correction:
* fRH = (fTemp - 25) * (0.01 + 0.00008 * data) + fRH 'RH
true
* - Temperature data is 14 bit
* Temp(degC) = -38.4 + 0.0098 * data
**********************************************************************
*******/
async event result_t Temperature.dataReady(uint16_t data) {
}//async
/
***********************************************************************
*******
* Taos- tsl2250 light sensor
* Two ADC channels:
* ADC Count Value (ACNTx) = INT(16.5*[CV-1]) +S*CV
* where CV = 2^^C
* C = (data & 0x7) >> 4
* S = data & 0xF
* Light level (lux) = ACNT0*0.46*(e^^-3.13*R)
* R = ACNT1/ACNT0
**********************************************************************
*******/
async event result_t TaosCh1.dataReady(uint16_t data) {
/***************************************************/
async event result_t AccelX.dataReady(uint16_t data) {
pack->xData.data1.accel_x = data;
atomic sensor_state = SENSOR_ACCEL_GETYDATA;
call AccelY.getData();
return SUCCESS;
}
/***************************************************/
event result_t AccelCmd.SwitchesSet(uint8_t PowerState) {
// power on/off
if (PowerState){
call AccelX.getData(); //start measuring X accel
axis
atomic sensor_state = SENSOR_ACCEL_GETXDATA;
}
else{
atomic state = ACCEL_DONE;
iNextPacketID = 1; // issue 1st sensors packet xmit
atomic WaitingForSend = TRUE;
}
return SUCCESS;
}
call Leds.yellowOff();
if(IsUART){
msg_ptr = msg;
return SUCCESS;
}