0% found this document useful (0 votes)
47 views16 pages

WSN Solution

The document discusses wireless sensor networks and the Contiki operating system. It provides background on WSNs and describes their typical architecture involving end devices, routers, and coordinators. It then discusses Contiki OS, noting that it is open-source, Linux-based, and designed for low-powered IoT devices and WSN applications. The document uses Contiki and its Cooja simulator to simulate a sample WSN scenario and evaluate Contiki's advantages over other OS's like TinyOS and LiteOS for WSN development.

Uploaded by

haseeb ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views16 pages

WSN Solution

The document discusses wireless sensor networks and the Contiki operating system. It provides background on WSNs and describes their typical architecture involving end devices, routers, and coordinators. It then discusses Contiki OS, noting that it is open-source, Linux-based, and designed for low-powered IoT devices and WSN applications. The document uses Contiki and its Cooja simulator to simulate a sample WSN scenario and evaluate Contiki's advantages over other OS's like TinyOS and LiteOS for WSN development.

Uploaded by

haseeb ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 16

Table of Contents

Abstract.......................................................................................................................................................2
Introduction.................................................................................................................................................3
Literature Review........................................................................................................................................4
Methodology...............................................................................................................................................5
Wireless Sensor Networks (WSNs).........................................................................................................5
Contiki Operating System and Its Structure.............................................................................................7
Cooja Simulator Environment.................................................................................................................8
Wireless Network Sensor in Cooja..........................................................................................................8
Analysis and Result...................................................................................................................................12
Discussion.................................................................................................................................................14
Recommendation.......................................................................................................................................15
Conclusion.................................................................................................................................................15
References.................................................................................................................................................16
Abstract

Wireless Sensor Networks (WSNs) have very wide range of applications from health to

agriculture, from military technologies to observing of volcano activities. Developers and

engineers frequently need to simulate WSN to ensure developed applications work successfully

and to analyze effects of various configurations of wireless nodes. Simulating the designed

scenario and embedding the designed algorithms into the wireless modules effectively are the

important factors for the developers and engineers in this field. In this study, Contiki Operating

System is proposed as a convenient solution for developers and engineers. Contiki is an open

source; Linux based operation system, and developed for Internet of Things (IoT) devices. In this

paper, primarily, Contiki OS usage and advantages in WSN were explained, then Contiki OS

usage over a sample scenario was given and finally advantages of Contiki OS over other popular

operation systems such as Tiny OS and Lite OS were examined. Background information on

WSN and Contiki OS to build an example scenario for beginners were provided.
Introduction

The identification layer of the modern information processing system is completely related to the

sensing of six physical phenomena in nature such as; mechanical, electrical, magnetic, and

thermal, radiation, and chemical. Importance of the sensing leads to develop new approaches and

systems in many fields. Wireless Sensor Networks (WSNs) are regarded as a good example to

new developments and technologies in this field. In recent years, WSNs find applications from

health to agriculture, military technologies to observing of volcano activities which have vital

importance at many points. Many of the mentioned applications have to operate in environmental

conditions that are stand-alone and energy-limited. Therefore, localization algorithms and novel

energy-efficient clustering algorithms in WSNs have become popular field of studies.

Undoubtedly, factors such as system simulation of WSN applications, making various

configurations of nodes and embedding the algorithms into wireless nodes effectively are vital

for developers. In the application development phase of the WSNs, many interfaces and

programs can assist to the developers. One of the appropriate solutions is the usage of Contiki

OS. Contiki OS is an open-source operating system which is Linux based and developed for

Internet of Things (IoT) devices. It has also powerful tools for building complicated wireless

communication systems. Contiki OS has been especially developed for low-powered WSN apps.

In other words, it has been developed for WSN applications that are able to work with AA type

batteries for years. Another specific feature of the Contiki OS is Cooja Network Simulator which

provides simulation environment for developed algorithms. Contiki OS, which has an integrated

structure through these features, presents researcher based solutions for WSN apps that may be

developed. In the next sections of the current paper, background information is given about
WSNs and Contiki OS, then comparative assessments are provided between other alternatives,

finally advantages of usage of Contiki OS are examined.

Literature Review

Wireless sensor networks are distributed systems consisting of small, often battery-powered

sensing devices that communicate using low-power wireless radios. Wireless sensor networks

enable numerous applications ranging from water and bridge monitoring to predictive

maintenance in industry. A vast body of research on sensor networks has yielded numerous

different communication architectures and protocols. The rapid acceptance of sensor networks

for industrial applications has, however, driven focus towards standardization and

interoperability. Due to the proven industrial potential of wireless sensor networks, a number of

standards have emerged during recent years. These include Wireless HART, ZigBee, and IPv6-

based sensor networks.

The standardization of sensor networks makes interoperability a new requirement when

implementing communication stacks and applications. Interoperability is difficult to verify,

however, since sensor network simulators and prototyping tools lack the possibility to simulate

heterogeneous sensor networks. For example, the widely used COOJA simulator only simulates

nodes running the CotikiOS operating system. These tools are thus unable to test the

requirements that have arisen with the vision of an Internet of Things. Instead, vendors today are

required to physically meet to perform black-box testing of their equipment.

To meet the need for white-box testing of interoperability, we extend the Contiki simulator

COOJA and Wireless Sensor Network (WSNs), an instruction level emulator that is integrated
into COOJA. Our simulator extensions enable simulations of heterogeneous sensor networks that

consist of different operating systems and sensor devices. We also extend Wireless Sensor

Network (WSNs) with a power profiling mechanism similar to the software based power profiler

of the Contiki operating system. Our experiments demonstrate that our combined simulator is not

only a feasible tool for interoperability testing; it is also able to power profile nodes running

different operating systems.

Methodology

Wireless Sensor Networks (WSNs)

Main purpose of the WSNs is to sense variable physical phenomena in a certain environment,

then to transmit the information through wireless network. Basic working mechanism of a WSN

node is shown in Figure.

A typical WSN node consists of a microprocessor, a power unit and some blocks like I/O, analog

to digital converter (ADC), communication and memory block. WSNs generally operate in

environmental conditions that must be stand-alone and energy-limited. Hence, power is often
provided by energy harvesting methods such as solar panels, piezoelectric equipment etc. Power

that is obtained by energy harvesting methods might be used for recharging the batteries.

Harvesting methods might be used for recharging the batteries. In WSN, information is sensed

by a node named as end-device that is often at the far point in network. End-devices are

manufactured as Reduced-Functioned Devices (RFDs) and have simple tasks such as sensing

analog information and transmitting it. End-devices transmit information to the more authorized

node in network named as Router. Routers are often manufactured as Full-Functioned Devices

(FFDs). FFDs have the ability to communicate with other RFDs and FFDs. Router which is a

FFD device can get information from the adjacent node and transmit it to another router or

directly to the Coordinator. Coordinator which is the most authorized node in network is

manufactured as FFD. Coordinator or in other words sink can be thought as the gateway of the

network. General architecture of a typical WSN is shown through a scenario in Figure.

In the scenario, fire incidence information that occurred in a forest is sent to the end user through

WSN and the internet. Primarily, fire is sensed by a sensor which is mounted to the end-device.

Then, end-device transmits the information to the neighbor router. Next, information is

transmitted to the coordinator by routers. After that, information which is received by


coordinator is transmitted to the internet and finally the receiver gets the vital information

through the internet.

Contiki Operating System and Its Structure

Contiki OS is an operating system which is developed by Dunkel et al. Contiki OS, which is C

programming language based and open source, has been developed for lightweight, flexible and

low-powered wireless sensor networks. Working environments of the WSNs are often energy-

limited as mentioned. This is one of the most important constraints for WSNs. Likewise, tiny and

simple designs of the nodes are the other constraints. For this reason, WSNs should have some

important hardware and software features to cope with these constraints. Contiki OS is one of the

convenient solutions to cope with mentioned constraints thanks to its flexibility and support of

lightweight and low powered networks.

A standard Contiki configuration for a microcontroller is 2kB RAM and 40 kB ROM. Besides

that, Contiki can provide communication over IPv4, IPv6 and Rime Network Stack. Contiki

Network Stack shown in Figure. Gives more details for its structure. Contiki directory in OS also

provides access to system source codes, sample application codes, practical applications, and

driver codes for many node types, specific microcontroller files and important tools like Cooja.
Thus, besides developing and simulating new projects, Contiki provides the opportunity for

developers to use existing samples directly or modify them. With these features, researchers and

developers would have effective development environment.

Cooja Simulator Environment

Cooja is a WSN simulator which enables simulating the developed applications. Thus,

developers can make their own applications through these codes, drivers and tools.

A screenshot of Cooja environment is provided. While node communication information is

flowing in colored screen which is in the middle window, node communication directions and

communication ranges of the nodes can be seen on the left window.

Wireless Network Sensor in Cooja

In the scenario three wireless nodes, one of the nodes is receiver node and the others are the

energy-limited transmitter nodes, are included. Hence, transmitter nodes would sleep with certain

periods for energy saving. For this kind of Network, usage of the Rime Network Stack is useful

as it has a structure which makes the wireless network communication easy. If rime directory
which is in Contiki OS directory is considered, codes for nodes can be built by modifying the

anonymous broadcast (abc) sample.

For communication of receiver and transmitter nodes in given example, 25th channel (2.475

GHz) which is defined. Transmitter and receiver nodes should be configured separately. For

receiver node, communication channel should be configured as 25th channel and RDC layer in

Contiki Network Protocol Stack should be configured as nullrdc. Required configurations can be

carried out by modifying the project-conf.h file which is in rime directory. Modified project-

conf.h file for receiver node is given in Figure.

Built code for receiver node is shown in Figure. Code lines that were defined by numbers include

general and important details for building a project in Contiki. Code line numbers are explained

as below;

1. PROCESS is one of the most important components for the Contiki. Processes are defined

via PROCESS macros.

2. AUTO_PROCESS starts PROCESS automatically via the given arguments.

3. abc_recv is a function which is used to display received messages. abc_recv ( ) is designated

as a callback function and it is automatically called when a message is received.

4. PROCESS_THREAD is used for proto thread of a process.


5. PROCESS_EXIT HANDLER specifies an action when a process exits. In this example,

quitting receiving mode is an action.

6. Beginning of the process is declared by PROCESS_BEGIN macro. It must always be in the

PROCESS_THREAD definition.

7. PROCESS_END macro is used for quitting from the process.

Transmitters are energy-limited nodes. They should sleep in certain intervals for energy-

saving. For this reason, channel check rate of the transmitter nodes was determined as 8

times in a second. Configuration of the channel check rate provides the sleeping in certain

intervals. Besides, since there are two transmitters, there may be two signals in channel at the

same time. Accordingly, Radio Duty Cycle (RDC) layer in Contiki Network Protocol Stack

should be configured as contikimac.


Thus, transmitter initially listens to channel; if channel is idle then it transmits its own signal.

Required configurations for these were made by changing project-conf.h file. Built codes for

transmitter nodes are seen in Figure.

A random time among 2-4 seconds was determined by etimer_set (struct etimer*, clock_time_t)

function. Thus, event - timer was set up that time interval. Process waits until an event occurs via

PROCESS_WAIT_EVENT_UNTIL (etimer_expired (&et)) function. When event-timer expires,

event occurs and if channel is idle, "Here I am" information is sent as a broadcast message.

Then, "message sent" information is written on information screen.

Written codes for nodes in scenario were compiled and scenario was built in Cooja environment.

Screenshot of the scenario that was carried out in Cooja environment is provided in Figure.
In Figure instantaneously, sender ID2 transmits a broadcast message. While receiver ID1

receives "Here I am" information, sender ID3 waits until channel is idle. When channel goes

idle, sender ID3 transmits its own broadcast message.

In this section, general issues such as structure of the Contiki and the usage of the Contiki have

been explained. In next section, other alternative WSN operating systems are explained and

differences between them are examined.

Analysis and Result

Wire shark is one of the most powerful and open source network analyzer available. It is used to

capture the network traffic and to inspect closely what happens in the network. It has a user-

friendly and configurable GUI with many features. It can decode over 400 protocols and

supports more than 750 protocols. New protocols are being added and it is actively being

developed and maintained. It can run on more than 20 platforms like UNIX, Windows and Mac
OS. It works on promiscuous and non-promiscuous mode. It has the ability to both capture the

network as well as to read the captured file.

It has got rich filter display capacity. With all these features Wireshark stands tall among its

counterparts like Win Dump, Ether Peek, Tepdump, Snoop, Snort, Dsniff, Ettercap, Packetlyzer,

MacSniffer and so on. The pcap file contains the captured traffic details and the pcap file is

captured by the Cooja simulator. Analysis of this pcap file provides a plethora of information

about the network, link, node and the packets.


Discussion

Contiki OS is a lightweight open source operating system for the Internet of Things. It was

developed at the Swedish Institute of Computer Sciences by Adam Dunkels et al. It is written in

the C programing language and all programs for it are also in C. Contiki is a highly portable OS

and it has already been ported to several platforms running on different types of processors. The

most platforms often use Texas Instruments MSP-430 as well as Atmel ATmega series of

microcontrollers. Contiki uses event-driven programming model to handle concurrency. All

processes share one stack, allowing savings of memory.

It is the main advantage of the Contiki. Protothreads are used to realize this model. Protothreads

provide conditional and unconditional blocking wait and they use local continuations to save the

state when it blocks. When the Protothread is resumed, it jumps back to the next instruction.

Contiki supports both IPv6 and IPv4 stack implementations, along with the recent low power

wireless standards: 6lowpan, RPL, CoAP. It also uses Rime stack. It is a lightweight

communication stack for sensor networks and it has thinner layers than traditional stacks.

Recommendation
In other words, Contiki OS and LiteOS are good solutions for the environment which is

dynamically variable. In addition, they have flexible structure for the developers. While Contiki

OS and LiteOS have the modular system, TinyOS has monolithic system. With this aspect,

Contiki OS and LiteOS are more convenient for personal network applications that need to be

modified frequently. From the point of network support view, Contiki OS has IPv4, IPv6 and

Rime network stacks.

With this features, both it is provided to communicate ability over internet for Contiki OS and

presented a lightweight network stack via Rime for low-powered wireless networks. Contiki OS

makes difference with its own Protothread mechanism which is a lightweight thread mechanism.

Lastly, all three operating systems have their own network simulators are compared. But Contiki

OS has three different alternatives which make it popular.

Conclusion

In this study, primarily Contiki OS which is a lightweight, open source operating system

developed for WSN application was reviewed. Then, an example scenario through Cooja in

Contiki OS was explained step by step and finally a comparison with other popular operating

systems such as TinyOS and LiteOS was carried out if we scrutinize Contiki OS, it is obviously

seen that it has powerful tools for building complicated wireless communication systems.

Especially, Rime Network Stack is very important as it presents a lightweight network stack

which is very convenient for low-powered WSN’s. In addition, Protothread mechanism is one of

important factors which make difference. Likewise, flexible structure of Contiki OS and ability

to use in many WSN platforms like cc2538, sky mote, MicaZ, Zolertia Z1 etc. increase its
preferability. This study aimed to provide background information on WSN and Contiki OS and

to build an example scenario for beginners.

References
1. G.C.M. Meijer, Smart Sensor Systems, Wiley, Wiltshire, 55-57, (2008).

2. D. Puccinelli, M. Haenggi, Wireless sensor networks: applications and challenges of


ubiquitous sensing, IEEE Circuits and Systems Magazine, 5(3), 19-31, (2005).

3. A. Pal, Localization algorithms in wireless sensor networks: Current approaches and future
challenges, Network Protocols and Algorithms, 2(1), 45-73, (2010).

4. G. Han, H. Xu, T.Q. Doung, J. Jiang, T. Hara, Localization algorithm for wireless sensor
networks: A survey, Telecommunication System, 52(4), 2419-2436, (2013).

5. M. Ye, C. Li, G. Chen, J. Wu, EECS: An energy efficient clustering scheme in wireless
sensor networks, In Performance, Computing, and Communications Conference, (IPCCC
2005) 24th IEEE International, Arizona, USA, 535-540, April (2005).

6. G. Hacioglu, V.F.A. Kand, E. Sesli, Multi objective clustering for wireless sensor networks,
Expert Systems with Applications, 59, 86-100, (2016).

7. Q. Cao, T. Abdelzaher, J. Stankovic, T. He, The LiteOS operating system: Towards unix-like
abstractions for wireless sensor networks, In Information Processing in Sensor Networks,
IPSN'08. International Conference on IEEE, St. Louis, Missouri, USA, 233-244, April
(2008).

8. T.V. Chien, H. N. Chan, T. N. Huu, A comparative study on operating system for wireless
sensor networks, ICACSIS Conference on IEEE, Jakarta, Indonesia, 73-78, December
(2011).

You might also like