Links to the Submitted Research Paper

advertisement
Building a Virtual Laboratory for Wireless Sensor Network
Research and Education
Abstract
In addition to real-world applications, wireless sensor networks may be integrated into various classes,
such as Operating Systems, Network Protocols, and Network Security, as case studies or programming
projects. To facilitate easy integration, programming projects and labs need to be developed. This paper
reports our experience of building a virtual laboratory of wireless sensor networks (WSN) for research
and education. A sample WSN virtual lab is built to illustrate the virtual interface between the wireless
sensors and the user. By including the development of such a sample lab as a programming project, the
instructor provides the students an excellent opportunity to explore various areas of knowledge, including
the general understanding of wireless sensor networks, virtual labs, programming the sensors and motes,
configuring a sensor network, et al. The tool may also be used as a foundation on which further
experiments and research may be conducted.
1. Introduction
A wireless sensor network (WSN) is a network
that consists of spatially distributed autonomous
devices called sensors, which typically
communicate with each other to form an ad-hoc
and self-organized network. A WSN is composed
of sensor nodes deployed at different locations;
working together the sensors monitor physical or
environmental conditions, such as temperature,
sound, vibration, pressure, motion, and pollutants.
A wireless sensor consists of a mote, sensor
modules and a low-powered energy source
(generally a battery)1. A mote is a low-powered
computer with a radio transmitter capable of
forming ad hoc communication. Using sensor
networks to gather information is essential in
smart environments, including transportation
Figure 1. A WSN Virtual Laboratory
systems automation, smart buildings, industrial
control, smart homes, et al. Another significant application of wireless sensor networks is in environments
where running wires or cables is impractical. For instance, sensors may be deployed using unmanned
aircrafts to collect information in a remote area where terrorist or guerilla warfare is ongoing.
In addition to real-world applications, wireless sensor networks may be integrated into various classes,
such as Operating Systems, Network Protocols, and Network Security, as case studies or programming
projects. Deploying a WSN requires iteratively programming a set of nodes, positioning them in an area
large enough to produce an interesting radio topology, and using them to extract debugging and
1
Wikipedia. “Wireless Sensor Network”. Retrieved on November 15, 2007, from http://en.wikipedia.org/wiki/Wsn
Building a Virtual Laboratory for Wireless Sensor Network Research and Education
1
performance data [1]. As we have learned from experiences, it is often challenging for a student with no
prior experiences in WSN to deploy or test such a network. Our goal is to develop a set of WSN labs that
could be easily adopted by the instructor, and could be used to help the students get started in testing
and/or deploying wireless sensor networks.
Although either simulation or emulation is typically employed when developing the labs, there exists a
third approach, the so called virtual laboratory. As shown in Figure 1, a virtual lab is composed of two
major components: (a) a physical lab; (b) a virtual interface that allows the user to access and control the
lab (typically from a remote location over a computer network). A virtual lab is an online learning
environment wherein students may carry out experiments and research without physically being present
in the lab. Applications of virtual labs include distance learning, distributed collaboration among
researchers, sharing of lab resources, et al.
In this paper we report our work in developing a WSN virtual lab. Section 2 discusses WSN laboratory
design, with a focus on the challenges facing WSN virtual lab development and the popular virtual lab
platforms. Our design of the WSN virtual lab is presented in Section 3, including the software, hardware
requirements and steps required to build a virtual laboratory. Section 4 concludes the paper by discussing
the benefits of our approach and potential future work.
2. Developing a Virtual Laboratory for Wireless Sensor Networks
Typical lab development approaches employ either simulation or emulation. Simulation is an important
step in the development cycle of embedded systems, allowing more detailed inspection of the dynamic
execution of microcontroller programs and diagnosis of software problems before the software is
deployed onto the target hardware2. Before constructing a WSN, a simulation environment may be built
first in order for the developers to study and diagnose issues that may be present in the target WSN.
Building a wireless sensor network using simulation is cost effective and easy to use3. Simulation,
however, does not provide the realism required to understand various WSN issues, including resource
limitations, communication loss and energy constraints at scale [1]. To study issues related to a real WSN,
the emulation approach is adopted. The emulation approach, however, is usually expensive and takes
more time and efforts than the simulation approach. Moreover, the physical lab developed out of the
emulation approach is typically not portable, requiring the user to be physically present in the lab to
configure and use the hardware devices. The virtual lab approach provides an alternative of lab design, by
combining a physical lab with a virtual interface, therefore providing the benefits of accessibility (as in
simulation) and realism (as in emulation).
Virtual lab is a software environment that provides virtual interface for users to interact with the real
devices. As shown in Figure 1, with the virtual lab approach, users are able to communicate with
measurement devices and experimentation setup to make experiments on a real system without being
physically present. “Users can plan and conduct experiments, collect experimental data, and analyze the
results as if they were physically present in the laboratory” [3]. Thus a virtual laboratory can be said to be
a system which is real, interactive and flexible [4].
The virtual lab approach provides the following benefits: (a) Virtual labs have relatively low costs and the
experiments can easily be repeated, because the virtual environment is controlled [5]; (b) Virtual labs
reduce equipment needs, and thus cost, by providing virtual access to equipment and accompanying
materials; (c) Virtual labs are available to students easily at anytime, from any place [6]; (d) Educational
and research materials are easily accessible to students, thus saving travel time and increasing
Compilers Group, “Avrora – The AVR Simulation and Analysis Framework”. Retrieved on October 24, 2007, from
http://compilers.cs.ucla.edu/avrora
3 Ismail Akturk, “Come491 Project- Wireless Sensor Network”. Retrieved on October 24, 2007, from
http://www.ismailakturk.com/wsn.html#simulation_typical
2 UCLA
Building a Virtual Laboratory for Wireless Sensor Network Research and Education
2
productivity and efficiency [3]. Designing a virtual lab for WSN research and education, however,
involves some unique challenges.
 Architecture challenges in developing an interface between the user and the physical sensor
networks: The interface provides a two-way communication for the user to access the sensor
network (i.e., accept the information/data captured by the sensors and render them to the user, and
read data/command from the user and perform the necessary task in the sensor network).
 Management challenges in monitoring the sensor network and the connectivity: Once a physical
sensor network is deployed and the virtual lab is connected to it, the network needs to be
monitored and managed in order to check for link failures, analyze the outputs generated by the
sensors, et al [7].
There exist several virtual lab platforms that may be adopted by the developers to build a WSN virtual
lab. LabVIEW from National Instruments and Agilent Technologies’ VEE (Visual Engineering
Environment), for example, are two of the popular virtual lab development platforms. VEE is “a graphical
programming environment optimized to reduce test development time for instrument control. In VEE,
syntax and operations controls the program execution. The program is designed by connecting objects in
the workspace together with ‘wires’, lines that connect these objects in a meaningful fashion. These wires
dictate when and where data will flow through the program (propagation)”4.
“LabVIEW is a graphical programming language that uses icons instead of lines of text to create
applications. In contrast to text-based programming languages where instructions determine the program
execution, LabVIEW uses dataflow programming where the flow of data determines the execution of the
program”5.
We compared LabVIEW and VEE with respect to various aspects of virtual lab development. LabVIEW
drivers are a collection of virtual instruments (VI) and sub-VI’s; the internal structure of the VI is
accessible to the user and can be modified with minimum effort. A sample LabVIEW VI is shown in the
Appendix. In contrast, VEE drivers are compound closed object; its internal structure is not accessible to
the user [8]. The loops in LabVIEW are much more clearly defined and easier to comprehend than VEE.
The icons in LabVIEW are more descriptive. In contrast, VEE icons look like text boxes with a title. Most
importantly, more hardware drivers are available in LabVIEW than in VEE. When developing our WSN
virtual lab, we have chosen LabVIEW as the development platform.
3. Our Design of a WSN Virtual Lab
To explore the virtual lab approach, we have developed a prototype virtual lab for a sample wireless
sensor network that senses temperature. In order for interested instructors to easily adopt the lab in their
classes, we have organized the lab according to a specific format, including such information as target
class, learning objectives, system requirements, and implementation details.
Lab Title: Building a virtual laboratory for WSN research and education.
Target Class: The lab can be used in graduate and undergraduate classes, including Operating Systems,
Network Protocols, Network Security, Wireless Computing, and Wireless Sensor Networks.
Learning Objectives: Students will learn the following after having successfully completed the lab:
a.
b.
c.
d.
4
How does a virtual lab for WSN operate in general?
How is the code compiled and installed on the motes.
How is the output of the sensor network viewed in the MoteView program
How does a VI in LabVIEW act as an interface to accept user controls of the sensor network
Agilent Technologies, Retrieved on January 15, 2008, from http://www.home.agilent.com/upload/cmc_upload/All/Exp55b.pdf
Instruments, “LabVIEW User Manual” Retrieved on January 15, 2008, from
http://www.ni.com/pdf/manuals/320999e.pdf
5 National
Building a Virtual Laboratory for Wireless Sensor Network Research and Education
3
e. How is a WSN circuit connected and built for serial communication
Hardware Requirements:
a. One Sensor: MTS 310,
b. One Gateway/Programming board: MIB510.
c. Two MICA2 motes.
d. Two AA alkaline batteries (1.5 V).
e. A computer workstation
Software Requirements:
a. A workstation with MoteWorks, MoteView and LabVIEW 8.2 installed
Problem Classification: This lab can be classified as a study and programming project. Programming of
the motes is done with NesC codes using NesC/TinyOS. LabVIEW is used to build the user interface
to view the output.
Implementation of the virtual lab: This lab involves
the development of a simple sensing application
that samples the temperature on a sensor board
and sends the data back to the base station using
the XMesh multi-hop network.
Sensor mounted on a mote
Sensor Node
Sensor Data Acquisition
Module (MTS 310)
Step 1: The first step in creating such an
application is to create a Makefile. To do so, enter
the following text into a new document in the
programmer’s notepad:
MICA Radio/Processor
module (MICA2)
include Makefile.component
include $(TOSROOT)/apps/MakeXbowlocal
GOALS += basic freq route
include $(MAKERULES)
Step 2: The next step is to define the name of the
application and the type of the sensor used; this is
done by creating a Makefile.component file:
COMPONENT=MyApp_Mesh <name of your
application>
SENSORBOARD=mts310 < type of the sensor
used>
Mote mounted on
Gateway
MICA Radio/Processor module (MICA2)
Gateway Board
(MIB510 or MIB520)
Feedback
Workstation
Step 3: Next, create the configuration file; a
default configuration file is provided by
Crossbow as a .nc file, and is located in the
lesson_4 directory of the MoteWorks installation
folder.
Step 4: The next step in configuring a mote is to
create an application module; a default module is
provided by Crossbow and is located in the
lesson_4 folder. The file has an extension .nc and
the name of the file always ends with M. Thus a
file with a name MyApp_Mesh will have a module
file called MyApp_MeshM.nc. All the application
and configuration files need to be placed under
one directory before the code is compiled.
Control
I/O Port
(COMM, USB, Ethernet)
VI Components
Labview
Interface
Figure 2. Components in a wireless sensor
network virtual lab
Figure 2 illustrates the various components of a WSN. In the sample sensor network we have two
motes (MICA2), one sensor board (MTS310) and one gateway device (MIB510). One mote (m1),
with the sensor board plugged onto it, functions as a sensor node; the second mote (m2) functions as
Building a Virtual Laboratory for Wireless Sensor Network Research and Education
4
the base station, plugged into the programming board and connected to the workstation. The mote that
functions as the sensor node will have batteries plugged into it while the mote that functions as the
base station does not require batteries since the power is being supplied by the gateway device.
Step 5: To program the
motes, first plug m1 to
the programming board;
then
from
the
Programmer’s Notepad
select tools shell and
type the command ‘make
mica2 install, 1 mib510,
com’ (assuming the mote
and the workstation are
connected via COM1) to
compile the .nc file.
Step 6: Next, plug m2 to
the programming board;
this mote is programmed
with the XMeshBase
application provided by
Crossbow and is installed
with node id = 0. The
XMeshBase file is located
in the xmesh folder in the
Figure 3. VI Front Panel Indicating the Sensed Temperature
apps directory. With the
base station mote (m2) plugged to the programming board, turn on the sensor node mote (m1). The
LEDs will flash on the sensor node mote once every second. This indicates that the messages are
being received on the base station [9]. The messages which are being received by the base station
needs to be verified; this can be done by running the MoteView application. If the data is correctly
viewed on MoteView then the data is assumed to have passed through the COM port and should be
visible on the VI through LabVIEW.
After the above steps, LabVIEW can now accept the data and display it on the VI interface. We have
named this VI as MTS-310.vi, which was originally provided by National Instruments by the name
Read Data and Display Health with Variable Rate vi. We have taken the base VI and modified it as
per the requirements. The block diagram of that VI and additional information are included in the
Appendix.
Once the serial communication between LabVIEW and the sensor network is achieved, we can run
this VI by clicking the Run tab. On running this VI a screen similar to Figure 3 will be shown, which
displays the node id and the temperature sensed by the node. The temperatures are continually
updated as long as the VI is running and the sensor continues to send new data over.
4. Discussion and Future Work
An initiative was taken to design and develop a virtual laboratory for WSN research and education using
LabVIEW. With its visual programming language provided by LabVIEW, students, researchers and
developers can quickly switch over from their design and simulation techniques to the deployment stage.
For their working model to be built, they do not require to switch to a difficult low-level programming
environment such as C. LabVIEW provides this flexibility, allowing the standard laboratory instruments
to be easily modeled.
Building a Virtual Laboratory for Wireless Sensor Network Research and Education
5
The exploratory WSN virtual lab that we have built has proved to be a useful learning tool. By presenting
the development of such a sample lab as a programming project in a related class, the instructor provides
the students with an excellent opportunity to explore various areas of knowledge, including the general
understanding of wireless sensor networks, virtual labs, programming the sensors and motes, configuring
a sensor network, et al. The tool may also be used as a foundation on which further experiments and
research may be conducted. Wireless sensor network algorithms, for example, may be tested on the tool.
The tool may be further expanded to form a distributed research platform, on which sensor networks
located in separate locations may be virtually integrated to allow synchronous experiments and analysis to
be performed.
We plan to implement a virtual lab consisting of more sensors, which need to be accessed/controlled at
the same time. A method needs to be developed to program these nodes. Collection and displaying of data
from such a large network will be an interesting problem to tackle. Moreover, at present the tool allows
the user to receive feedback from the sensor network; a complete virtual lab solution requires us to add
the capability for the user to control the sensors via the virtual lab interface.
References
[1] Werner-Allen, G., P. Swieskowski, and M. Welsh, "MoteLab: A Wireless Sensor Network Testbed,"
in Information Processing in Sensor Networks, 2005. IPSN 2005 Fourth International Symposium,
2005, pp. 483- 488
[2] Vlasios, S., "Object tracking using wireless sensor networks,” California: Naval Postgraduate School,
2005.
[3] Guimaraes, E., A. Maffeis, J. Pereira, B. Russo, E. Cardozo, M. Bergerman, and M. Magalhaes,
"REAL: A Virtual Laboratory for Mobile Robot Experiments," in 1st IFAC Conf. Telematics
Applications in Automation and Robotics Weingarten, Germany, 2001.
[4] Cui, X., X. Zhang, and X. Chen, "A Virtual Laboratory for Electrical and Electronics Teaching," in
Microwave, Antenna, Propagation and EMC Technologies for Wireless Communications IEEE
International Symposium, 2005.
[5] Carlos, G., "Artificial Societies of Intelligent Agents" in Fundacion Arturo Rosenblueth, 2001.
[6] Bhargava, P., J. Antonakakis, C. Cunningham, and A. Zehnder, "Web-Based Virtual Torsion
Laboratory," Computer Applications in Engineering Education, 2005.
[7] Akyildiz, I., W. Su, Y. Sankarasubramaniam, and E. Cayirci, "Wireless Sensor Networks: A Survey,"
Computer Networks (Elsevier) Journal, March 2002
[8] Klinger, M. and B. Beraq, "Reusable Test Executive and Test Programs Methodology and
Implementation Comparison between HP VEE and LabVIEW," in AUTOTESTCON '99 IEEE
Systems Readiness Technology Conference, 1999.
[9] Crossbow Technology. "MoteWorks Getting Started Guide”. Retrieved October 19, 2007, from
http://www.xbow.com/Support/Support_pdf_files/MoteWorks_Getting_Started_Guide.pdf.
Building a Virtual Laboratory for Wireless Sensor Network Research and Education
6
Appendix: The MTS-310 Virtual Instrument (VI)
Once the data has been successfully communicated over COM port, LabVIEW can now accept this data
and display it on the VI interface. We have named this VI as MTS-310.VI. This VI is originally provided
by National Instruments by the name Read Data and Display Health with Variable Rate VI6. We have
taken this base VI and modified it as per our requirements. With the help of VI’s a connection is created
to a WSN gateway. The block diagram of the VI is shown in Figure 4.
Figure 4. Block diagram of the MTS-310 VI
This VI is composed of many sub VI’s like the Start Stream VI, Get Node List VI, WSN Read VI, Stop
Stream VI , Clear Stream VI et al. In the Start Stream VI the data is acquired from the gateway. Start must
be called before any network communication can take place, either sending or receiving data or
configuring the network. A delay is being introduced which confirms that a sub diagram gets executed
before he next sub diagram has begun its execution. The Get Node List VI returns the list of node ids in
the network, the node id in this case is the mote id. The WSN Read VI is the Raw N Sensor N point which
indicates that we can select N number of sensors and can have N number of samples. This particular VI
collects 2 types of information: date and time, and temperature.
6
National Instruments, "LabVIEW drivers for Wireless Sensor Network" Retrieved on December 12,2007 from
http://zone.ni.com/devzone/cda/tut/p/id/5435#toc1
Building a Virtual Laboratory for Wireless Sensor Network Research and Education
7
Once the information is collected, the Stop Stream VI, stops acquiring the data from the network and
closes the connection to the gateway. The Clear Stream VI clears the stream, before clearing this VI stops
the stream and releases any resources reserved by the stream.
Building a Virtual Laboratory for Wireless Sensor Network Research and Education
8
Download