Guru Gobind Singh Indraprastha University
East Delhi Campus, Surajmal Vihar, Delhi 110092
University School Of Automation & Robotics (USAR)
WIRELESS SENSOR NETWORK Practical File
(ARI 451)
Submitted to: Submitted By:
Dr. Ghanendra Kumar Name: Sachin Rana
Assistant Professor, USAR Batch: IIOT B1 7th SEM
Roll No: 00319071723
INDEX
S NO. EXPERIMENT DATE SIGN
1 Simulating a Local Area Network.
2 Simulation of a Satellite Network.
3 Simulating a Wi-Fi Network.
Simulating a Mobile AdHoc
4
Network.
Simulating a Wireless Sensor
5
Network.
6 Setting up a Bluetooth Network.
EXPERIMENT - 1
AIM: Simulating a Local Area Network.
OBJECTIVES:
Learn about Local Area Network (LAN); different topologies & protocols uses in LAN.
Learn about simulating a LAN using ns2.
THEORY:
Local Area Network
A local area network (LAN) provides capability to a group of computers in close proximity to each other such
as in an office building, a school, or a home. A LAN is useful for sharing resources like files, printers, games
or other applications. A LAN is often connected to other LANs, which in turn are connected Internet.
LAN Topologies
Nodes in LAN are interconnected using one of four basic configurations:
Bus Topology: In case of a bus topology, each machine is connected to a single cable through some
kind of connector. Terminators (resistors) are required at each end of the bus cable to prevent the signal
from bouncing back & forth of the cable.
Star Topology: In local area networks with forming a star topology, each network host is connected
to a central hub (a signal booster or repeater). In contrast to the bus topology, the star topology connects
each node to the hub with a point-to-point connection. All traffic in the n/w has to pass through the
central hub.
Ring Topology: In local area networks where the ring topology is used, each computer is connected
to the network in form of a closed loop or ring. Each machine has a unique address for their
identification
Mesh Topology: In a mesh network where all nodes are connected to each other through one or more
hops.
MAC Protocols
Medium Access Proto-Control (MAC) protocols allows machines to access the communication medium, &
thereby to "take turns" at transmitting data. MAC protocols could be broadly classified into three types:
1. Channel partitioning based protocols (TDMA, CDMA).
2. Random access based protocols (ALOHA, CSMA).
3. Taking turns (token passing, polling).
Ethernet
Ethernet is the most popular CSMA/CD protocol. It is standardized as IEEE 802.3. In Ethernet when only one
computer needs to transmit data, it can immediately (almost) access the line. However, when many computers
want to access the medium frequently it generates a high traffic. This results in high average waiting time &
higher chances of collision.
PROCEDURE:
1. Go to the exercises section, choose a problem, & carefully read the problem description.
2. Write a script (or make necessary changes) to simulate the desired scenario in the code editor just
below the problem statement.
3. Click on the 'Run' button to execute the simulation script.
4. Simulation with ns2: If the simulation was successful, & was instructed to create a trace file, contents
of the trace file would be displayed in the area below the 'Run' button.
5. Simulation with ns3: If the simulation was successful, output of the program would be displayed in
the area below the 'Run' button.
6. A trace file generated as a result of simulation with ns2 could be used for certain kind of analysis,
which would be discussed.
CONCLUSION
The experiment simulated packet transmission in a CSMA/CD-based LAN, confirming Ethernet's
broadcasting behaviour where only the destination accepts packets.
EXPERIMENT - 2
AIM: Simulation of a Satellite Network.
OBJECTIVES:
Get familiar with the basics of satellite network & how to simulate them with ns2.
Learn the simulation of geostationary satellite & Iridium constellation with ns2.
THEORY:
Satellite
The word 'satellite' comes from the latin word 'satellit' meaning an attendant, who is constantly revolving &
attaining a larger body. Figure shows picture of satellite. A satellite is kept in a mathematical calculable path
called orbit, around another planet to collect information or communication. Fig shows different satellite
orbits.
Geostationary Orbit
The rotational period of geostationary orbit is equal to that of earth. The geostationary satellite appears to
stationary from the earth surface as the earth & geostationary satellite move with the same speed. The orbit
has zero inclination located directly above the equator (equatorial orbit).
Low Earth Orbit
A low earth orbit (LEO), circles close to the Earth. Generally, LEOs have altitudes b/w 500 & 2,000 km above
the Earth's surface. A special type of LEO is the Polar Orbit. The polar orbit is a LEO with a huge inclination
angle (close to 90 degrees). So the LEO satellite move around the poles. Iridium & Teledesic are e.g. of polar
orbiting satellite systems & can be modified in ns.
PROCEDURE:
1. Go to the exercise section, choose a problem, & carefully read the problem description.
2. write a script (or make necessary changes) to simulate the desired scenario in the code editor just below
the problem statement.
3. Click on the 'Run' button to execute the simulation script.
4. Simulation with ns2: If the simulation was successful, & was instructed to create a trace file, contents
of the trace file would be displayed in the area below the 'Run' button.
5. Simulation with ns3: If the simulation was successful, o/p of the program to create would be
displayed.
CONCLUSION:
The simulation analyzed end-to-end delay b/w Bangkok & Bagdad using the INSAT-3A satellite, showing
consistent delay patterns.
EXPERIMENT - 3
AIM: Simulating a Wi-Fi Network.
OBJECTIVES:
Understand about Wi-Fi network, different standards, & related protocols.
Analyze the Wi-Fi communication range in the presence of the access point (AP) & the base station
(BS).
learn about hidden node & exposed node problems, & their possible solutions.
THEORY:
Wi-Fi Networks:
Wi-Fi (Wireless Fidelity) uses the IEEE 802.11 standard. Wi-Fi has some other extensions like 802.11a,
802.11b, & 802.11g. Wi-Fi technology operating at a frequency of 2.4 GHz & uses radio communication.
IEEE 802.11 Standards
Following are the different for Wi-Fi (vi)
802.11 is the wireless local area networks (WLANs) standard. Supports 1-2 Mbps.
802.11a is a high speed WLANs standard for 5 GHz ban. It uses an orthogonal frequency division
multiplexing (OFDM) encoding scheme.
802.11b is a wireless standard for 2.4 GHz band. It supports 11 Mbps. (It uses only DSSS (Direct
sequence spread spectrum).
802.11d is a international roaming. This automatically configures devices to meet local radio
frequency (RF) regulations.
802.11e address the quality of service (QOS) requirements for all IEEE wireless radio interfaces.
802.11f defines inter-access point communications for multiple vendor - distributed WLANs.
802.11g establishes an additional modulation technique for 2.4 GHz band. This supports speeds
up to 54 Mbps.
802.11h supports the spectrum management of the 5GHz.
802.11i define the current security weakness for both encryption & authentication protocols.
802.11n supports more throughput improvements. Also provides speeds up to 500 Mbps.
Hardware Requirements for Wi-Fi
The following hardware devices are required for connecting the Wi-Fi Networks.
Access Point -> Access Point (AP) acts as a bridge b/w the wired network & wireless devices. It allows
multiple devices to connect through it for accessing the network.
Wireless Network Card -> A wireless Network Card (WNC) is required on each device on a wireless n/w.
A desktop computer would need an internal card, which will usually have a small antenna or an external
antenna on it.
Transmitter -> Transmitter is used for emitting the wireless signals & it also receives the connection
requests where a wireless client will send the requests & receives the replies from the transmitter. In this
case, the transmitter is the wireless router.
Advantages of Wi-Fi
following are the different benefits of Wi-Fi N/ws
In wireless ad-hoc n/w mode, devices like consumer electronics & gaming applications can directly
connect & exchange data with each other.
Digital images can be transferred wirelessly from cameras & other devices.
All connected devices within the range have access to Internet & inter-working.
Wi-Fi enables wireless voice-Applications (VoWLAN or WVOIP).
Can be used at placed where wiring & cable lay-out is not feasible.
Limitations
Like any other types of technology, Wi-Fi has its set of drawbacks that are listed as follows:
Global inconsistency of spectrum assignments & operational limitations.
Overlapping of channels.
Limited range of equivalent isotropically radiated power in some areas.
Greater power consumption compared to lower bandwidth standards.
MAC Protocols
The 802.11 standards use a MAC layer known as CSMA/CA (Carrier Sense Multiple Access/Collision
Avoidance). In CSMA/CA a wireless node that wants to transmit & performs the following sequence:
1. Listen on the desired channel.
2. If channel is idle (no active transmitters) it sends packet.
3. If channel is busy then, the node waits until the transmission end then a contention period where min.
time a host must transmit before it can be sure that the no other host's packet has collided with its
transmission.
4. If the channel is still idle at the end of the contention period, then the node transmits its packet
otherwise it repeats the process defined in step-3 above until it gets a free channel.
Use of RTS/CTS to exchange data
Step 1: At first the sender check whether the medium is idle or not, if so, after the Distributed Inter Frame
Space (DIFS) will check the status of sense before transmitting the data in the wireless medium) units of
time, it will broadcasts a Request-to-Send (RTS) frame to the receiver address.
Step 2: If the receiver is within the range, then it will wait for Short Inter Frame Space (SIFS - is the small
time interval between the data frame & its acknowledgment) unit of time, then only it will respond to the
sender with a Clear-to-Send (CTS) frame.
Step 3: If the sender receive the CTS frame, then it will wait for another SIFS unit of time before sending
the data frame to the receiver.
Step 4: finally, when the receiver will successfully receive the data frame, it will wait for SIFS unit of time
& also send an Acknowledgement (ACK) message return to the sender.
Issues in Wi-Fi Networks
Wi-Fi suffers from the two well known problems:
Hidden Terminal Problem
Exposed Terminal Problem
The Hidden Terminal Problem
The hidden node/terminal problem found at a point to multipoint n/w & it is defined as being one in which
three or more nodes are present. Let there are three nodes: node A, node B & node C.
A & C cannot hear each other. A sends to B, C cannot receive A. C wants to send B, C senses a free
medium. collision occurs at B. A cannot receive the collision. A is hidden for C.
Solution of Hidden Terminal Problem
The solution of hidden terminal problem is as follows:
When A wants to send a packet to B, A firsts sends a Request-to-send (RTS) to B.
On receiving RTS, B responds by sending Clear-to-Send (CTS).
when C overhears a CTS, it keeps quiet for the duration of the transfer.
Transfer duration is included in both RTS & CTS.
RTS & CTS are short frames, reduces collision chance.
Exposed Terminal Problem
Suppose there are four nodes: node A, node B, node C & node D. Here -
B can send to both A & C.
C can send to D, but not to A or B.
A & C cannot hear each other.
Solution to the Exposed Terminal Problem
Exposed terminal problems cannot be mitigated with RTS/CTS. This can be explained with the following
scenario.
Suppose B sends RTS to A.
A sends CTS to B.
C hears RTS, but not CTS, assumes it is OK to send to D.
PROCEDURE:
1. Go to the exercise section, choose a problem, & carefully read the problem description.
2. Write a script (or make necessary changes) to simulate the desired scenario in the code editor just
below the problem statement.
3. Click on the 'Run' button to execute the simulation script.
4. Simulation with ns2: If the simulation was successful, & was instructed to create a trace file,
contents of the trace file would be displayed in the area below the 'Run' button.
5. Simulation with ns3: If the simulation was successful, o/p of the program would be displayed in the
area below the 'Run' button.
CONCLUSION:
The simulation analyzed Wi-Fi communication b/w a static AP & STA, showing successful "two-way
commun" up to 116 meters. Beyond this range, no packets were received, demonstrating signal limitations.
EXPERIMENT - 4
AIM: Simulating a Mobile AdHoc Network.
OBJECTIVES:
Understand about the basics of Mobile Ad-Hoc Network (MANETs) & different routing protocols.
Setup a network with wireless nodes using ns2.
Get familiar with the different characteristics of MANET through simulations.
THEORY:
Ad-Hoc Network Ad-Hoc Networks are temporary network. They do not need any external infrastructure like
basic stations & physical wires.
Mobile Ad-Hoc Network (MANET) MANET automatically configure a network among mobile devices.
Each devices moves independently in any direction. Each node acts as a router.
Routing Routing is the selection of path or a route in a network for forwarding packets. The objective of
routing packets in a n/w is to determine the best possible path in terms of minimising the no. of hops (path
length), delay, packet loss, cost, etc.
Routing in MANET MANET are formed dynamically by connecting arbitrary wireless mobile nodes, without
using existing infrastructure. So, routing in MANET is different from traditional routing. Each node in
MANET function like a host & a router.
Routing Protocols for MANET Routing protocols for a MANET can be classified as: Proactive (table-
driven): DSDV, OLSR etc. Reactive (on-demand): AODV, DSR etc. Hybrid: ZRP
Proactive routing protocols determine path in advance & periodically exchange routing data to
maintain the path.
Reactive routing protocols, on the other hand, determine a route to some destination node only when
it is required to send some data to that node.
Hybrid routing takes the advantages of both table driven & on-demand algorithms.
Dynamic Source Routing (DSR) The DSR protocol is composed of two mechanisms that work together to
allow the discovery & maintenance of source routes in the ad hoc network:
1. Route Discovery -> Route discovery is used only when source wants to send a packet to destination
& does not know a route to destination. A mobile node A wants to send a packet to a destination node
B, then obtain a source route to B.
2. Route Maintenance -> Route Maintenance is the mechanism by which a source node A is able to
detect, while using a source route to B. If the n/w topology has changed & the route is broken then the
source route attempts to use any other route to destination if it exist or can invoke route discovery
again to find a new route. Route Maintenance is used only when only source is actually sending packets
to destination.
Application of MANET
The applications of MANET are:
Military or police exercises.
Disaster relief operations.
Mine site operations.
Robot data acquisition, etc.
Advantages
The following are the advantages of MANETs:
MANETs provide different access "to info" & also services of geographic position.
MANETs work without any pre-existing infrastructure
MANETs can be set up at any place & time.
Disadvantages
Some of the disadvantages of MANETs:
Limited resources.
Limited physical security.
Intrinsic mutual trust vulnerable to attacks.
Lack of authorization facilities.
Volatile n/w topology makes it hard to detect malicious nodes.
Security protocols for wired n/ws cannot work for adhoc networks.
PROCEDURE:
1. Go to the exercise section, choose a problem, & carefully read the problem description.
2. Write a script (or make necessary changes) to simulate the desired scenario in the code editor just
below the problem statement.
3. Click on the 'Run' button to execute the simulation script.
4. Simulation with ns2: If the simulation was successful, & was instructed to create a trace file, contents
of the trace file would be displayed in the area below the 'Run' button.
5. Simulation with ns3: If the simulation was successful, output of the program would be displayed in
the area below the 'Run' button.
6. A trace file generated as a result of simulation with ns2 could be used for certain kind of analysis,
which would be discussed.
CONCLUSION:
In conclusion, the simulation of a Mobile Adhoc Network (MANET) using ns2 with AODV routing protocol
demonstrated the dynamic nature of node communication. The experiment showed how nodes adapt their
routing paths based on n/w conditions & mobility. Trace analysis highlighted the routing protocol's
efficiency in ensuring data delivery. Overall, the results validate the functionality of AODV in MANET
scenarios.
EXPERIMENT - 5
AIM: Simulating a Wireless Sensor Network.
OBJECTIVES:
Understand basic concepts about Wireless Sensor Networks (WSNs) types, applications of WSN.
Gain familiarity with LEACH, a cluster based routing protocol for WSNs.
THEORY:
Wireless Sensor Networks A sensor network is composed of a large no. of sensor nodes that are deployed in
a wide area with very low powered sensor nodes. The wireless sensor networks can be utilized in a various
information & telecommunications applications. The sensor nodes are very small devices with wireless
communication capability, which can collect information about sound, light, motion, temperature, etc. &
processed different sensed information & transfers it to the other nodes.
Basic Characteristics of WSNs Wireless Sensor Networks are:
Self-configuration, self-healing, self-optimization, & self-protection capabilities.
Short-range broadcast communication & multi-hop routing.
Dense deployment & cooperative effort of sensor nodes.
Frequently changing topology due to fading & node failures.
Severe limitations in energy capacity, computing n/w power, memory, & transmit power.
Operating Systems for WSNs TinyOS operating system is specifically designed for WSNs. It is an event
driven operating system. It also provides a programming framework for embedded systems. It has component-
based execution model implemented in nesC.
Differences with Mobile Ad Hoc Networks We studied mobile ad hoc networks (MANETs), It is made up
of a no. of wireless mobile nodes. However, there are significant differences b/w MANETs & WSNs. The no.
of sensor nodes in a sensor n/w is much more than that in an ad Hoc network. Sensor nodes are generally static
& cooperate together to transfer the sensed data. In mobile ad hoc n/ws, the no. of nodes are much less, but
their mobility is very high.
Types of Wireless Sensor Networks Depending on the environment, there are different types of WSNs.
Terrestrial wireless sensor networks
Ad-Hoc (unstructured)
Preplanned (structured)
Underground wireless sensor networks
Preplanned
More expensive equipment, deployment, maintenance
Underwater wireless sensor networks
Fewer sensor nodes (sparse deployment)
More expensive than terrestrial
Acoustic wave communication
Limited bandwidth.
Long propagation delay.
Signal fading
Multi-media wireless sensor networks
Sensor nodes equipped with cameras & microphones
High bandwidth / low energy, QoS, filtering, data processing & compressing techniques.
Routing protocols for WSNs
Many routing protocols have been prepared for WSNs. There have been classified into three categories,
namely:
Data-centric protocols
Hierarchical protocols
Location-based protocols
Clusters & Cluster heads in WSNs
Sensor nodes can be partitioned into a no. of small groups, which is known as clusters. There are the
organizational unit for wireless sensor n/ws. Each cluster has to coordinator, called Cluster head (CH).
Advantages of Clustering
Transmit aggregated data to the data sink.
Reducing the no. of nodes taking part in transmission
Useful energy consumption.
The LEACH Protocol LEACH (Low-Energy Adaptive Clustering Hierarchy) is a cluster-based routing
protocol for WSNs. It adopts the clustering concept to distribute the energy among the sensor nodes in the
n/w. It improves the energy-efficiency of WSN beyond the normal clustering architecture. It uses a
TDMA/CDMA MAC to reduce inter-cluster & intra-cluster collisions. As a result, we can extend the life time
of our n/w, & this is the very important issue that is considered in the WSN field.
Operation of LEACH The operation of LEACH is divided into two phases:
Setup Phase (where cluster-heads are chosen)
Cluster-head Advertisement
Cluster Set-Up
Transmission schedule creation
Steady-state Phase (The cluster-head is maintained when data is transmitted b/w nodes)
Data transmission to cluster heads
Signal processing (Data fusion)
Data transmission to the base station
Applications of WSNs The applications of WSNs are innumerable, since each sensor node is capable of
monitoring a wide variety of ambient conditions. Military application: Sensor nodes can be spread across a
battlefield or enemy area & be programmed to track & monitor enemy troop movements.
Environmental Applications: Sensor n/ws are being increasingly used for environmental concerns.
PROCEDURE:
1. Go to the exercises section, choose a problem, & carefully read the problem description.
2. Write a script to simulate the desired scenario in the code editor.
3. Click on the 'Run' button to execute the simulation script.
4. Simulation with ns2: If the simulation was successful, & was instructed to create a trace file, contents
of the trace file would be displayed.
5. Simulation with ns3: If the simulation was successful, o/p of the program would be displayed.
CONCLUSION:
The solution of LEACH protocol showed variations in the no. of cluster heads formed per round, indicating
its dynamic adaptation to network conditions.
EXPERIMENT - 6
AIM: Setting up a Bluetooth Network.
OBJECTIVES:
Understand about Bluetooth networks & how it is differentiated from WiFi Networks.
Get familiar with Piconet & Scatternet formation.
Simulating the Bluetooth n/ws with NS2 by using UCBT extensions.
THEORY:
Bluetooth Network
The name Bluetooth was named after 10th century Viking king in Denmark Harald Bluetooth who united &
controlled Denmark & Norway. Bluetooth is a low power, low cost, & short range radio n/w standard. It
supports unlicensed Industrial, Scientific & Medical (ISM) 2.4 GHz short-range radio frequency band. It is
complementary to the Wi-Fi network specified by IEEE 802.11 b/g/a standard.
Who started Bluetooth?
Bluetooth wireless technology was accepted by engineers at Swedish telecommunications
manufacturer Telefonaktiebolaget LM Ericsson.
In 1994 Ericsson had started a project to study the feasibility of a low-cost & low-power radio interface
to replace cables b/w mobile accessories. a mobile phones.
In 1998, Bluetooth technology was starting to take shape & led to the development of the Bluetooth
Special Interest Group (SIG); with the founding members being : IBM, Intel, Nokia, Toshiba &
Ericsson.
Bluetooth- Versions
Massy Bluetooth specification versions have been released dime Bluetooth technology was finally introduced
in 1998. Versions 1.0 2 [Link] had too many probleme & restraints for manufacturers to successfully -develop
queforth devices. The main issue was the lack of interoperability aring devices :
Bluetooth 1.1: The Bluetooth cose Specification version 1.1 is the most successful relating version of Bluetoot
technology.
Bluetooth 1.2: Many new Bluetooth devices, like the latest cell phones are being sold with the newer
Bluetooth Specification version 1.
Bluetooth 2.0: Version 2.0 + EDR (Enhanced Data Rate) was announced by the Bluetooth SIG in June 2004
& began appearing in Bluetooth devices in late 2005.
Bluetooth 2. 1: Bluetooth care specification version 2.1 is fully -backward compatible with 1.2, I was adopted
by the Bluetooth sier on July 26, 2007. Metrothe 320: The 3.0 specification was adopted by the Bluetooth SIG
on April 21, 2009.
Networking of Bluetooth
Bluetooth technology provides both point-to-point & point-to-multipoint connection. In point-to-multipoint
connections, the channel is shared among several Bluetooth units. In point-to-point connections, only two
units share the connection. Bluetooth protocols assume that a small no. of units will participate in
communication at any given time.
With the no. of piconet connect with each other with the slave nodes, then the slave nodes, which are connected
with both the Master nodes of Piconets are Known as Slave/Slave nodes. But when the no. of piconets are
connected with each other with another master nodes, then the master nodes, which are slave to one Piconet
& Master for other Piconets are Known as Master / Slave nodes.
How to Connect Bluetooth?
Bluetooth enables ad hoc networking, Rather than depending on a broadband system, which relies on terminals
& base stations for maintaining connections to the network via radio links, Bluetooth implements peer-to-peer
connectivity.
Bluetooth technology also provides fast, secure voice & data transmissions. The range for connectivity is up
to 10 meters, & line of sight is not required. The Bluetooth radio unit