Anda di halaman 1dari 52

Assigned tasks

i.
ii.

ARM based ZigBee vendors details


Simulation of energy efficient WSN routing protocols (Algorithms) using Castalia
Simulator.
Types of routing protocols
Study of Network layer and ieee 802.15.4 standards
Castalia simulator and omnet++ routing protocol simulation Aodv, Leach,
Gpsr, Rel, Labile, installation and simulation steps

iii.

Design and implements of CSMA / CA Algorithm for IEEE 802.15.4 standard in IAR
Embedded workbench for msp430.
Study of IEEE 802.15.4 standard
MAC layer, frame formats, csma/ca
Msp430 board details, some example programs using IAR, CCS
CSMA/CA C code is completed using IAR simulator, CSMA/CA FSM,
Flow chart, problems
TI-MAC simple data transfer between two msp430f5438a experimental boards

iv.

Implement of python GUI for complete sensor data access and controlling the feature
of msp430 and plotting the data.
Smartrf05EB + 2618+cc2520 example programs using CCS
Smartrf studio + packet sniffer

v.
vi.

Task 1:- Simulation of energy efficient WSN routing protocols (Algorithms) using
Castalia Simulator.

CHAPTER -1 INTRODUCTION
Wireless sensor network is a popular area for research now days, due to vast potential usage
of sensor networks in different areas. A sensor network is a comprised of sensing, processing,
communication ability which helps to observe, react to events and phenomena in a specified
environment. This kind of network enables to connect the physical world to environment. By
networking tiny sensor nodes, it becomes easy to obtain the data about physical phenomena
which was very much difficult with conventional ways. Wireless sensor network typically
consist of tens to thousands of nodes. These nodes collect process and cooperatively pass this
collected information to a central location. WSNs have unique characteristics such as low
duty cycle, power constraints and limited battery life, redundant data acquisition,
heterogeneity of sensor nodes, mobility of nodes, and dynamic network topology, etc.
Application of WSNs exists in variety of fields including environmental applications, medical
monitoring, home security, surveillance, military applications, air traffic control, industrial
and manufacturing automation, process control, inventory management, distributed robotics,
etc . Data collected by sensor nodes in a WSN is typically propagated toward a base station
that links the WSN with other networks where the data can be visualized, analyzed, and acted
upon. In small sensor networks where sensor nodes and a gateway are in close proximity,
single-hop communication between all sensor nodes and the gate- way may be feasible.
However, most WSN applications require large numbers of sensor nodes that cover large
areas, necessitating a multi-hop communication approach.

1.1

MOTIVATION

The key challenge in setting up and proper operation of WSN is increase the lifetime of the
network by minimizing the energy consumption. From last few years variety of changes
have been made to limit the energy requirement in WSN, as mainly energy dissipation is
more for wireless transmission and reception [2]. Main approaches till proposed were
focusing at making the changes at MAC layer and network layer to minimize the energy
dissipation. One more major challenge is how to communicate at longer distances. In large
scale sensor networks, multi-hop communication between sensor nodes is necessary to cover
a large monitoring region. Moreover, sensor nodes should be grouped into clusters to enhance
scalability and robustness.
If multi-hopping is used then we can extend coverage due to multi-hop forwarding .To tackle
with all the above mentioned challenges multi hopping have been found the efficient

technique. Multi-hopping is always been referred as an effective method to enhance the


lifetime of WSN by extending battery life due to lower power transmission.
1.2

PROBLEM STATEMENT

The sole purpose of this report is to find the energy efficient method by which we can
communicate at longer distances. Wireless sensor networks are battery operated. Sensor
nodes collect the data and pass them on to the network for further use. This passing and
receiving of data utilizes most of the energy of the network. So for better operation and
increase the lifetime of the network, energy consumption must be the major factor of concern.
In this report new method for communicating at longer distances with the sensor network is
proposed, which is divided into two phases as MAPPING and REDUCING. The MAP
protocol performs mapping or assigning of sensor nodes to clusters and REDUCE protocol
minimizes energy thereby using MAC and NWK protocols.

CHAPTER -2 LITERATURE REVIEW


This section presents an overview of related work in energy efficiency in multihop wireless
Communications. Differences with the approach investigated in this Chapter for energy
efcient cooperative multihop data transmission are outlined. Network topology design in
order to achieve different requirements in a service-oriented framework is considered.
Requirements include throughput maximization, delay constraints, security, and reliability.
Energy minimization constraints are considered. Topology control is also considered in ,
where energy constraints are taken into account via transmit power adjustments. Connectivity
between nodes is determined based on distance considerations. In [5] and [6], energy
efficiency is considered by having a minimum energy path between each pair of nodes in a
wireless multi-hop network. Topology is controlled by varying the transmission power at
each node, and the transmission power at the antenna is considered as the criterion for energy
efficiency. In this Chapter, the energy drained from the sensors batteries, not only the
transmit power at the antenna, is used as the criterion for energy efficiency. Processing
capacity is studied in [7] for wireless sensor networks. A cross-layer collaborative in-network
processing approach among sensors is adopted, where, in addition to processing information
at the application layer, sensors synchronize their communication activities to exchange
partially processed data for parallel processing. Sensor nodes are grouped into clusters, and

operations are performed independently inside each cluster. Communications between


clusters are performed using channels that are orthogonal to intra-cluster communications.
Multi-hop communications are implemented inside each cluster to perform parallel
computing of certain processing tasks. Thus, energy efficiency is considered in the sense of
minimizing the processing power during task scheduling and implementation, not in the sense
of transmissions and receptions for relaying measurement data of sensors, as is the case in
this Chapter.
In [8], energy efficiency is studied in wireless sensor networks. Sensors having data to
transmit should relay this data to a single source using multi-hop. Nodes that do not have data
to transmit or that are not relaying the data of other nodes can be put to sleep. Energy
efficiency is achieved by reducing the number of active nodes. An energy efficient routing
technique in multi-hop wireless sensor networks is presented in. For each node, the energies
consumed during reception, transmission, and sensing are considered in the analysis. In the
model of [9], frame nodes relay the content of the source to the destination. If the
communication fails between the source and a frame node, or between two frame nodes,
assistant nodes come into play and relay the data to the next frame node. Hence the use of
opportunistic transmissions depending on the fading conditions of the channel. The optimal
number of nodes that should be included in a path is determined. The purpose is to reduce the
energy consumption by reducing the number of nodes relaying the data from source to
destination. In the scenario investigated in this Chapter, all nodes are assumed to have data to
transmit, and hence cannot be put to sleep to achieve energy savings. This scenario
corresponds, for example, to WSNs deployed for the purpose of air quality monitoring in
given area, where each sensor will periodically send measurement data to a central processing
System.
Several papers in the literature consider implementation scenarios related to a particular
standard. For short range multi-hop communications, IEEE 802.11s is receiving signicant
attention. In [10], a tutorial is presented for multi-hop communications and mesh capabilities
in IEEE 802.11. Task group 802.11s is handling this issue. In the draft 802.11s proposal the
mesh network is implemented at the link layer and relies on MAC addresses instead IP
addresses, which provides layer-2 multi-hop communication.
In addition to multi-hop, energy efficient clustering methods are also investigated in the
literature. An algorithm is presented in as an improvement on the methods in. In [12], each
node volunteers to be a cluster head in a probabilistic manner, and non-cluster nodes
associate themselves with cluster heads based on the announcements received from these

cluster heads. The actual energy drained from the battery of the device is considered.
However, the problem is not formulated and solved as an optimization problem, but rather an
efficient clustering algorithm that ensures fairness in energy consumption between nodes, due
to the probabilistic selection, is presented.
In the [13] paper, they have investigated, through simulation and experiments on a real test
bed, the performance of IEEE 802.15.4 WSNs when power management is enabled for
energy conservation. They have observed that sensor nodes experience a low communication
reliability in terms of delivery ratio which may prevent the distributed sensing system from
operating properly (e.g., as for a timely detection of events).Referred to this issue as the
MAC unreliability problem as it is originated by the contention-based 802.15.4 MAC
protocol. They found that the problem is essentially due to the Carrier sense multiple access
with collision avoidance (CSMA/CA) algorithm used by the 802.15.4 MAC for channel
access, which is not able to efficiently handle contention when the number of simultaneously
contending nodes is relatively high (a similar problem does not occur when using a Time
Division or polling scheme for channel access). Although this is a problem common to all
contention-based MAC protocols, nevertheless in the 802.15.4 MAC it is made more severe
than in other similar cases (e.g., S-MAC) due to the MAC parameters setting suggested by
the standard.

CHAPTER 3 THEORITICAL DEVELOPMENT


3.1 Wireless Sensor Networks
While many sensors connect to controllers and processing stations directly (e.g., using local
area networks), an increasing number of sensors communicate the collected data wirelessly to
a centralized processing station. This is important since many network applications require
hundreds or thousands of sensor nodes, often deployed in remote and inaccessible areas.
Therefore, a wireless sensor has not only a sensing component, but also on-board processing,
communication, and storage capabilities. When many sensors cooperatively monitor large
physical environments, they form a wireless sensor network (WSN). Sensor nodes
communicate not only with each other but also with a base station (BS) using their wireless
radios, allowing them to disseminate their sensor data to remote processing, visualization,

analysis, and storage systems. For example, Figure 3.1 shows two sensor eld monitoring
two different geographic regions and connecting to the Internet using their base stations.

Figure 3.1 Wireless Sensor Networks


Figure 3.1 Wireless Sensor Networks

The capabilities of sensor nodes in a WSN can vary widely that is, simple sensor nodes may
monitor a single physical phenomenon, while more complex devices may combine many
different sensing techniques (e.g., acoustic, optical, magnetic). They can also differ in their
communication capabilities, for example, using ultrasound, infrared, or radio frequency
technologies with varying data rates and latencies. While simple sensors may only collect and
communicate information about the observed environment, more powerful devices (i.e.,
devices with large processing, energy, and storage capacities) may also perform extensive
processing and aggregation functions. Such devices often assume additional responsibilities
in a WSN, for example, they may form communication backbones that can be used by other
resource-constrained sensor devices to reach the base station. [1]

The definition of WSN, according to, Smart Dust program of Defence Advanced Research
Projects Agency (DARPA) is: A sensor network is a deployment of massive numbers of
small, inexpensive, self-powered devices that can sense, compute, and communicate with
other devices for the purpose of gathering local information to make global decisions about a
physical environment [14].

Wireless Sensor Networks have been widely considered as one of the most important
technologies for the twenty-first century. Enabled by recent advances in micro-electro
mechanical systems (MEMS) and wireless communication technologies, tiny cheap, and
smart sensors deployed in physical area and networked through wireless links and the
Internet provide unprecedented opportunities for a variety of civilian and military
applications, for e.g., environmental monitoring, battlefield surveillance, and industry process
control. WSN have unique characteristics, for e.g., denser level of node deployment, higher
unreliability of sensor nodes and severe energy computation and storage constraints, which
presents many new challenges in the development and applications of WSNs. In the past
decade, WSN have received tremendous attention from both academia and industry all over
the world.
3.1.1 Evolution of Wireless Sensor Network
Sensor network development was initiated by the United States during the Cold War. A
network of acoustic sensors was placed at strategic locations on the bottom of the ocean to
detect and track Soviet submarines. This system of acoustic sensors was called the Sound
Surveillance System (SOSUS). Human operators played an important role in these systems.
The sensor network was wired network that did not have the energy bandwidth constraints of
wireless system. Modern research on sensor networks started around 1980 with the
Distributed Sensor Networks (DSN) program at the DARPA. These included acoustic sensors
communication (a high-level protocols that link processes working on a common application
in a resource-sharing network), processing techniques, algorithms (including self-location
algorithms for sensors), and distributed software (dynamically modifiable distributed systems
and language design). Recent advances in computing and communication have caused a
significant shift in sensor network research and brought it closer to achieving the original
vision. Small and inexpensive sensors based upon micro-electro-mechanical system (MEMS)
technology, wireless networking, and inexpensive low-power processors allow the
deployment of wireless ad hoc networks for various applications. Thus, the program
developed with new networking techniques is suitable for highly dynamic ad hoc
environments.
The organization has defined the IEEE 802.15 standard [15] for personal area networks
(PANs), with personal networks defined to have a radius of 5 to 10 m. Networks of short
range sensors are the ideal technology to be employed in PANs. Furthermore, increases in
chip capacity and processor production capabilities have reduced the energy per bit

requirement

for

both

computing

and

communication.

Sensing,

computing,

and

communications can now be performed on a single chip, further reducing the cost and
allowing deployment in ever-larger numbers.

Sensing and Sensor

Sensing is a technique used to gather information about a physical object or process,


including the occurrence of events (i.e., changes in state such as a drop in temperature or
pressure). An object performing such a sensing task is called a sensor. For example, the
human body is equipped with sensors that are able to capture optical information from the
environment (eyes), acoustic information such as sounds (ears), and smells (nose). These are
examples of remote sensors, that is, they do not need to touch the monitored object to gather
information An example of the steps performed in a sensing (or data acquisition) task is
shown in Figure 3.2. Phenomena in the physical world (often referred to as process, system,
or plant) are observed by a sensor device. The resulting electrical signals are often not ready
for immediate processing; therefore they pass through a signal conditioning stage. Here, a
variety of operations can be applied to the sensor signal to prepare it for further use. For
example, signals often require amplication (or attenuation) to change the signal magnitude
to better match the range of the following analog-to-digital conversion. Further, signal
conditioning often applies lters to the signal to remove unwanted noise within certain
frequency range .After conditioning, the analog signal is transformed into a digital signal
using an analog-to-digital converter (ADC). The signal is now available in a digital form and
ready for further processing, storing, or visualization. Many wireless sensor networks also
include actuators which allow them to directly control the physical world. For example, an
actuator can be a valve controlling the ow of hot water, a motor that opens or closes a door
or window, or a pump that controls the amount of fuel injected into an engine. Such a
wireless sensor and actuator network (WSAN) takes commands from the processing device
(controller) and transforms these commands into input signals for the actuator, which then
interacts with a physical process, thereby forming closed control loop (also shown in Figure
3.2)[1].

Figure 3.2 Data Acquisition and Actuation

Sensor Node Structure


A sensor node typically consists of four basic components: a sensing unit, a processing unit, a
communication unit, and a power unit, which is shown in Fig. 3.3 The sensing unit usually
consists of one or more sensors and analog - to- digital converters (ADCs).The sensors
observe the physical phenomenon and generate analog signals based on the observed
phenomenon. The ADCs convert the analog signals into digital signals, which are then fed to
the processing unit. The processing unit usually consists of a microcontroller or
microprocessor with memory (e.g., Intels Strong ARM microprocessor and Atmels AVR
microprocessor), which provides intelligent control to the sensor node. The communication
unit consists of a short range radio for performing data transmission and reception over a
radio channel. The power unit consists of a battery for supplying power to drive all other
components in the system. In addition, a sensor node can also be equipped with some other
units, depending on specic applications. For example, a global positioning system (GPS)
may be needed in some applications that require location information for network operation.

A motor may be needed to move sensor nodes in some sensing tasks. All these units should
be built into a small module with low power consumption and low production cost.

Figure 3.3 Components of wireless sensor networks

3.1.2 Communication in Wireless Sensor Networks


The well-known IEEE 802.11 family of standards was introduced in 1997 and is the most
common wireless networking technology for mobile systems. It uses different frequency
bands, for example, the 2.4-GHz band is used by IEEE 802.11b and IEEE 802.11g, while the
IEEE 802.11a protocol uses the 5-GHz frequency band. IEEE 802.11 was frequently used in
early wireless sensor networks and can still be found in current networks when bandwidth
demands are high (e.g., for multimedia sensors). However, the high-energy overheads of
IEEE 802.11-based networks make this standard unsuitable for low-power sensor networks.
Typical data rate requirements in sensor networks are comparable to the bandwidths provided
by dial-up modems, therefore the data rates provided by IEEE 802.11 are typically much
higher than needed. This has led to the development of a variety of protocols that better
satisfy the networks need for low power consumption and low data rates. For example, the
IEEE 802.15.4 protocol (Gutierrez et al. 2001) has been designed specically for short range

communications in low-power sensor networks and is supported by most academic and


commercial sensor nodes. When the transmission ranges of the radios of all sensor nodes are
large enough and the sensors can transmit their data directly to the base station, they can form
a star topology as shown on the left in Figure 3.4. In this topology, each sensor node
communicates directly with the base station using a single hop. However, sensor networks
often cover large geographic areas and radio transmission power should be kept at a
minimum in order to conserve energy; consequently, multi-hop communication is the more
common case for sensor networks (shown on the right in Figure 3.4). In this mesh topology,
sensor nodes must not only capture and disseminate their own data, but also serve as relays
for other sensor nodes, that is, they must collaborate to propagate sensor data towards the
base station that is, they must collaborate to propagate sensor data towards the base station.
This routing problem, that is, the task of nding a multi-hop path from a sensor node to the
base station, is one of the most important challenges and has received immense attention
from the research community. When a node serves as a relay for multiple routes, it often has
the opportunity to analyze and pre-process sensor data in the network, which can lead to the
Elimination of redundant information or aggregation of data that may be smaller than the
Original data [1].

Figure 3.4 Single-hop versus Multi-hop communication in sensor networks

Wireless Sensor Network Device Types

IEEE 802.15.4 defines two types of devices. These devices types are shown in Table 1.Listed
in Table 2 are the three types of ZigBee protocol devices as they relate to the IEEE device.

Table 1 IEEE 802.25.4 Device Types


Device Types

Service Offered

Power Source

Receiver Configuration

Full Function Device (FFD)

All

Mains

ON when Idle

Reduced Function Device (RFD)

Limited

Battery

OFF when Idle

Table 2 ZigBee Protocol Device Types


ZigBee Protocol Device Type

IEEE Device Type

Coordinator

FFD

Router

RFD

End

RFD or FFD

Typical Function
One per network. Forms the network,
allocates the network address. Hold the
binding table.
Optional. Extend the physical range of
network. Allows more node to join the
network.
Perform monitoring and/or controlling
functions.

These devices have 64-bit IEEE addresses, with option to enable shorter addresses to reduce
packet size, and work in either of two addressing modes star and peer-to-peer.
1. The ZigBee coordinator node: There is one, and only one, ZigBee coordinator in each
network to act as the router to other networks, and can be likened to the root of a (network)
tree. It is designed to store information about the network.
2. The Full Function Device FFD: The FFD is an intermediary router transmitting data
from other devices. It needs lesser memory than the ZigBee coordinator node, and entails
lesser manufacturing costs. It can operate in all topologies and can act as a coordinator.
3. The Reduced Function Device RFD: This device is just capable of talking in the
network; it cannot relay data from other devices. Requiring even less memory, (no flash, very
little ROM and RAM), an RFD will thus be cheaper than an FFD. This device talks only to a
network coordinator and can be implemented very simply in star topology.

Topology in Wireless Sensor Networks


To construct and maintain an efficient network topology is a very important task in wireless
sensor networks. Instead of transmitting with the maximal power, nodes in a multihop

wireless network collaboratively determine their transmission power and dene the network
topology by forming the proper neighbour relation under certain criteria. This is in contrast to
the traditional network, in which each node transmits with its maximal transmission power
and the topology is built implicitly by routing protocols (that update their routing caches as in
timely a way as possible) without considering the power issue. A desirable network topology
not only reduces energy consumption and prolong network lifetime, but also improves spatial
reuse (and hence the network capacity) and mitigate the medium-access control (MAC) level
contention.
Basically there are following three types of topology in WSN in Fig 3.5:
1.

Star Topology

2.

Mesh or Peer To-Peer Network Topology

3.

Cluster Tree Topology

1. Star Topology.
The star topology consist of a coordinator and several end devices (nodes).In this topology,
the device communicates only with the coordinator. Any packet exchange between two
devices must go through the coordinator .The disadvantage of this topology is the operation
of the network depends upon coordinator of the network, and because all between devices
must go through it, so it may become bottlenecked.
Key attributes Simplicity, low cost, long battery life and Single point of failure.
2. Mesh Topology(Peer To-Peer Network)
It consists of one coordinator, several routers and end devices as shown in fig 3.5.The
following are the characteristics of mesh topology:
A mesh topology is multihop network: packets pass through multiple hops to reach to their
destination.
The range of the network can be increased by increasing more devices to the network.
A mesh topology is self-healing, meaning during transmission, if a path fails, the node will
find an alternate path to the destination.
3. Cluster Tree Topology
A cluster tree topology is a special case of tree topology in which parent with its children is
called cluster as shown in fig 3.5.each cluster is identified by a cluster ID. It consist of a
central node, which is a coordinator, several routers and end devices. The function of router is

to extend network coverage. Disadvantage of this topology is that even if two nodes are
geographically close to each other, they cannot communicate directly.

Figure 3.5 Topology and Device Types in WSN


3.1.3 Network Architecture for Wireless Sensor Networks
A sensor network typically consists of a large number of sensor nodes densely deployed in a
region of interest, base stations that are located close to or inside the sensing region, as shown
in Fig. 3.6. The sink(s) sends queries or commands to the sensor nodes in the sensing region
while the sensor nodes collaborate to accomplish the sensing task and send the sensed data to
the sink(s). Meanwhile, the sink(s) also serves as a gateway to outside networks, for example,
the Internet. It collects data from the sensor nodes, performs simple processing on the
collected data, and then sends relevant information (or the processed data) via the Internet to
the users who requested it or use the information. To send data to the sink, each sensor node
can use single-hop longdistance transmission, which leads to the single - hop network
architecture, as shown in Fig.3.7. However, long - distance transmission is costly in terms of
energy consumption. In sensor networks, the energy consumed for communication is much
higher than that for sensing and computation. For example, the energy consumed for

transferring one bit of data to a receiver at 100 m away is equal to that needed to execute
3,000 instructions [16]. The ratio of energy consumption for communicating 1 bit over the
wireless medium to that for processing the same bit could be in the range of 1,000 10,000
[17, 18]. Therefore, it is desired to reduce the amount of traffic and transmission distance in
order to increase energy savings and prolong network lifetime.

Figure 3.6 Sensor Network Architecture

Figure 3.7 Single Hop Network Architecture


For this purpose, multihop short - distance communication is highly preferred. In most sensor
networks, sensor nodes are densely deployed and neighbour nodes are close to each other,
which makes it feasible to use short - distance communication. In multihop communication, a
sensor node transmits its sensed data toward the sink via one or more intermediate nodes,

which can reduce the energy consumption for communication. The architecture of a multihop
network can be organized into two types: at and hierarchical.

Flat Architecture. In a at network, each node plays the same role in performing a

sensing task and all sensor nodes are peers. Due to the large number of sensor nodes, it is not
feasible to assign a global identier to each node in a sensor network. For this reason, data
gathering is usually accomplished by using data-centric routing, where the data sink transmits
a query to all nodes in the sensing region via ooding and only the sensor nodes that have the
data matching the query will respond to the sink. Each sensor node communicates with the
sink via a multihop path and uses its peer nodes as relays. Figure 3.8 illustrates the typical
architecture of a at network.

Figure 3.8 Flat Network Architecture

Hierarchical Architecture. In a hierarchical network, sensor nodes are organized

into clusters, where the cluster members send their data to the cluster heads while the cluster
heads serve as relays for transmitting the data to the sink. A node with lower energy can be
used to perform the sensing task and send the sensed data to its cluster head at short
distance, while a node with higher energy can be selected as a cluster head to process the
data from its cluster members and transmit the processed data to the sink. This process can
not only reduce the energy consumption for communication, but also balance traffic load
and improve scalability when the network size grows. Since all sensor nodes have the same

transmission capability, clustering must be periodically performed in order to balance the


traffic load among all sensor nodes. Moreover, data aggregation can be performed at cluster
heads to reduce the amount of data transmitted to the sink and improve the energy
efficiency of the network. The major problem with clustering is how to select the cluster
heads and how to organize the clusters. In this context, there are many clustering strategies.
According to the distance between the cluster members and their cluster heads, a sensor
network can be organized into a single - hop clustering architecture or a multihop clustering
architecture, as shown in Figs.3.9.

Figure 3.9 Single Hop clustering Architecture

3.1.4 Characteristics of Wireless Sensor Networks


WSNs have some unique characteristics. These are:

Sensor nodes are small-scale devices with volumes approaching a cubic millimeter in

the near future. Such small devices are very limited in the amount of energy they can store
or harvest from the environment.

Nodes are subject to failures due to depleted batteries or, more generally, due to

environmental influences. Limited size and energy also typically means restricted resources
(CPU performance, memory, wireless communication bandwidth and range).

Node mobility, node failures, and environmental obstructions cause a high degree of

dynamics in WSN. This includes frequent network topology changes and network
partitions. Despite partitions, however, mobile nodes can transport information across
partitions by physically moving between them.

The resulting paths of information flow might have unbounded delays and are

potentially unidirectional. Communication failures are also a typical problem of WSN.

Another issue is heterogeneity. WSN may consist of a large number of rather different

nodes in terms of sensors, computing power, and memory.

The large number raises

scalability issues on the one hand, but provides a high level of redundancy on the other
hand. Also, nodes have to operate unattended, since it is impossible to service a large
number of nodes in remote, possibly inaccessible locations.
3.1.5 Challenges and Constraints of Wireless Sensor Networks
While sensor networks share many similarities with other distributed systems, they are
subjected to a variety of unique challenges and constraints. These constraints impact the
design of a WSN, leading to protocols and algorithms that differ from their counterparts in
other distributed systems. This section describes the most important design constraints of a
WSN.

Energy

The constraint most often associated with sensor network design is that sensor nodes operate
with limited energy budgets. Typically, they are powered through batteries, which must be

either replaced or recharged (e.g., using solar power) when depleted. For some nodes, neither
option is appropriate, that is, they will simply be discarded once their energy source is
depleted. Whether the battery can be recharged or not signicantly affects the strategy
applied to energy consumption. For non-rechargeable batteries, a sensor node should be able
to operate until either its mission time has passed or the battery can be replaced. As a
consequence, the rst and often most important design challenge for a WSN is energy
efficiency. This requirement permeates every aspect of sensor node and network design.

Self-Management

It is the nature of many sensor network applications that they must operate in remote areas
and harsh environments, without infrastructure support or the possibility for maintenance and
repair. Therefore, sensor nodes must be self-managing in that they congure themselves,
operate and collaborate with other nodes, and adapt to failures, changes in the environment,
and changes in the environmental stimuli without human intervention.

Wireless Networking

The reliance on wireless networks and communications poses a number of challenges to a


sensor network designer. For example, attenuation limits the range of radio signals, that is, a
radio frequency (RF) signals fades (i.e., decreases in power) while it propagates through a
medium and while it passes through obstacles.

Decentralized Management

The large scale and the energy constraints of many wireless sensor networks make it
infeasible to rely on centralized algorithms (e.g., executed at the base station) to implement
network management solutions such as topology management or routing. Instead, sensor
nodes must collaborate with their neighbors to make localized decisions, that is, without
global knowledge. As a consequence, the results of these decentralized (or distributed)
algorithms will not be optimal, but they may be more energy-efficient than centralized
solutions.
Consider routing as an example for centralized and decentralized solutions. A base station
can collect information from all sensor nodes, establish routes that are optimal (e.g., in terms
of energy), and inform each node of its route. However, the overhead can be signicantly,
particularly if the topology changes frequently. Instead, a decentralized approach allows each
node to make routing decisions based on limited local information (e.g., a list of the nodes

neighbours, including their distances to the base station). While this decentralized approach
may lead to no optimal routes, the management overheads can be reduced signicantly.

Design Constraints

While the capabilities of traditional computing systems continue to increase rapidly, the
primary goal of wireless sensor design is to create smaller, cheaper, and more efficient
devices. Driven by the need to execute dedicated applications with little energy consumption,
typical sensor nodes have the processing speeds and storage capacities of computer systems
from several decades ago. The need for small form factor and low energy consumption also
prohibits the integration of many desirable components, such as GPS receivers. These
constraints and requirements also impact the software design at various levels, for example,
operating systems must have small memory footprints and must be efficient in their resource
management tasks. However, the lack of advanced hardware features (e.g., support for
parallel executions) facilitates the design of small and efficient operating systems. A sensors
hardware constraints also affect the design of many protocols and algorithms executed in a
WSN. [1]
3.1.6 Applications of Wireless Sensor Networks
Wireless sensor networks have inspired many applications. Some of them are futuristic while
a large number of them are practically useful. They are:
1.

Structural Health Monitoring

2.

Traffic Control

3.

Health Care

4.

Pipeline Monitoring

5.

Precision Agriculture

6.

Active Volcano

7.

Underground Mining

3.1.7 Protocol Stack for Wireless Sensor Networks


The protocol stack used by the base station and sensor nodes is shown in Figure. 3.10. This
protocol stack combines power and routing awareness, integrates data with networking
protocols, communicates power efficiently through the wireless medium, and promotes
cooperative efforts of sensor nodes. The protocol stack consists of the physical layer, data
link layer, network layer, transport layer, application layer, power management plane,
mobility management plane and task management plane. The physical layer should meet

requirements like carrier frequency generation, frequency selection, signal detection,


modulation and data encryption, transmission and receiving mechanisms.
The Data Link Layer should meet the requirements for medium access, error control,
multiplexing of data streams and data frame detection. It also ensures reliable point to point
and point to multi-hop connections in the network. The MAC layer in the data link layer
should be capable of collision detection and use minimal power. The network layer is
responsible for routing the information received from the transport layer i.e. finding the most
efficient path for the packet to travel on its way to a destination.
The Transport Layer is needed when the sensor network intends to be accessed through the
internet. It helps in maintaining the flow of data whenever the application requires it.

ISO /OSI Model

Wireless
Networking
Protocol Stack

Application
Network Layer
Data Link Layer
PHY Layer

Specification
defined by
ZigBee Alliance

Specification
defined by
IEEE 802.15.4

Figure3.10 Protocol Stack of WSN


The application layer is responsible for presenting all required information to the application
and propagating requests from the application layer down to the lower layers. The application
layer software depends on the deployment and use of sensor networks.

3.1.8 Wireless Sensor Network Standards


To facilitate the worldwide development and application of WSNs, there is a need for
building a large low - cost market for sensor products in the eld. For this purpose, it is

important to specify relevant standards so that sensor products from different manufacturers
may interoperate. A lot of efforts have been made and are under way in many standardization
organizations in order to unify the market, leading to low - cost and interoperable devices,
and avoiding the proliferation of proprietary incompatible network protocols. To a certain
extent, the success of WSNs as a technology will largely rely on the success of these
standardization efforts.
The IEEE 802.15.4 Standard. The IEEE 802.15.4 is a standard developed by IEEE
802.15 Task Group 4, which species the physical and MAC layers for low - rate WPANs.
As dened in its Project Authorization Request, the goal of Task Group 4 is to provide a
standard for ultralow complexity, ultralow cost, ultralow power consumption, and low - data
rate wireless connectivity among inexpensive devices. The rst release of the IEEE
802.15.4 standard was delivered in 2003 and is freely distributed. This release was revised
in 2006, but the new release is not yet freely distributed. Its protocol stack is simple and
exible, and does not require any infrastructure. The standard has the following features

Data rates of 250 kbps, 40 kbps, and 20 kbps.

Two addressing modes: 16 - bit short and 64 - bit IEEE addressing.

Support for critical latency devices, for example, joysticks.

The CSMA - CA channel access.

Automatic network establishment by the coordinator.

Fully handshaking protocol for transfer reliability.

Power management to ensure low - power consumption.

Some 16 channels in the 2.4 - GHz ISM band, 10 channels in the 915 MHz band,
and 1 channel in the 868 - MHz band.

The ZigBee Standard. The IEEE 802.15.4 standard only denes the physical and
MAC layers without specifying the higher protocol layers, including the network and
application layers. The ZigBee standard is developed on top of the IEEE 802.15.4 standard
and denes the network and application layers. The network layer provides networking
functionalities for different network topologies, and the application layer provides a
framework for distributed application development and communication. The two protocol
stacks can be combined together to support short range low data rate wireless
communication with battery powered wireless devices.

The potential applications of these standards include sensors, interactive toys, smart badges,
remote controls, and home automation.
The ZigBee protocol stack was proposed at the end of 2004 by the ZigBee Alliance , an
association of companies working together to enable reliable, cost - effective, low - power,
wirelessly networked, monitoring, and control products based on an open global standard.
The rst release of ZigBee was revised at the end of 2006, which introduces extensions on
the standardization of application proles and some minor improvements to the network and
application layers.

3.2
MEDIUM ACCESS CONTROL
Medium access control (MAC) is one of the critical issues in the design of wireless sensor
networks (WSNs).As in most wireless networks, collision, which is caused by two nodes
sending data at the same time over the same transmission medium, is a great concern in
WSNs. To address this problem, a sensor network must employ a MAC protocol to arbitrate
access to the shared medium in order to avoid data collision from different nodes and at the
same time to fairly and efficiently share the bandwidth resources among multiple sensor
nodes. Therefore, a MAC protocol plays an important role in enabling normal network
operation and achieving good network performance.
OBJECTIVE OF MAC DESIGN
The basic function of a MAC protocol is to arbitrate access to a shared medium in order to
avoid collisions from different nodes. In addition to this basic function, a MAC protocol
must also take into account other factors in its design in order to improve network
performance and provide good network services for different applications. In WSNs, these
mainly include energy efficiency, scalability, adaptability, channel utilization, latency,
throughput, and fairness [19].

Energy Efficiency. Energy efficiency is one of the most important factors that must be

considered in MAC design for sensor networks. It refers to the energy consumed per unit of
successful communication. Since sensor nodes are usually battery powered and it is often
very difficult or impossible to change or recharge batteries for sensor nodes, a MAC
protocol must be energy efficient in order to maximize not only the lifetime of individual
sensor nodes, but also the lifetime of the entire network.

Scalability. Scalability refers to the ability to accommodate the change in network size.

In sensor networks, the number of sensor nodes deployed may be on the order of tens,
hundreds, or thousands. A MAC protocol must be scalable to such changes in network size.

Adaptability. Adaptability refers to the ability to accommodate the changes in node

density and network topology. In sensor networks, node density can be very high. A node
may fail, join, or move, which would result in changes in node density and network
topology. A MAC protocol must be adaptive to such changes efficiently.

Channel Utilization. Channel utilization refers to the bandwidth utilization for

effective communication. Due to limited bandwidth, a MAC protocol should make use of
the bandwidth as efficiently as possible.

Latency. Latency refers to the delay from the time a sender has a packet to send until

the time the packet is successfully received by the receiver. In sensor networks, the
importance of latency depends on different applications. While it is true that latency is not a
critical factor for some applications (e.g., data collection for scientic exploration), many
applications may have stringent latency requirements (e.g., real - time monitoring of bush
res).

Throughput. Throughput refers to the amount of data successfully transferred from a

sender to a receiver in a given time, usually measured in bits or bytes per second. It is
affected by many factors, for example, the efficiency of collision avoidance, control
overhead, channel utilization and latency. Like latency, the importance of throughput
depends on different applications.

Fairness. Fairness refers to the ability of different sensor nodes to equally share a

common transmission channel. In some traditional networks, it is important to achieve


fairness for each user in order to ensure the quality of service for their applications. In
sensor networks, however, all nodes cooperate to accomplish a single common task. What is
important is not to achieve per - node fairness, but to ensure the quality of service for the
whole task.

Among all these factors, energy efficiency, scalability, and adaptability are the most
important for the MAC design of sensor networks. In particular, energy consumption is the
primary factor affecting the operational lifetime of individual nodes and the entire network.
The overall performance of a sensor network highly depends on the energy efficiency of the

network. Therefore, energy efficiency is of primary importance in sensor networks. For this
purpose, it is even worth trading some network performance for energy efficiency.

ENERGY EFFICIENCY IN MAC DESIGN

In general, energy consumption occurs in three aspects: sensing, data processing, and data
communication, where data communication is a major source of energy consumption.
According to Ref. [20], it consumes 3 J of energy to transmit 1 - Kb data over a distance of
100

m. In contrast, a general purpose processor with a processing capability of 100

million instructions per second can process 300 million instructions with the same amount
of energy. For this reason, it is desired to reduce data communication as much as possible in
a sensor network. Thus, sensor nodes can use their processing capability to locally perform
simple data processing, instead of sending all raw data to the sink(s) for processing, and
then transmit partially processed data to the sink(s) for further processing. On the other
hand, an efficient MAC protocol can improve energy efficiency in data communication and
prolong the lifetime of a sensor network. To design energy - efficient MAC protocol, it is
important to identify the major sources of energy waste in sensor networks from the MAC
perspective.

According to Ref. [21], energy waste comes from four major sources:

collision, overhearing, control overhead, and idle listening.

Collision. Collision occurs when two sensor nodes transmit their packets at the same

time. As a result, the packets are corrupted and thus have to be discarded. Retransmissions
of the packets increase both energy consumption and delivery latency.

Overhearing. Overhearing occurs when a sensor node receives packets that are

destined for other nodes. Overhearing such packets results in unnecessary waste of energy
and such waste can be very large when traffic load is heavy and node density is high.

Idle Listening. Idle listening occurs when a sensor node is listening to the radio

channel to receive possible data packets while there are actually no data packets sent in the
network. In this case, the node will stay in an idle state for a long time, which results in a
large amount of energy waste.
However, in many MAC protocols, for example, IEEE 802.11 ad hoc mode or CSMA, a
node has to listen to the channel to receive possible data packets. There are reports that idle
listening consumes 50 100% of the energy required for receiving data traffic. For
example, Stemm and Katz [10] reported that the idle: receive: send ratios are 1 : 1.05 :

1.4, while in the Digitan 2 - Mbps wireless LAN module (IEEE 802.11/2 Mbps)
specication the ratios are 1 : 2 : 2.5 [22] .

Control Overhead. A MAC protocol requires sending, receiving, and listening to a

certain necessary control packets, which also consumes energy not for data communication.

3.2.1 ENERGY EFFICIENT MAC PROTOCOLS FOR WIRELESS SENSOR NETWORKS


According to the underlying control mechanism for collision avoidance, MAC protocols can
be typically classied into two broad categories: contention free and contention based. In
the rst category, MAC protocols provide a medium sharing approach that ensures that only
one device accesses the wireless medium at any given time. This category can further be
divided into xed and dynamic assignment classes, indicating whether the slot reservations
are xed or on demand. In contrast to contention-free techniques, contention-based
protocols allow nodes to access the medium simultaneously, but provide mechanisms to
reduce the number of collisions and to recover from such collisions. Finally, some MAC
protocols do not easily t into this classication since they share characteristics of both
contention-free and contention based techniques. These hybrid approaches often aim to
inherit the advantages of these main categories, while minimizing their weaknesses. [1]

Figure: Categories and Examples of MAC

Figure: Classification of Routing Protocols

Network structure
Flat:- all nodes are equal
Hierarchical:- different roles for different nodes
Location based:- nodes rely o location information
Route discovery
Reactive (on-demand):-find route only when needed
Proactive(table-driven):-establish routes before they are needed
Hybrid :-protocols with reactive and proactive characteristics
Protocol operation
Negotiation-based:-negotiate data transfers before they occur
Multi-path:-use multiple routes simultaneously
Query-based:-receiver-initiated
Qos-based:-satisfy certain Qos constraints
Coherent-based:-perform only minimum amount of in-network processing
Flat Architecture. In a at network, each node plays the same role in performing a

sensing task and all sensor nodes are peers. Due to the large number of sensor nodes, it is not
feasible to assign a global identier to each node in a sensor network. For this reason, data
gathering is usually accomplished by using data-centric routing, where the data sink transmits
a query to all nodes in the sensing region via ooding and only the sensor nodes that have the
data matching the query will respond to the sink. Each sensor node communicates with the
sink via a multihop path and uses its peer nodes as relays. Figure 3.8 illustrates the typical
architecture of a at network.

Figure 3.8 Flat Network Architecture

Hierarchical Architecture. In a hierarchical network, sensor nodes are organized

into clusters, where the cluster members send their data to the cluster heads while the cluster
heads serve as relays for transmitting the data to the sink. A node with lower energy can be
used to perform the sensing task and send the sensed data to its cluster head at short
distance, while a node with higher energy can be selected as a cluster head to process the
data from its cluster members and transmit the processed data to the sink. This process can
not only reduce the energy consumption for communication, but also balance traffic load
and improve scalability when the network size grows. Since all sensor nodes have the same
transmission capability, clustering must be periodically performed in order to balance the
traffic load among all sensor nodes. Moreover, data aggregation can be performed at cluster
heads to reduce the amount of data transmitted to the sink and improve the energy
efficiency of the network. The major problem with clustering is how to select the cluster
heads and how to organize the clusters. In this context, there are many clustering strategies.
According to the distance between the cluster members and their cluster heads, a sensor
network can be organized into a single - hop clustering architecture or a multi-hop
clustering architecture, as shown in Figs.3.9.

Figure 3.9 Single Hop clustering Architecture

AODV: - Adhoc On-Demand Distance Vector routing protocol, it is an improvement on the


DSDV algorithm. It is a reactive routing protocol that uses an on-demand approach to find
and establish routes. AODV maintains routes as long as they are needed by the source nodes
and it is considered one of the best routing protocols in terms of power consumption and
establishing the shortest path. However, it is principally used for ad-hoc networks, but now a
days it is widely used in WSN as well in AODV, each node periodically broadcasts HELLO
messages to its neighboring nodes and then uses these neighbors to establish routing and send
messages. In case there is a message wanting to be sent to some nodes which are not
neighbors to the source node, the source node finds a path to the destination by sending a
Route Request Message (RREQ) to its neighbors. Although the control traffic messages are
dramatically reduced in AODV protocol because of the fact that nodes initiate a route
discovery process just when it is required, multiple RREP messages in replay to one RREQ
message lead to heavy control overhead periodic. Also, the hello message leads to
unnecessary bandwidth consumption
Installation steps for AODV using Castalia:i.

Install omnet-4.2.2

ii.

Install castalia-3.2

iii.

Copy the file adjustmentfile.patch to the Castalia folder


Eq: home/user/Castalia-3.2

iv.

Copy the folder Aodv Routing to the following path


Castalia-3.2/source/node/communication/routing

v.

Copy the folder Aodv to the following path


Castalia-3.2/Simulation

vi.

Type $ make clean

vii.

Type $ ./makemake

viii.

Type $ make

Outputs:1. Simulation of AODV to follow the above steps then start the simulation of AODV
../../bin/Castalia c General naresh.txt
Running configuration 1/1

Above file we can visualize the various parameters for initializing, such as energy levels, no.
of nodes, simulation time, and transmitted output power

2. These are the available outputs of different modules and to find the latency using this
command
../../bin/CastaliaResults i naresh.txt s latency

3. Packets received for node


../../bin/CastaliaResults i naresh.txt s packets
../../bin/CastaliaResults i naresh.txt s packets n (this is for finding number nodes)

4. TX packets
../../bin/CastaliaResults i naresh.txt s tx
../../bin/CastaliaResults i naresh.txt s tx n (to finding how many nodes are
connected)

5. Rx packets breakdown
../../bin/CastaliaResults i naresh.txt s rx -n

6. To finding consumed energy of all nodes individually


../../bin/CastaliaResults -i naresh.txt s energy -n

7. TunableMac packet breakdown


../../bin/CastaliaResults i naresh.txt s tunable -n

LEACH :- (Low Energy Adaptive Clustering Hierarchical)


The current interest in wireless sensor networks has led to the emergence of many application
oriented protocols of which LEACH is the most aspiring and widely used protol. LEACH can
be described as combination of a cluster-based architecture and multi-hop routing. The term
cluster-based can be explained by the fact that sensors using the LEACH protocol unctions
are based on cluster heads and cluster members. Multi-hop routing is routing is used for intercluster communication with cluster heads and base stations. Simulation results shown in that
multi-hop routing consumes less energy when compared to direct transmission.We have
stated that wireless sensors sense data, aggregate them and then send data to the base station
from a remote area using the radio transmission scheme as communication medium. Data
which is collected by the sensors is sent sensors is sent to the base station. During this process
a lot of problematic issues occur, such as data collision and the data aggregation. LEACH is
ellsuited to reduce the data aggregation issues using a local data fusion which performs a
compression of the amount of data that is collected by the cluster head before it sends it to the
base station. All sensors form a self-organized network by sharing the role of a cluster head at
least once. Cluster head is majorly responsible for sending the data that is collected by the
sensors to the base station. It tries to balance the energy dissipation within the network and
enhances the networks life time by improving the life time of the sensors.

LEACH Step
by Step

Cluster
Header
Selection

Cluster
Formation

Steady State
Phase

The operations that are carried out in the LEACH protocol are divided into two stages, the
setup phase and the steady-state phase.
Setup phase: - In the set up phase, all the sensors within a network group themselves into
some cluster regions by communicating with each other through short messages. At a point of
time one sensor in the network acts as a cluster head and sends short messages within the
network to all the other remaining sensors. The sensors choose to join those groups or regions
that are
formed by the cluster heads, depending upon the signal strength of the messages sent by the
cluster heads. Sensors interested in joining a particular cluster head or region respond back to
the cluster heads by sending a response signal indicating their acceptance to join. Thus the
set-up phase completes
The cluster head can decide the optimal number of cluster members it can handle or
requires. Before it enters the steady-state phase, certain parameters are considered, such as
the network topology and the relative costs of computation versus the communication. A
TDMA Schedule is applied to all the members of the cluster group to send messages to the
cluster head, and then to the cluster head towards the base station. Figure 2 below shows two
phases of a sensor in a LEACH protocol: all the sensors form as cluster members to the
cluster heads and in the second phase cluster heads perform the transmission of data to the
sink in a multi-hop structure.
Setup phase main aim is clusters organization and cluster headers (CHs) selection

Cluster members

Fig: Setup phase

Cluster Header (CHs)

Steady State Phase: - As soon as a cluster head is selected for a region, all the cluster
embers of that region send the collected or sensed data in their allotted TDMA slots to the
cluster head. The cluster head transmits this collected data in a compressed format to the base
station which completes the second phase, called the Steady State Phase. Once the steadystate finishes the data transmission to the sink, the whole process comes to an end and a new
search for the forming of cluster heads for a region and new cluster-member formation
begins. In short, it can be said that a new set/up phase and steady state starts with the end of
data transmission done to the sink. This alternative selection of cluster heads within the
region, which is carried among the sensors in a self-organized way helps in reducing or
lowering the energy that is utilized. There is a possibility that all the sensors might not be too
close to the cluster head so the amount of energy that is utilized by the farther sensor is not
equal to the amount of energy utilized by the nearest node. In order to minimize this, cluster
heads formation or the role of cluster head is performed by a rotation among all the nodes in
the group. LEACH minimizes global energy usage by distributing the load of the network to
all the nodes or cluster members at different intervals.
All the cluster heads send the data which is collected towards the base station in a
compressed format. All the cluster heads may not be close to the base station so they send the
compressed data to the neighbouring cluster heads, and in this way, a multi-hop routing
network is formed. LEACH plays a randomized rotation of the cluster head in order to save
the high energy that is dissipated while transmitting data to the base station. This rotation is
observed within all the sensors so as not to drain the energy or battery of a single sensor.

Cluster members
Cluster Header (CHs)

Fig: Steady State Phase

Steps to Simulate LEACH:i.


ii.
iii.

Install omnet-4.2.2
Install castalia-3.2
Copy the file adjustmenFile.patch to the Castalia folder
Eq: home/user/Castalia-3.2
iv.
Open the prompt go to the Castalia folder and type the following command
patch p0 i adjustmentFile.patch
v. Copy the folder leach Routing to the following path
Castalia-3.2/source/node/communication/routing
vi.
Copy the folder leach to the following path
Castalia-3.2/Simulation
1. LEACH General .ini file

2. General created output text file

3. Command for finding latency for 100 nodes


../../bin/CastaliaResults - i 100nodes.txt s latency

4. Command for finding Packets received for node tested 100 nodes
../../bin/CastaliaResults - i 100nodes.txt s packets

5. Command for Rx packets break down


../../CastaliaResults - i 100nodes.txt s rx -n

6. Command for Consumed Energy


../../bin/CastaliaResults - i 100nodes.txt - s energy - n

TASK 2: simulation of IEEE 802.15.4 MAC CSMA/CA Algorithm using IAR


Embedded workbench for msp430
IEEE 802.15.4 MAC Frame formats: - This subclause specifies the format of the MAC
frame (MPDU). Each MAC frame consists of the following basic components.
a) A MHR which comprises frame control, sequence number, address information, and
security related information
b) A MAC payload, of variable length, which contains information specific to the frame
type acknowledgement frames do not contain a payload.
c) A MFR, which contains a FCS
Basically there are four frame formats
I.
II.
III.
IV.

Data frame :- used for all transfers of data


Beacon frame :- generated by the coordinator for synchronization
Acknowledge frame :- used for confirming successful frame reception
Mac Command frame: - used for communication and negotiation between MAC
entities on different devices.

MAC General Frame Structure:-

PHY Layer

MAC
Layer

Payload

Synch. Header
(SHR)

PHY Header
(PHR)

MAC Header
(MHR)

MAC Service Data Unit


(MSDU)

MAC Footer
(MFR)

MAC Protocol Data Unit (MPDU)


PHY Service Data Unit (PSDU)

Introduction of IEEE 802.15.4 MAC CSMA/CA Algorithm: - CSMA/CA is Carrier Sense


Multiple Access Collision Avoidance it is a one of the channel accessing mechanism
algorithm

Superframe structure:-

The IEEE 802.15.4 standard allows the optional use of a superframe structure. The format of
the superframe is defined by the coordinator. The superframe is bounded by network beacons
sent by the coordinator and is divided into 16 equally sized slots. Optionally, the superframe
can have an active and an inactive portion. During the inactive portion, the coordinator may
enter a low-power mode. The beacon frame is transmitted in the first slot of each superframe.
If a coordinator does not wish to use a superframe structure, it will turn off the beacon
transmissions. The beacons are used to synchronize the attached devices.
The superframe can have an active and an inactive portion. The active portion
consists of CAP (Contention Access Period) and CFP (Contention Free Period). Any device
wishing to communicate during the CAP shall compete with other devices using a slotted
CSMA/CA mechanism. On the other hand, the CFP contains GTS (guaranteed time slots).
The length of the superframe calculates that using the BO (Beacon Order) and the SO
(Superframe Order) in the PIB (PAN Information Base). The length of the superframe is
following:
BI = aBaseSuperframeDuration 2BO symbols, if 0BO14
SD = aBaseSuperframeDuration 2SO symbols, if 0SOBO14
The channel accessing mechanisms are basically two types there are beacon enabled and nonbeacon enable. The super frame order is less than 15 then that is beacon enabled mode called
as slotted cama/ca algorithm. Super frame order is greater than 15 that is unslotted csma/ca
algorithm
IEEE 802.15.4 MAC CSMA/CA Algorithm flow chart:-

CSMA/CA
NB=0
CW=2

Battery
life
Extension ?

BE= min(2,macMinBE )

Step 1

BE=macMinBE
Locate backoff period
boundary
Delay for
random(2BE-1 ) unit
backoff period

Step 2

Perform CCA on
backoff period
boundary

Step 3

Channel idle ?
N

Step 4

Step 5

CW=2 , NB=NB+1
BE=min(BE+1,macMaxBE)

CW=CW-1

NB>
macMaxCSMA
Backoffs?

CW=0?

Failure

success

Steps:Step1:- initialization of the algorithm variables: NB equal to 0, CW=2 and BE is set to the
minimum value between 2 and MAC sub layer constant (macMinBE)
Step2:- After locating a back off boundary, the algorithm waits for a random defined number
of back off periods before attempting to access the medium
Step3:- Clear channel Assessment (CCA) to verify if the medium is idle or not

Step4:- The CCA returned a busy channel; thus NB is incremented by 1 and the algorithm
must start again in step 2
Step5:- The CCA returned an idle channel, CW is decremented by 1 and when it reaches 0
the message is transmitted, otherwise the algorithm jumps to step 3
CSMA/CA Mechanism : If superframe structure is used in the PAN , the slotted CSMA/CA is used
CSMA/CA Algorithm is implemented using units of time called backoff period, each
of length aunit BackoffPeriod(=20 symbols times=320us in 2.4 GHz channels)
10 bytes can be transmitted in one backoff period.
Sensing and transmitting must be started at the boundary of each backoff period
The CSMA/CA mechanism is based on backoff periods (with the duration of 20
symbols). Three variables are used to schedule medium access:
CW: - Contention window is the no. of backoff periods, which need to be clear of
channel activity before the transmission can commence. MAC ensures this by
performing clear channel assessment(CCA)
BE:- Backoff exponent, before performing CCA , a node takes backoff of
random(0,2BE - 1) BE is initialized to lesser of 2 and macMinBE
NB:- NB is number of backoff , if NB is greater than macMaxCSMABackoffs , the
CSMA/CA algorithm terminates with failure states
CSMA/CA Problems:a) Node B increases exponential Backoff range
b) As node B performs redundant Backoffs
c) Also node B increases probability transmission failure (because transmission fails on
nodes fifth try )
d) As a result, such a meaningless backoffs consume energy

Coordinator
Random Backoff
in the range to 2BE

Node A

CCA

Random Backoff
in the range to 2BE

Node B

Random Backoff in
the range to 2BE-1

Random Backoff in
the range to 2BE-2

Random Backoff in
the range to 2BE-3

CCA

Random Backoff
in the range to 2BE

Node C

Random Backoff
in the range to 2BE

CCA

FSM Diagram of CSMA/CA:-

SLEEP
End of active period
Beacon timer expires

All the TX states

CAP starts

BEACON
ACQUIREMENT/
TRANSMISSION

End of active
period

CAP starts
ACK transmitted
ACK_TX

RX

Required ACK

TXNTRIG Enabled
Locate for
Backoff Period
Boundary

(No free channel &&


NB>macMaxCSMABackoff)

ACK received ||(NO ACK within


TIME_ACK_WAITING &&
NR>=MAX_FRAME_RETRIES))
(NO ACK within
Do not require ACK
TIME_ACK_WAITIN
G && NR
ACK_WAITING
<MAX_FRAME_RET
RIES)

(No free channel &&


NB<=macMaxCSMABackoff)

BACKOFF

Require ACK

Timer expires
CCA on backoff
period boundary

Channel free &&


CW=0

TX on backoff
period boundary

Channel free &&


CW!=0

In this Finite state machine diagram basically there are transmission state and reception state
this diagram describes how to do the process of sending and receiving data using csma/ca.
General MAC frame communication between Coordinator and Device

IEEE 802.15.4 defines how communication occur between Coordinator(FFD) and


Devices(RFD).At first Coordinator send the beacon request to all the devices( sensor Nodes)
for association with in a range. Devices then responds to coordinator by giving
acknowledgement frame if required. Then device start sending the MAC Command frames
which can be Association request if new device wants to add the network, Disassociation
notification, Data request, PAN ID conflict notification and Orphan notification. If more than
one device wants to send data to coordinator then CSMA/CA is applied for avoiding
Collision. Device can only receive association response while it can receive and transmit
dissociation notification as shown in Table1. Therefore according to whatever command is
send by device processing of that type of command will occur. This process will continue till
the GTS which is allocated to device is over.

RFD(Device)

Command frame
identifier

Command name
Tx

0x01

Association request

0x02

Association response

0x03

Disassociation notification

0x04

Data request

0x05

PAN ID conflict notification

0x06

Orphan frame

0x07

Beacon request

0x08

Coordinator realignment

0x09

GTS

0x0a-0xff

Reserved
Table1.MAC Command Frame

Rx

X
X
X

Output of csma/ca using IAR Embedded Workbench for msp430 and msp430f5438a
controller:i.

I written the c code for csma/ca in the standard of IEEE 802.15.4 it has simulated in
code composer studio and IAR Simulator successfully completed results has been
taken.

ii.

The channel access is successful this is for slotted csma/ca algorithm whereas super
frame order is less than 15

Task 3:- import cc2520 example on code composer studio (CCS)

i.
ii.
iii.
iv.
v.
i.

Hello world
PER Test
Register read application
Light switch application
Sprectrum Analyzer

Hello world application import on code composer studio, here I selected target board
is msp430f2618 and compiler version 4.2.1

ii.

To add the include file open properties and to add the file particular location into the
include path location i.e. properties-> General->include options->add include path

iii.

Rebuild the program

LEACH
Step by
Step

Cluster
Header
Selection

Cluster
Formation

Steady
State
Phase

Anda mungkin juga menyukai