Computational Science and Artificial Intelligence Program
Lecture 3
WSN
Random MAC protocols
Egypt 2025
IoT communication architecture
Wireless Sensor Networks
•A large number of low-cost, low-power,
multifunctional, and small sensor nodes.
•Sensor node consists of sensing, data
processing, and communicating components
Introduction (cont.)
• A sensor network is composed of a large number of
sensor nodes,
• which are densely deployed either inside the
phenomenon or very close to it.
• The position of sensor nodes need not be engineered or
pre-determined.
• sensor network protocols and algorithms must
possess self-organizing capabilities.
Introduction (cont.)
• The differences between sensor networks and ad hoc
networks are outlined below:
Introduction (cont.)
• The differences between sensor networks and ad hoc
networks are outlined below:
• The number of sensor nodes in a sensor network is much more than the nodes in an
ad hoc network.
• Sensor nodes are prone to failures.
• The topology of a sensor network changes very frequently.
• Sensor nodes may not have global ID because of the large amount of overhead and
large number of sensors.
• The differences between sensor networks and ad hoc
networks are outlined below:
• Sensor nodes mainly use broadcast communication
pattern whereas most ad hoc networks are based on
point-to-point communications.
• Sensor nodes are limited in power, computational
capacities, and memory.
Sensor networks communication architecture
Factors influencing sensor network design
• Fault tolerance;
• Energy;
• Node deployment;
• Scalability;
• Production costs;
• Operating environment;
• Sensor network topology;
• Hardware constraints;
• Transmission media;
• Power consumption.
Fault tolerance
• Why fails?
• Lack of power, physical damage, or environmental
interference
Energy
• The essential properties of individual sensor nodes pose
additional challenges to the communication protocols
primarily in terms of energy consumption.
• Therefore, while traditional networks are designed to
improve performance metrics such as throughput and delay,
WSN protocols focus primarily on power conservation.
Node deployment
• The deployment of WSNs is another factor that is
considered in developing WSN protocols. The position of
the sensor nodes need not be engineered or predetermined
• In particular, sensor nodes must be self-managing in that
they configure themselves, operate and collaborate with
other nodes, and adapt to failures, changes in the
environment, and changes in the environmental stimuli
without human intervention
Scalability
• The number of sensor nodes deployed may be on the
order of hundreds , thousands or even millions.
• The density can be calculated as
• N is the number of scattered sensor nodes in region A;
• R is the radio transmission range.
• The number of nodes in a region can be used to indicate
the node density.
Production costs
• Since the sensor networks consist of a large number of sensor nodes,
the cost of a single node is very important to justify the overall cost of
the networks.
• The cost of a sensor node should be much less than 1$ in order for the
sensor network to be feasible
Hardware constraints
• A sensor node is made up of four basic components
• a sensing unit
• usually composed of two subunits: sensors and analog to
digital converters (ADCs).
• processing unit,
• Manages the procedures that make the sensor node
collaborate with the other nodes to carry out the assigned
sensing tasks.
• A transceiver unit
• Connects the node to the network.
• Power units (the most important unit)
Hardware constraints
• Size
• matchbox-sized module
• consume extremely low power,
• operate in high volumetric densities,
• have low production cost and be unnecessary,
• be autonomous,
• be adaptive to the environment.
Sensor network topology
• Pre-deployment and deployment phase
• Sensor nodes can be either thrown in mass or placed
one by one in the sensor field.
• Post-deployment phase
• Sensor network topologies are prone to frequent
changes after deployment.
• Re-deployment of additional nodes phase
• Addition of new nodes poses a need to re-organize the
network.
Environment
• Sensor nodes may be working
• in busy intersections,
• in the interior of a large machinery,
• at the bottom of an ocean,
• inside a twister,
• in a battlefield beyond the enemy lines,
• in a home or a large building,
Transmission media
• Industrial, scientific and medical (ISM) bands
• offer license-free communication in most countries.
• Infrared
• license-free and robust to interference.
• requirement of a line of sight between sender and
receiver.
Power consumption
• Only be equipped with limited power source(<0.5 Ah
1.2V).
• Node lifetime strong dependent on battery lifetime.
• Power consumption can be divided into three domains:
• sensing, communication, and data processing.
WSN operations
Generally, operation of WSN involves communication
between sensor node and base station.
• Node-to-node
In a multi-hop communication data needs to be accepted by intermediate
nodes in order to reach to destination. Node to node communications is used to
pass data from one node to other till the destination.
WSN operations
• Node-to-base station
When sensors node want to send responses back to base station this
communication pattern is used, this is a reverse-multi path
communication which means that more than one node can
communicate to base station directly or indirectly. This communication
pattern can also be unicast if there are multiple base stations or there is
a special node (group leader), who is responsible to gather sensed
information and transmit it to base station.
WSN operations
• Base station-to-node
This type of communication is required when base station wants to
request data from nodes. Typically, the mode for communication is
unicast (one-to-many) which means any sensor node having the
requested date can respond to the base station.
Network dynamics models
• Static sensor networks
In static sensor networks, there is no motion among communicating
sensors, the observer and the phenomenon. An example is a group of
sensors spread for temperature sensing. For these types of sensor
networks, previous studies have shown that localized algorithms can
be used in an effective way.
In this type of network, sensor nodes require an initial set-up
infrastructure communication to create the path between the observer
and the sensors with the remaining traffic exclusively application
communication.
Network dynamics models
• Dynamic sensor networks
In dynamic sensor networks, the sensors themselves, the observer,
or the phenomenon are mobile. Whenever any of the sensors
associated with the current path from the observer to the phenomenon
moves, the path may fail.
Mobile observer
Mobile sensors
Mobile phenomena, how?
Sensor Network Scenarios and Mobility
Examples of sinks types in single-hop networks
Sensor Network Scenarios and Mobility
Simple network with seven wireless sensor nodes
Sensor Network Scenarios and Mobility
Multi-hop example when obstacle is present
Sensor Network Scenarios and Mobility
Host[4]
Host[5]
Host[2]
Host[0]
Host[3]
Host[1]
Host[9]
Host[8]
Host[6]
Host[7]
Multiple sinks and sources in a multi-hop network without mobility
Design Form for Wireless Sensor Networks
• Distribution organization
the WSN nodes should cooperatively organize the network using
distributed algorithms and protocols. The term self-organization is
commonly used for this principle, in a self-organized WSN the sensor
nodes are not only forwarding packets or running applications
programs, but they also take part deciding about the network operation.
Design Form for Wireless Sensor Networks
• Content-based addressing
Normally the user of a WSN wants to know something
about the physical environment that the network interacts
with, but the typically does not care about the individual
sensor nodes.
For Example, the user wants to obtain the mean temperature
in a concrete area. For this case, it is better that the user
names the data he is interested in and not the nodes
producing the data.
for example, “give me the mean temperature in Area G”
instead of “obtain the temperature values of host [7], host
[8] and give me the mean value”. this concept is called data-
centric-addressing
Aggregation is considered one of the simplest in-network processing
techniques"
MANET vs. WSN
• Many differences
• Applications, equipment: MANETs more powerful, higher
data rates, more resources
• Application-specific: WSNs depend much stronger on
application specifics; MANETs comparably uniform
• Environment interaction: core of WSN, absent in MANET
• Scale: WSN might be much larger (although contestable)
• Energy: WSN tighter requirements, maintenance issues
• Dependability/QoS: in WSN, QoS different because of
different applications
• Data centric vs. id-centric networking
• Mobility: different mobility patterns like (in WSN, sinks might
be mobile, usual nodes static)
6.43
Random Access
Carrier Sense Multiple Access/Collision
Detection (CSMA/CD), IEEE 802.3
• The most commonly used MAC method.
• When a device has a data frame to transmit onto a
network that uses this method, it first checks the
physical medium (carrier sensing) to see if any
other device is already transmitting.
63
CSMA/CD (Cont’d)
• If the device senses another transmitting device it
waits until the transmission has finished. As soon
as the carrier is free it begins to transmit data,
while at the same time continuing to listen for
other transmissions.
• If it detects another device transmitting at the
same time (collision detection), it stops
transmitting and sends a short jam signal to tell
other devices that a collision has occurred.
64
CSMA/CD (Cont’d)
• Back-off algorithm is a collision resolution
mechanism which is commonly used to schedule
retransmissions after collisions in Ethernet. The
waiting time that a station waits before attempting
retransmission of the frame is called as back off
time.
65
How much time the station should wait to
re-transmit?
• Waiting time = back–off time
• Let n = collision number or re-transmission serial
number.
• Then, Waiting time = K * Tslot
• where K = [0, 2n – 1 ]
66
Case 1:
• Suppose 2 stations A and B start transmitting data
(Packet 1) at the same time then, collision occurs.
So, the collision number n for both their data
(Packet 1) = 1. Now, both the station randomly
pick an integer from the set K i.e. {0, 1}.
67
Case 1:
❑When both A and B choose K = 0
Waiting time for A = 0 * Tslot = 0
Waiting time for B = 0 * Tslot = 0
Therefore, both stations will transmit at the same
time and hence collision occurs.
❑When A chooses K = 0 and B chooses K = 1
Waiting time for A = 0 * Tslot = 0
Waiting time for B = 1 * Tslot = Tslot
Therefore, A transmits the packet and B waits for
time Tslot for transmitting and hence A wins
68
Case 1:
❑When A chooses K = 1 and B chooses K = 0
Waiting time for A = 1 * Tslot = Tslot
Waiting time for B = 0 * Tslot = 0
Therefore, B transmits the packet and A waits for
time Tslot for transmitting and hence B wins.
❑When both A and B choose K = 1
Waiting time for A = 1 * Tslot = Tslot
Waiting time for B = 1 * Tslot = Tslot
Therefore, both will wait for the same time Tslot and
then transmit. Hence, collision occurs.
69
Conclusion:
❑Probability that A wins = 1/4
❑Probability that B wins = 1/4
❑Probability of collision = 2/4
70
Case 2:
• Assume that A wins in Case 1 and transmitted its
data(Packet 1). Now, as soon as B transmits its
packet 1, A transmits its packet 2. Hence, collision
occurs. Now collision no. n becomes 1 for packet
2 of A and becomes 2 for packet 1 of B.
• For packet 2 of A, K = {0, 1}
• For packet 1 of B, K = {0, 1, 2, 3}
71
Case 2:
Probability that A wins = 5/8
Probability that B wins = 1/8
Probability of collision = 2/8
So, the probability of collision decreases as compared to Case 1.
72
disadvantages, CSMA/CD
CSMA / CD is a fast way to access but as the
network grows, it becomes ineffective because
larger networks are more prone to data collisions
due to the following:
• Because more users are trying to reach the
transmission medium.
• because more data is generated and exchanged on
the network.
• The CSMA / CD is therefore only suitable for
small networks.
73
CSMA/CA (CSMA with collision Avoidance)
• CSMA/CA protocol is used in wireless networks because
they cannot detect the collision so the only solution is
collision avoidance.
• CSMA/CA avoids the collisions using three basic
techniques:
❑Interframe space
❑Contention window
❑Acknowledgements
74
1. Interframe Space (IFS)
• Whenever the channel is found idle, the station does not
transmit immediately. It waits for a period of time called
interframe space (IFS).
• If after this IFS time, the channel is still idle, the station
can send, but it still needs to wait a time equal to
contention time.
75
2. Contention Window
• Contention window is an amount of time divided into
slots.
• A station that is ready to send chooses a random number
of slots as its wait time.
• The number of slots in the window changes according to
the binary exponential back-off strategy. It means that it
is set of one slot the first time and then doubles each
time the station cannot detect an idle channel after the
IFS time.
76
Contention Window cont.
• In contention window the station needs to sense the
channel after each time slot.
• If the station finds the channel busy, it does not restart
the process. It just stops the timer & restarts it when the
channel is sensed as idle.
77
CSMA/CA (Cont’d)
Node A’s frame Node B’s frame Node C’s frame
Delay: B
Delay: C Time
Nodes B & C sense
the medium
Nodes C starts
Nodes B resenses the medium transmitting.
and transmits its frame.
Node C freezes its counter.
Nodes C resenses the
medium and starts
decrementing its counter.
78
CSMA/CA Explained
DIFS Contention
window DIFS Contention window
Medium Busy Next Frame
Time
Defer access Slot
Backoff after defer
DIFS – Distributed Inter Frame Spacing
79
CSMA/CA with ACK
• Immediate Acknowledgements from receiver
upon reception of data frame without any need
for sensing the medium.
• ACK frame transmitted after time interval SIFS
(Short Inter-Frame Space) (SIFS < DIFS)
• Receiver transmits ACK without sensing the
medium.
• If ACK is lost, retransmission done.
80
CSMA/CA/ACK
DIFS Time
Data
Source
SIFS
ACK
Destination
DIFS Contention window
Next Frame
Other
Defer access Backoff after defer
SIFS – Short Inter Frame Spacing
81
CSMA/CA with RTS/CTS
• Transmitter sends an RTS (request to send) after
medium has been idle for time interval more
than DIFS.
• Receiver responds with CTS (clear to send) after
medium has been idle for SIFS.
• Then Data is exchanged.
• RTS/CTS is used for reserving channel for data
transmission so that the collision can only occur
in control message.
82
CSMA/CA with RTS/CTS (Cont’d)
DIFS SIFS
RTS Data Time
Source
SIFS SIFS
CTS ACK
Destination
DIFS
Contention window
Next Frame
Other
Defer access Backoff after defer
83
We can comparison between CSMA/CD and
CSMA/CA is given below:
CSMA/CD CSMA/CA
1. CSMA CD takes effect after a collision 1. CSMA CA takes effect before a collision
2. CSMA/CD is part of the IEEE 802.3 2. CSMA/CA is part of the IEEE 802.11
standard standard
3. CSMA/CD reduces the recovery time 3. CSMA/ CA minimizes the possibility of
collision
4. CSMA/CD is more efficient than CSMA/CA 4. CSMA/CA is less efficiency than CSMA/CD
5. CSMA CD is typically used in wired 5. CSMA/CA is used in wireless networks.
networks.
84
Table 3-2 IEEE 802 standards