Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 47

LOCATION TRACKING SYSTEM USING MOTES

A THESIS REPORT SUBMITTED TO


SCHOOL OF ELECTRICAL AND INFORMATION ENGINEERING
IN PARTIAL FULFILLMENT OF THE
MASTERS OF ENGINEERING IN TELECOMMUNICATION

By
Chintankumar Prakashbhai Shah
Student Number: 100056711

Under The Guidance of


Dr Aruna Jayasuriya
(Senior Research Fellow)

UNISA

INSTITUTE OF TELECOMMUNICATION RESEARCH


UNIVERSITY OF SOUTH AUSTRALIA
MAWSON LAKES CAMPUS
SOUTH AUSTRALIA

1
NOVEMBER 2009

CERTIFICATE

This is to certify that the thesis report entitled Location Tracking System Using Motes is a

bonafide record of independent research work done by Chintankumar Prakashbhai Shah

(Student Number: 100056711) under my supervision during February 2009 to November

2009, submitted to the School of Electrical and Information Engineering, University of

South Australia, South Australia in partial fulfillment for the award of the Degree of Master of

Engineering in Telecommunication and that the thesis has not previously formed the basis for

the award of any other degree, Diploma, Fellowship or other title.

Signature of the supervisor

Dr Aruna Jayasuriya

2
Acknowledgement

What an incredible experience post graduate school has been! Working on this dissertation, and
post graduate school in general, have challenged, rewarded and transformed me in ways I could
not even have anticipated when I began almost a year ago. Several people have lent me their
support, guidance, and help in this process; and now I get the opportunity to thank them. I hope I
can do so meaningfully and without forgetting anyone!

First and foremost I offer my heartfelt regards to my main motivators, my parents and my wife,
who have blessed and encouraged me with their friendly contribution and moral support
throughout my project.

I put forward my sincerest gratitude to my supervisor, Dr Aruna Jayasuriya, who has supported
me throughout my thesis with his patience and knowledge whilst allowing me the room to work
in my own way. I attribute the level of my Masters degree to his encouragement and effort and
without him this thesis, too, would not have been completed or written. One simply could not
wish for a better or friendlier supervisor. I am gratified to Institute of Telecommunication
Research (ITR) that gave me the platform to perform my project work regarding my thesis.

My sincere gratitude goes to my senior Nabaraj Dahal, who has provided me his immense
knowledge in TinyOS in my project. In my daily work, my special thanks go to friendly and
cheerful fellow Christine, who has given very comfortable environment during my project work.

Finally, my last thanks go to all my friends and colleagues of ITR, who were always willing to
help me and arouse me to finish my job successfully

3
Abstract

Location tracking of wireless nodes is the most important part in any Wireless Sensor Network
(WSN). The location of mobile node is tracked by simply wireless ad-hoc networking system.
This thesis presents the location tracking system by using Atmel ATmega128L nodes (Mica2
and Mica2dot) at indoor environment which can track nodes by multi hop technique. In addition,
I present the implementation and evaluation of location tracking system with real time graphical
visualization by obtaining data from mobile node to base station by multi-hop protocols. The
main advantages of the Atmel AVR gadget is that no additional sensor equipments require to
attach with nodes for tracking system because of the nodes themselves can be able to detect the
Received Signal Strength from the transmitting node.

4
LIST OF FIGURES

SERIAL NUMBERS DESCRIPTION PAGE NUMBERS


Figure 1 Basic Architecture 8
Figure 2 Usage of Sensor Nodes 9
Figure 3 MICA2 and Block Diagram 13
Figure 4 MICA2DOT and Block Diagram 14
Figure 5 MIB510CA 14
Figure 6 Cygwin Installation 18
Figure 7 TinyOS2.x Installation 20
Figure 8 Set JAVA Classpath 21
Figure 9 Installation Conformation 22
Figure 10 Experiment Setup 25
Figure 11 Application Installation using Cygwin Tool 27
Figure 12 Visualization of Multi-hop Motes with 28
RSSI Reading

5
CONTENTS
1. INTRODUCTION ………………………………………………………….. 7

 Background

2. LITERATURE REVIEW………………………………………………….. 10

 Global Position System

 Infrared Tracking System

 Radar

 Ultrasonic Sound

3. RESEARCH METHODOLOGY…………………………………………..12

 Hardware Concepts
 Software Concepts

4. EXPERIMENT SETUP…………………………………………………… 16

 Install Cygwin tool


 Install TinyOS 2.x
 Install Java JDK 1.5
 Install and set JNI
 Installation conformation
 Set TinyOS 2.x tree on cygwin tool

5. MULTI-HOP in TinyOS 2.x………………………………………………… 24

 Design of the frame work


 Procedure
 Result
 Books and literature for TinyOS

6
 Future Works

6. RECOMMANDATION…………………………………………………………29
7. CONCLUSION…………………………………………………………………..31

8. REFERENCE……………………………………………………………………33

APPENDIX……………………………………………………………………….36

INTRODUCTION

7
Introduction

 Background

[Figure 1, Basic Architecture]

Due to the development in the Wireless Sensor Network (WSN) technology, location
tracking of objects or people at indoor and outdoor environments has been received abundant
attention from researchers over past few years. There are different methods available for
recognizing and tracking user position such as Cricket [1], Global Position System (GPS) [2],
Infrared Tracking System [3]. GPS system based on satellite network provides very efficient
and cost effective existing location service to the large public only in the outdoor
environment. Moreover, most researchers are done to track location in the indoor
environment with the help of existing WLAN infrastructure. However, WLAN endure from
the eradication of weak signals which cannot predict the accurate location. Hence, none of
the above systems perform for tracking service in both indoor as well as outdoor environment
using the same sensing device and method due to different environment characteristics.

8
Originally developed under motivations of military applications such as battlefield
surveillance, WSNs are now used in many civilian application areas including environment
monitoring, home automation, healthcare application and traffic control [4]. “Soon we’ll
have trillions of sensors …” said by Michael R. Nelson, Director of Internet Technology and
Strategy, IBM. Figure 2 shows the ascending trend of sensors number compared to those of
mobile phones and PCs. The increasing market requirements of these sensor network
applications drive the fast development of research in this area at which the scope of this
thesis is targeted [5]. Among all kinds of research issues in this area, algorithms are highly
concentrated. The subject of this thesis is about simulation, visualization, algorithms and
WSNs. To be more specific, the main task of the project is to build a software framework
integrating simulation and visualization functions to assist investigation of algorithms in WSNs.

[Figure 2, Usage of Sensor Nodes [5]]

The aim of this research is to track user in both environment with the same sensor devices
and minimal tracking error. Wireless sensor nodes (motes) are the tiny devices which can
communicate with each other and make multi-hop network.

The ad-hoc network is very similar to Mobile Communication System. The location tracking
system is simply based on estimating the locations by using received signal strength. These
motes can be static or mobile. The static motes act as base stations which are placed at
different reference points. The static motes track the locations of the mobile motes by using
routing protocol. These all mobile motes have sensor device which can sense different
parameters of the locations such as light, temperature, pressure etc. The mobile motes can
sense information and send simultaneously the information to all adjacent motes which may
be static or mobile motes. The reference nodes examine the strength of received signal and
forward the packet of RSS value up to centralized control unit. Similarly, all motes send

9
information up to centralized control unit. The control unit receives the value of received
signal strength (RSS) and estimate the location of the mobile motes.

Wireless sensor network is the grand innovation of telecommunication industry which gains
lots of popularity due to its tiny size, low power consumption and its computing, sensing and
communication capabilities. Crossbow is the leading company in producing the sensor
network devices and it has deployed the network in a wide range of areas [6].

10
LITERATURE REVIEW
11
Literature Review
A number of location tracking technologies are implemented before the motes based
localization system, like GPS method, Infrared tracking, RADAR system and etc. Some of
the well known techniques are explained in brief below.

 Global Position System


It provides reliable positioning, navigation, and timing services to worldwide outdoor users
on a continuous basis in all weather, day and night, anywhere on or near the Earth.GPS
system is made up with three parts: 24 satellites, control and monitoring stations on earth and
GPS user receiver. The main disadvantages are that the system requires large infrastructure
cost, very expensive for small application, energy consuming, must require satellite.
Moreover, GPS system can never work properly in dense urban environment, under foliage
and indoor environment.

 Infrared Tracking System


Infrared are mostly used in Active Badge Tracking System. It is the smart device for location
tracking capable of transmitting and receiving beacons. A network is setup with devices that
can be detected the infrared signals. These devices capture the infrared signal sent by the
target device in every 10 s and send it to central network server for estimating the position of
the network. This technology seems to be good for both indoor and outdoor environment.
However the main disadvantages are that the devices are short ranged and the line of sight
must require for successful communication. Moreover, the infrared devices give poor
performance in the presence of sunlight and fluorescent lighting.

12
 Radar
Radar is an object detection system based on electromagnetic waves. Radar can detect
moving and fixed objects like aircraft, ships, motor vehicles, weather formation and etc. with
other parameters like altitude, direction and speed. The main drawback of this system is high
power consumption and high infrastructure cost [7].

 Ultrasonic Sound
The audible sounds are also used to detect target location in a WSN. Active Bat Location
System developed by AT&T researchers made the nodes to be localized send the ultrasonic
pulses which is received by many receiver nodes placed at different known location. Time of
flight estimation is used to calculate the position of the target node at the centralized server
system. Cricket is also decentralized system proposed by MIT laboratories where the wall
mounted transmitters placed at different location transmits active beacon messages from
different known transmitters are then used to estimate the target by using the mathematical
technique [8].

13
RESEARCH METHODOLOGY

Research Methodology

 Hardware Concepts
The system design consists of fixed reference motes at predetermined locations and mobile
motes moving blindly. Here the Crossbow Company provides the suitable hardware
component for this mesh network design. The motes are tiny wireless device which have
capability of forming autonomous ad-hoc networks with low power consumption and without
infrastructure. Basically each mote have microprocessor, analog and digital Input/output,
Serial Peripheral Interface (SPI), Universal Asynchronous Receiver and Transmitter (UART),
Analog to Digital Converter (ADC) and memory with separate programming memory. There
are numbers of different motes are available in the market which are differentiated by their
features and applications. Here we have used two types of motes introduced by Crossbow,
MICA2 and MICA2 DOT. Also a on board programming interface is required to interact
between computer and motes. Therefore a suitable on board programming platform for
MICA2 and MICA2 DOT is used MIB510CA.

Features of MPR400CB Mica2

14
[Figure 3, MICA2 and Block Diagram]

This device is a third generation tiny wireless platform for smart sensors with deeply embedded
sensor networks and routing capabilities. This device operates by AA battery with one year
battery life and 868/916 MHz radio frequency. The MICA2 is based on a low power
microcontroller ATmega128L which can run simultaneously sensor application and network
communication. The 51 pin expansion connector supports UART, SPI, analog inputs and digital
I/O interfaces. Here we used MICA2 as static reference motes, base stations [9].

Features of MPR500CA Mica2dot

[Figure 4, MICA2DOT and Block Diagram]

Mica2dot is a very similar to Mica2. The major difference between both motes is that Mica2dot
is in very compact form by reducing expansion pin 18. There are three types of Mica2dot
available depending on radio frequency. Here we have used Mica2dot as mobile motes [10].

Features of MIB510CA Serial Interface Board

15
[Figure 5, MIB510CA]

The MIB510CA on board programming platform allows communicating data of sensors from
motes to computer. A MICA2 is interfaced with MIB510CA through serial interface board. Also
the on board programming platform provides an RS-232 serial port to interface with the
computer. The processor of this device monitors power voltage and also programs the mote
processor. The JTAG (Joint Test Action Group) port is available on board platform for
debugging [11].

 Software Concepts
An embedded coding language should be like minded with the selected hardware devices. Here
we used network embedded system C (nesC) language for programming of MICA2 and MICA2
DOT. The simple turbo C language is operating on MS DOS platform with windows operating
system and operating on UNIX platform with Linux operating system. Similarly Tiny Operating
system is most suitable platform for nesC language and sensor networks. Tiny OS is developed
by UC Berkeley which is small, open source and energy efficient operating system [12]. The
Tiny OS defines numbers of concepts which are useful for wireless sensor networks (WSN). The
Tiny OS system, libraries and applications are written in nesC language for programming
component based applications.

A key focus of nesC is holistic system design. Mote applications are deeply tied to hardware, and
each mote runs a single application at a time. This approach yields three important properties.
First, all resources are known statically. Second, rather than employing a general-purpose OS,
applications are built from a suite of reusable system components coupled with application-
specific code. Third, the hardware/software boundary varies depending on the application and
hardware platform; it is important to design for flexible decomposition. The nesC has two kinds
of components: configuration and modules. Configurations are how components are wired
together. Modules are implementations. Configurations connect the declarations of different
components, while modules define functions and allocate state. [13] Concurrency is central to

16
nesC components: events and commands may be signaled directly or indirectly by an interrupt,
which makes them asynchronous code. To handle this concurrency, nesC provides two tools:
atomic sections and tasks. Parameterized interfaces are nesC’s mechanism for introducing
runtime command and event dispatch within a first order language. A component declares an
interface with a parameter list which creates a separate interface for each parameter values.
Parameterized interfaces are used to model Active Messages in TinyOS: in Active Messages,
packets contain a numeric identifier that specifies which event handler should be executed [14].
Tiny OS 1.x was released in 2005. After that, lots of application and feature added in Tiny OS
1.x and released new version Tiny OS 2.x in 2006. The second version is made for Linux
environment. For windows user, the Cygwin tool was introduced to install Tiny OS 2.x. But
Cygwin tools have lots of complexity to install Tiny OS in windows Vista. Therefore the
alternative VMware introduced a method of installing Tiny OS in both windows and Linux
environment. Here we have used Cygwin tool for installing Tiny OS in windows XP [15].

17
18
EXPERIMENT SETUP

EXPERIMENT SEUP

Experiment was performed in a both combined indoor and outdoor environment. Error appears
caused by reflection of antenna diversity can be trimmed down by setting the antenna of mobile
node and reference node at the angle of 90 degree at the mounting surface. Here, we have
discussed how can setup all tools and hardware for experiment.

 Install Cygwin Tool


There are many ways to install TinyOS 2.x in the Windows or Linux based operating system.
Virtual machine (VMware) tools can work on both types of operating system. Xubuntos
readymade software can be used for installing both version TinyOS 1.x and TinyOS 2.x
simultaneously in the computer system using VMware player. In addition, for Windows
operating system especially cygwin tool can install successfully. Subsequently, any version of
TinyOS can install in windows by using cygwin tool.

Following are the instructions for installing of cygwin.

1. Download cygwin setup file in the C:\cygwin (Here, I have used C: ) from the following
link,
http://www.cygwin.com/

2. Connect with the internet and follow the next step,

19
3. Press “Next” button,

4. Press “Next”,

5. Two times press “Next” on the cygwin setup screen.


6. On the screen, there are mirror sites which are useful
for installing TinyOS supporting files. To select any
one and press “Next”,

20
7. Then, again press “Next” and click on the “Default” icon, then it will be changed into
“Install” icon. Start downloads some files from mirror sites.

[Figure 6, Cygwin Installation]

8. Now, press “next” which starts installing cygwin and wait until the completion of hot
coffee mug.
9. Finally, you can see all required files can be installed in the C:\cygwin folder and cygwin
shell icon on the desktop,

21
 Install TinyOS 2.x

1. Open the Cygwin shell

2. Download AVR files from the following site in the C:\cygwin\home\SHREERAMJI\rpm


(Here, rpm is a new folder and rename rpm. Also, SHREERAMJI is a host windows log
in name)

http://www.TinyOS.net/TinyOS-2.x/doc/html/install-TinyOS.html

3. Write commands for installing TinyOS 2.x in the cygwin shell of all above downloaded
tools,

22
[Figure 7, TinyOS2.x Installation]

4. After all tools installation you will find installed TinyOS-2.x in C:\cygwin\opt\TinyOS-
2.x.

 Install Java JDK1.5

The TinyOS is fully supporting java tools. Sun java must be installed to execute
TinyOS code in the windows system. From the below link user can download java
JDK1.5 and install in the c:\Program Files\Java\jdk1_5_***
http://www.herongyang.com/java/JDK-1-5-Installation-on-Windows-XP.html

The second and main things after successful installation of java tools set class path
in the environment variables of system properties.
Follow the steps to set java class path.
1. To open properties of My Computer
2. To go in the advanced menu.
3. To click on the Environment Variable menu,

23
[Figure 8, Set JAVA Classpath]

4. Now set the CLASSPATH in the User variables and System variables. My CLASSPATH
is like,
C:\cygwin\opt\TinyOS2.x\support\sdk\java\TinyOS.jar;.;C:\cygwin\bin;C:\cygwin;C:\cyg
win\usr\local\bin;G:\ProgramFiles\Java\jdk1.5.0_16\bin;G:\ProgramFiles\Java\jdk1.5.0_1
6\jre\bin;G:\ProgramFiles\Java\jdk1.5.0_16;C:\APT\APT_v0.999;G:\ProgramFiles\Java\j
dk1.5.0_16\bin;C:\cygwin\opt\TinyOS-2.x\apps\MViz\MVizMsg

 Install and set JNI (Java Native Interface)

JNI is a programming frame work which allows java code running in a java virtual
machine by native applications like programs specific for hardware and operating
system platform and libraries written in other languages C, C++ or assembly [19].
For that purpose copy the files like getenv.dll and toscomm.dll from C:\cygwin\lib\TinyOS\ to
C:\ProgramFiles\java\JDK_1.5.0\jre\Bin\. Moreover, download files libtoscomm.so and
libgetenv.so in the both C:\cygwin\lib\TinyOS\ and C:\ProgramFiles\java\JDK_1.5.0\jre\Bin\.

After that, install JNI by command,

$cd /opt/TinyOS-2.x/support/sdk/java
$tos-install-jni

 Installation Conformation

We might want to do is to check the environment is set up correctly. It can be


accomplished by running the command;

24
$ tos-check-env

[Figure 9, Installation Conformation]

This command checks all the environment setup needed by TinyOS gives the
summary of classpath, java, nesc, graphviz and other supporting tools, the TinyOS
is using along with the warnings if any which are pretty much self-explanatory.
We can check the version of nesc compiler we are using the command:
$ ncc –version
This will provide us with the ncc version and nesc compiler version followed by
other information on what version of the C, the compiler is being used [20].

 Set TinyOS-2.x tree on cygwin

The new programmers may want to test the applications that are kept as tutorials or
demonstrations as a reference. The application on TinyOS 1.x tree may not run
depriving of related components and interfaces in TinyOS-2.x tree or vice-versa.
For setting TinyOS 2.x tree:

1. To set the root path using;


$export TOSROOT=”/opt/TinyOS-2.x”
2. To set the root directory;
$export TOSDIR=$TOSROOT/tos
3. To set the Makerules for executing make file;

25
$export MAKERULES= $TOSROOT/support/make/Makerules
4. To set com port;
$export MOTECOM= serial@COM**:mica2
Note: ** means the port number is connected with the device. It should be port 1 /2 /3/…
5. To execute java file;
$cd /opt/TinyOS-2.x/support/sdk/java
$make java

26
27
MULTI-HOP IN TINYOS 2.X

Multi-hop in TinyOS 2.x

Mviz is the application for Mviz network visualization tools. Mviz is an application for testing
the multi-hop behavior in motes compatible with the TinyOS version 2. Here, we have used
demo sensor which produce demo data and routes those values to the collection roots. The roots
send the packets to the base station node which connects to the serial ports and visualize the
multi-hop network. Surge is only compatible with TinyOS version 1 but not compatible with the
current version TinyOS 2. Also, surge application is depended on the underlying protocols, while
Mviz provides users monitoring capabilities.

28
 Design of the framework

[Figure 10, Experiment Setup]

The application we are using for testing uses four motes one of which functions as
base station and the other two are fixed reference nodes which are placed at known
position and are placed in such a way that one of the node, node 01, is placed at
indoor area within the range of base station, node 00. The other node, node 02, is
placed at outdoor area within the range of node 01 but not in the range of base
station. The fourth one node, node 03, acts as a mobile node which is in the range of
outdoor node. Here, I have used collection protocol for multi-hop application in
motes. The node 03 broadcast messages in the air, and the nearest motes receive the
message. Here, the node 02 is the nearest node of the node 03. Now, the node 02
calculates the signal strength of node 03 and broadcast the value of the RSS. Again,
the nearest node of node 03 receives the message of RSS which will also make path
and send the message up to base station node 00. Similarly, all nodes broadcast
themselves and create multi-hop path up to base station node.
The application consists of the supporting files like MVizC.ncc, which is the
configuration file, MVizAppC.nc which is the module file, MViz.h is the header file
and a make file. The structure of the packet is defined in the header file. Here, we
have used a demo sensor which gives the value of received signal strength. The
supporting file for demo sensor is DemoSensorC.nc.

 Procedure

29
 Connect the MIB510 device with computer through serial to USB cable. Keep in mind that
during installing the switch button of the programming board MIB510 should be ON. One
mote place on the programming board then connects the power supply with the MIB510
device.

 Install the Mviz application on the node with node ID 04 using following command,
$ cd /opt/tinyOS-2.x/apps/Mviz
$ make mica2 install.4 mib510,/dev/ttyS0
Note: Here, I have used com port 1, so as per Linux way it should be n-1 = 1-1 = 0.
Similarly if com port is 5, then it should be 5-1 = 4. In addition, always make
switch off of all nodes during installation.

[Figure 11, Application Installation using Cygwin Tool]

 Install the same application on all nodes with different ID using the same above command.
The base station node must be always installed with universal ID 0.
 Now, switch on all motes and place all motes at different locations as per the system setup
design. The base station node is placed on the programming board and makes switch off of
the programming board.

 Result
 Visualize the packet data sent from the mobile node 03 to the base station, node 0, through
multi–hop nodes 02 and 01 by using the following command;
$ tos-mviz –comm serial@COM1:mica2 MVizMsg
30
[Figure 12, Visualization of Multi-hop Motes with RSSI Reading]

 Books and Literature for TinyOS


There are no books published special for TinyOS which can teach programming in TinyOS. It is a new
programming platform designed especially for embedded system such as wireless sensor network. Philip
Levis is a senior researcher in TinyOS programming and who has been giving instructions and solutions
of plenty applications based on TinyOS. He is the chairman of the TinyOS core working group and also a
member of the TinyOS Alliance Working Group. The below web link give Philip Levi’s literature on
TinyOS programming,

http://csl.stanford.edu/~pal/pubs/TinyOS-programming.pdf

31
http://www.TinyOS.net/TinyOS-1.x/doc/tutorial/

The tutorials provide the information for beginners in TinyOS programming and focus on how to write
nesC code and explain each concept with small examples.

 Future Works

In this project, I am success to establish multi-hop network of mica2 in a single version of TinyOS 2.X
and achieve RSSI values of each mote. However, for location tracking only RSSI value of each mote
cannot identify the location of mobile mote. That is required the identification of nearest reference node,
so we can say that the mobile node is very near to the XYZ node and thus the location of the mobile node
is XYZ. This can be possible by small changes in the given programs. In addition, I have used a dummy
voltage sensor which gives the information regarding RSSI only. However, it will be possible to use
different sensors which can measure like temperature, pressure, vibrations etc and attaché with the mobile
nodes. Hence, the mobile node can provide both information about locations and sensor data to the base
station.

32
33
RECOMMENDATIONS

Recommendations

In this project we have discussed about the location tracking system based on real time
visualization and getting RSSI value. Here, we have used the mica2 and mica2dot motes which
use Chipcon’s CC1000 radio which employs FSK modulation with Manchester encoding and
have data rate of 38.4 kbps. This radio provides the measurement of RSSI and visualize on the
screen. When the mobile nodes move, the Mviz application cannot give real time visualization
on the screen. For getting data of location changes of the mobile node by reset the command.

However, the radio on micaz which is Chipcon’s CC2420 and that of IRIS mote which is
Atmel’s AT86RF230 read the RSSI directly and make it available to the every packet received.
Dealing with RSSI would be easier in micaz and IRIS motes. Moreover, Octopus Dashboard
application provides real time movement of mobile motes with the exact location of each node.

34
35
CONCLUSION
\

Conclusion

The sensor network using Crossbow’s motes proves to be cheap and efficient localization
devices in indoor environment as well as outdoor environment and short range system within the
premises. I found, there was change in RSSI value collected in the base station with the
movement of the mobile node which is a positive step in our project. There were also positive
traces in collecting data from the remote mobile node via the multi-hop from the series of
reference node. The network can self-discover any new mobile node within the network’s range
through its ad-hoc functionality and get graphics view on the screen. I conclude that the motes,
Mica2 and Mica2DOT, from Crossbow can be made a multi-hop network and provide received
signal strength value that can help us in the aged care location tracking application.

36
37
REFERENCES

References

1. Nissanka Bodhi Priyantha, June 2005, The Cricket Indoor Location System,
Massachusetts Institute of Technology, Cambridge, viewed on 11th April 2009
<http://nms.lcs.mit.edu/papers/bodhi-thesis.pdf>

2. Overview of Global Position System, Viewed on 20th April 2009


<http://en.wikipedia.org/wiki/Global_Positioning_System>

3. Arun Isrel, Reda Dehy, Infrared Tracking System, viewed on 2nd May 2009
http://instruct1.cit.cornell.edu/Courses/ee476/FinalProjects/s2004/rd73/476finalpro.htm>

4. I.F. Akyildiz, S. Su, Y. Sankarasubramanian, E. Cayirci, “Wireless Sensor Networks:A


Survey”, Computer Networks, Vol. 38, No. 4, pp. 393, 2002.

5. Information of usage of motes, viewed on 2nd May 2009


<http://sites.nationalacademies.org/NRC/Organization/index.htm>

6. Products of wireless sensor network of Crossbow Company, viewed on 10thMay2009

38
<http://www.xbow.com/Products/wproductsoverview.aspx>

7. P. Bahl, V. N. Padmanabhan, March 2000 “ RADAR: An In-Building RF-based User


Location and Tracking System”, Proceedings of the Sixth International Conference on
Computer Communications, pp 775-784, viewed on 21st May 2009
<http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.39.9348>

8. M. Addlessee, R. Curwen, S. Hodges, J. NewMann, P. Steggles, A. Ward, A.


Hoper,”Implementing a Sentient Computing System”, IEEE Computer Magazine, 34 (8):
pp 50-56, August 2001.

9. Crossbow company product data sheet of MICA2, viewed on 18 th May 2009,


<http://www.xbow.com/products/Product_pdf_files/Wireless_pdf/MICA2_Datasheet.pdf >

10. Crossbow company product data sheet of MICA2 DOT, viewed on 18th May 2009,
< http://www.xbow.com/products/Product_pdf_files/Wireless_pdf/MICA2DOT_Datasheet.pdf >

11. Crossbow company product data sheet of MIB510, viewed on 18th May 2009
<http://www.xbow.com/products/product_pdf_files/wireless_pdf/mib510ca_datasheet.pdf>

12. Berkeley descriptions of Tiny OS, Viewed on 5th May 2009,


<http://webs.cs.berkeley.edu/tos/ >

13. Philip Levis, TinyOS Programming, June 2006, viewed on 19 th May 2009
<http://csl.stanford.edu/~pal/pubs/tinyos-programming.pdf>

14. David Gay, Philip Levis, Robert Von Behren, The nesC Language:A Holistic Approach
to Network Embeded Systems, Intel Research Berkeley, viewed on 16 th June 2009
<http://nescc.sourceforge.net/papers/nesc-pldi-2003.pdf>

15. Overview of TinyOS, viewed on 2nd July 2009


<http://www.tinyos.net/>

16. TinyOS Rssi Base application, viewed on 27th August 2009,


<https://www.millennium.berkeley.edu/pipermail/tinyos-2-commits/2008-July/007911.html >

17. Toh,C-K, C 1997, Book of Ad-hoc network protocols, Wireless ATM and AD-HOC
networks protocols and architectures, Kluwer Academic, Boston.

39
18. Romer, 2005, Time Synchronization and Localization in Sensor Networks, University of
Frankfurt Germany, Viewed on 30th August 2009,
<http://www.vs.inf.ethz.ch/publ/papers/roemer-phd-2005.pdf>

19. JNI information, viewed on 17th October 2009


<http://en.wikipedia.org/wiki/Java_Native_Interface>

20. Nabaraj Dahal, Nov 2008, Location Tracking System Using Sensor Nodes, Thesis Report,
University of South Australia Mawson Lakes Campus.

21. Hekmat, Ramin, C 2006, Ad-Hoc Networks: Fundamental Properties and Network
Topologies, Springer, Dordrecht.

22. Limitations of CC2431 Chipcon, viewed on 16th May 2009,


<http://e2e.ti.com/forums/t/123.aspx ......limitation of CC2431>

40
APPENDIX

APPENDIX

 Mviz.h
#ifndef MVIZ_H
#define MVIZ_H

#include "AM.h"

enum {
/* Default sampling period. */
DEFAULT_INTERVAL = 1024,
AM_MVIZ_MSG = 0x93
};

typedef nx_struct mviz_msg {


nx_uint16_t version; /* Version of the interval. */
nx_uint16_t interval; /* Samping period. */
nx_uint16_t origin; /* Mote id of sending mote. */
nx_uint16_t count; /* The readings are samples count * NREADINGS onwards */
nx_uint16_t reading;
nx_uint16_t etx;
nx_uint16_t link_route_value;
nx_am_addr_t link_route_addr;
} mviz_msg_t;

#endif

 MVizAppC.nc

41
#include <MViz.h>

configuration MVizAppC { }
implementation {
components MainC, MVizC, LedsC, new TimerMilliC(),
new DemoSensorC() as Sensor, RandomC;

//MainC.SoftwareInit -> Sensor;

MVizC.Boot -> MainC;


MVizC.Timer -> TimerMilliC;
MVizC.Read -> Sensor;
MVizC.Leds -> LedsC;
MVizC.Random -> RandomC;
//
// Communication components. These are documented in TEP 113:
// Serial Communication, and TEP 119: Collection.
//
components CollectionC as Collector, // Collection layer
ActiveMessageC, // AM layer
new CollectionSenderC(AM_MVIZ_MSG), // Sends multihop RF
SerialActiveMessageC, // Serial messaging
new SerialAMSenderC(AM_MVIZ_MSG); // Sends to the serial port

components CtpP as Ctp;

MVizC.RadioControl -> ActiveMessageC;


MVizC.SerialControl -> SerialActiveMessageC;
MVizC.RoutingControl -> Collector;

MVizC.Send -> CollectionSenderC;


MVizC.SerialSend -> SerialAMSenderC.AMSend;
MVizC.Snoop -> Collector.Snoop[AM_MVIZ_MSG];
MVizC.Receive -> Collector.Receive[AM_MVIZ_MSG];
MVizC.RootControl -> Collector;
MVizC.CtpInfo -> Ctp;
MVizC.LinkEstimator -> Ctp;

 MVizC.nc

#include "MViz.h"

module MVizC {
uses {
// Interfaces for initialization:
interface Boot;
interface SplitControl as RadioControl;
interface SplitControl as SerialControl;
interface StdControl as RoutingControl;

// Interfaces for communication, multihop and serial:


interface Send;

42
interface Receive as Snoop;
interface Receive;
interface AMSend as SerialSend;
interface CollectionPacket;
interface RootControl;

// Miscalleny:
interface Timer<TMilli>;
interface Read<uint16_t>;
interface Leds;
interface CtpInfo;
interface LinkEstimator;
interface Random;
}
}

implementation {
task void uartSendTask();
static void startTimer();
static void fatal_problem();
static void report_problem();
static void report_sent();
static void report_received();

uint8_t uartlen;
message_t sendbuf;
message_t uartbuf;
bool sendbusy=FALSE, uartbusy=FALSE;

/* Current local state - interval, version and accumulated readings */


mviz_msg_t local;

uint8_t reading; /* 0 to NREADINGS */

/* When we head an Oscilloscope message, we check it's sample count. If


it's ahead of ours, we "jump" forwards (set our count to the received
count). However, we must then suppress our next count increment. This
is a very simple form of "time" synchronization (for an abstract
notion of time). */
bool suppress_count_change;

// On bootup, initialize radio and serial communications, and our


// own state variables.

event void Boot.booted() {


local.interval = DEFAULT_INTERVAL;
local.origin = TOS_NODE_ID;

// Beginning our initialization phases:


if (call RadioControl.start() != SUCCESS)
fatal_problem();

if (call RoutingControl.start() != SUCCESS)


fatal_problem();
}

43
event void RadioControl.startDone(error_t error) {
if (error != SUCCESS)
fatal_problem();

if (sizeof(local) > call Send.maxPayloadLength())


fatal_problem();

if (call SerialControl.start() != SUCCESS)


fatal_problem();
}

event void SerialControl.startDone(error_t error) {


if (error != SUCCESS)
fatal_problem();

// This is how to set yourself as a root to the collection layer:


if (local.origin % 500 == 0)
call RootControl.setRoot();

startTimer();
}

static void startTimer() {


call Timer.startPeriodic(local.interval);
reading = 0;
}

event void RadioControl.stopDone(error_t error) { }


event void SerialControl.stopDone(error_t error) { }

event message_t*
Receive.receive(message_t* msg, void *payload, uint8_t len) {
if (uartbusy == FALSE) {
mviz_msg_t* in = (mviz_msg_t*)payload;
mviz_msg_t* out = (mviz_msg_t*)call SerialSend.getPayload(&uartbuf,
sizeof(mviz_msg_t));
if (out == NULL) {
return msg;
}
else {
memcpy(out, in, sizeof(mviz_msg_t));
}
uartbusy = TRUE;
uartlen = sizeof(mviz_msg_t);
post uartSendTask();
}

return msg;
}

task void uartSendTask() {


if (call SerialSend.send(0xffff, &uartbuf, uartlen) != SUCCESS) {
uartbusy = FALSE;
}
}
//
// Overhearing other traffic in the network.

44
//
event message_t*
Snoop.receive(message_t* msg, void* payload, uint8_t len) {
mviz_msg_t *omsg = payload;

report_received();

// If we receive a newer version, update our interval.


if (omsg->version > local.version) {
local.version = omsg->version;
local.interval = omsg->interval;
startTimer();
}

// If we hear from a future count, jump ahead but suppress our own
// change.
if (omsg->count > local.count) {
local.count = omsg->count;
suppress_count_change = TRUE;
}

return msg;
}

/* At each sample period:


- if local sample buffer is full, send accumulated samples
- read next sample
*/
event void Timer.fired() {
if (!sendbusy) {
mviz_msg_t *o = (mviz_msg_t *)call Send.getPayload(&sendbuf,
sizeof(mviz_msg_t));
if (o == NULL) {
fatal_problem();
return;
}
memcpy(o, &local, sizeof(local));
if (call Send.send(&sendbuf, sizeof(local)) == SUCCESS)
sendbusy = TRUE;
else
report_problem();
}

reading = 0;
/* Part 2 of cheap "time sync": increment our count if we didn't
jump ahead. */
if (!suppress_count_change)
local.count++;
suppress_count_change = FALSE;
call Timer.stop();
call Timer.startPeriodic(local.interval);
if (call Read.read() != SUCCESS)
fatal_problem();
}

event void Send.sendDone(message_t* msg, error_t error) {


if (error == SUCCESS)

45
report_sent();
else
report_problem();

sendbusy = FALSE;
}

event void Read.readDone(error_t result, uint16_t data) {


uint16_t val;
if (result != SUCCESS) {
data = 0xffff;
report_problem();
}
local.reading = data;
call CtpInfo.getEtx(&val);
local.link_route_value = val;
call CtpInfo.getParent(&val);
local.link_route_addr = val;
local.link_route_value = call
LinkEstimator.getLinkQuality(local.link_route_addr);
}
event void LinkEstimator.evicted(am_addr_t addr){}

event void SerialSend.sendDone(message_t *msg, error_t error) {


uartbusy = FALSE;
}

// Use LEDs to report various status issues.


static void fatal_problem() {
call Leds.led0On();
call Leds.led1On();
call Leds.led2On();
call Timer.stop();
}

static void report_problem() { call Leds.led0Toggle(); }


static void report_sent() { call Leds.led1Toggle(); }
static void report_received() { call Leds.led2Toggle(); }
}

 MVizSensorC.nc
generic configuration DemoSensorC()
{
provides interface Read<uint16_t>;
}
implementation {
components new VoltageC() as Sensor;

//V_RSSI= 3 * (Sensor/1024);

//RSSI_DBM = (-50.0*V_RSSI) - 45.5;

Read = Sensor;
}

46
 Makefile
COMPONENT=MVizAppC
CFLAGS=-DCC1K_DEF_FREQ=900000000
CFLAGS += -I$(TOSDIR)/lib/net/ -I$(TOSDIR)/lib/net/ctp -I$
(TOSDIR)/lib/net/4bitle -I.
BUILD_EXTRA_DEPS = MVizMsg.class

MVizMsg.java: MViz.h
mig -target=null -java-classname=MVizMsg java MViz.h mviz_msg -o $@

MVizMsg.class: MVizMsg.java
javac MVizMsg.java

include $(MAKERULES)

47

You might also like