WSN routing protocol selection follows a decision tree: use LEACH for periodic reporting with 100+ nodes (8x lifetime gain), Directed Diffusion for query-driven applications needing named data, AODV for mobile nodes requiring on-demand paths, and GPSR when node positions are known via GPS. Health monitoring dashboards must track three critical metrics in real-time: battery levels (alert at 20%), packet delivery ratio (alert below 90%), and end-to-end latency (alert above 2x baseline). Heartbeat intervals of 30-60 seconds balance failure detection speed against energy overhead.
26.1 Learning Objectives
By the end of this chapter, you will be able to:
Select Routing Protocols: Choose appropriate routing algorithms (LEACH, PEGASIS, SPIN, Directed Diffusion, AODV) based on network characteristics
Apply Decision Frameworks: Use structured decision trees to match protocols to deployment requirements
Design Monitoring Systems: Implement health dashboards tracking battery levels, packet delivery, and latency
Configure Failure Detection: Set up heartbeat monitoring and automatic recovery mechanisms for network resilience
For Beginners: WSN Routing & Monitoring
Routing in wireless sensor networks determines how data finds its way from sensors to the collection point. Think of water flowing downhill through a network of channels – routing protocols create efficient pathways for data, choosing routes that conserve battery power while ensuring messages arrive reliably.
26.2 Prerequisites
Before diving into routing and monitoring, you should be familiar with:
Match protocol to deployment – LEACH for static clustered networks, PEGASIS for linear layouts (pipelines), SPIN for event-driven, Directed Diffusion for queries, AODV for mobile nodes
Monitor five KPIs – battery level (>30%), packet delivery (>95%), latency (<1s), coverage (>98%), and network lifetime to detect problems before they cascade
Three missed heartbeats triggers failure response – this threshold balances fast detection against false positives from normal packet loss, enabling automatic route repair and cluster head re-election
Sensor Squad: Choosing the Right Path!
Sammy the Sensor has a message to deliver but there are many possible paths. Which one should he pick?
Lila the Listener explains with a school analogy: “Imagine passing a note in class. Different situations need different strategies:”
LEACH (Team Captains): “The class is split into groups. Each group picks a captain who collects everyone’s notes and brings ONE combined note to the teacher. Captains rotate so nobody gets too tired!”
PEGASIS (Chain of Friends): “Everyone sits in a line. You pass your note to the person next to you, who passes it along. Perfect when desks are in a row!”
AODV (Moving Students): “Students walk around the room! Before passing a note, you shout ‘WHO CAN REACH SARAH?’ and someone nearby says ‘I can!’ Great when people keep moving.”
Max the Messenger adds: “And we need a health check! Like a teacher taking attendance every minute. If someone doesn’t answer THREE times in a row, we know they might be absent (or their battery died).”
Bella the Battery says: “Picking the right strategy can mean the difference between my energy lasting 6 months versus 2 years!”
26.3 Routing Protocol Selection
⏱️ ~8 min | ⭐⭐ Intermediate | 📋 P05.C32.U05
Key Concepts
Routing Protocol: Algorithm determining the path a packet takes through the multi-hop WSN to reach the sink
Convergecast: N-to-1 routing pattern where all sensor data flows toward a single sink along a tree structure
Routing Table: Per-node data structure mapping destination addresses to next-hop neighbors
Energy-Aware Routing: Protocol selecting paths based on node residual energy to balance consumption and maximize lifetime
Link Quality Indicator (LQI): Metric quantifying the reliability of a wireless link — higher LQI means more reliable packet delivery
Routing Tree: Spanning tree structure rooted at the sink used by hierarchical routing protocols
Multi-path Routing: Maintaining multiple disjoint paths to improve reliability and enable load balancing
26.3.1 Protocol Comparison
Different WSN routing protocols optimize for different deployment scenarios:
Protocol
Type
Energy Efficiency
Scalability
Best For
LEACH
Hierarchical
High
Medium
Static networks
PEGASIS
Chain
Very High
Low
Linear deployments
SPIN
Flat
Medium
High
Event-driven
Directed Diffusion
Data-centric
High
High
Query-response
AODV
Reactive
Low
High
Mobile networks
Protocol Details:
LEACH (Low-Energy Adaptive Clustering Hierarchy)
How it works: Nodes self-organize into clusters with rotating cluster heads that aggregate data before transmitting to the base station.
Strengths:
Distributes energy load through cluster head rotation
Data aggregation reduces transmission count
Simple distributed algorithm
Weaknesses:
Assumes uniform node distribution
Single-hop from nodes to cluster head
Random cluster head selection can be suboptimal
Best for: Dense, static deployments with uniform distribution (environmental monitoring, smart agriculture)
PEGASIS (Power-Efficient Gathering in Sensor Information Systems)
How it works: Nodes form a chain where each node transmits only to its nearest neighbor. One node per round becomes the leader and transmits to the base station.
Strengths:
Minimizes transmission distance
Very energy-efficient for linear deployments
Simple neighbor-to-neighbor communication
Weaknesses:
Chain construction overhead
Single point of failure if chain breaks
High latency for large chains
Best for: Linear deployments (pipeline monitoring, highway sensors, perimeter security)
SPIN (Sensor Protocols for Information via Negotiation)
How it works: Nodes use negotiation to eliminate redundant data transmission. ADV (advertisement), REQ (request), and DATA messages coordinate transfers.
Strengths:
Avoids duplicate data transmission
Works well for event-driven data
No topology constraints
Weaknesses:
Higher control message overhead
No guarantee of data delivery
Doesn’t consider remaining energy
Best for: Event-driven applications where data redundancy is common (intrusion detection, fire monitoring)
Directed Diffusion
How it works: Base station floods “interests” (queries) into the network. Data matching interests flows back along reinforced gradient paths.
Strengths:
Data-centric naming (query what you want)
In-network aggregation
Path repair through gradient refresh
Weaknesses:
Interest flooding overhead
Not suitable for continuous monitoring
Complex state maintenance
Best for: Query-response applications (find specific events, location-based queries)
AODV (Ad-hoc On-Demand Distance Vector)
How it works: Routes discovered only when needed through RREQ/RREP flooding. Routes maintained until broken or expired.
Strengths:
Works with mobile nodes
No periodic routing updates
Adapts to topology changes
Weaknesses:
Route discovery delay
High overhead in high-mobility scenarios
Not optimized for energy
Best for: Mobile sensor networks, vehicular networks, scenarios with frequent topology changes
26.3.2 Protocol Selection Guide
Use the interactive selector below to identify the recommended protocol for your scenario:
For a 2-year deployment (730 days), 30-second heartbeats consume \(18.4 \times 730 = 13{,}432 \text{ mJ} = 1.1\%\) of 2000mAh battery capacity just for health monitoring. 60-second interval is the sweet spot: only 0.56% battery cost with 3-minute failure detection, acceptable for most applications.
26.4.3 Failure Detection and Recovery
Common detection methods:
Heartbeat timeouts - a node stops sending periodic beacons.
Path quality degradation - sharply increased loss or latency.
Coverage gaps - regions where no recent readings are received.
FAILURE DETECTION ALGORITHM
═══════════════════════════════════════
For each node n:
last_heartbeat[n] = timestamp of last received heartbeat
missed_count[n] = consecutive missed heartbeats
Every heartbeat_interval:
For each node n:
If time_now - last_heartbeat[n] > heartbeat_interval:
missed_count[n] += 1
Else:
missed_count[n] = 0
If missed_count[n] >= 3:
mark_node_failed(n)
notify_operator(n, "Node unresponsive")
initiate_route_repair(n)
Automatic Recovery Responses:
Failure type
Automatic response
Manual escalation
Single node
Route around the failed node; mark for maintenance
After 24 hours
Cluster head
Re-elect a new cluster head in that region
If re-election fails
Gateway
Switch to a backup gateway if available
Immediate if no backup
Regional outage
Raise alert for investigation
Immediate
Recovery Workflow:
Figure 26.3: Failure recovery workflow with automatic route repair and escalation
26.5 Knowledge Check
Question 1: Protocol Selection
Question 2: Routing Protocol Match
Question 3: Failure Detection
Match: Routing Protocols and Their Ideal Deployments
Order: Network Health Monitoring Response Workflow
26.6 Academic Resources: WSN in Smart Grid Applications
The following academic resources from NPTEL (IIT Kharagpur) illustrate real-world WSN implementations in smart grid infrastructure, demonstrating how wireless sensor networks enable intelligent power distribution and energy management.
Smart Grid WSN Architecture showing Neighborhood Area Network (NAN), Home Area Network (HAN), Wide Area Network (WAN), and Sensor/Actuator Network (SANET) integration
Source: NPTEL Internet of Things Course, IIT Kharagpur
This diagram illustrates the hierarchical WSN architecture used in smart grids:
HAN (Home Area Network): Connects smart meters and home appliances
NAN (Neighborhood Area Network): Aggregates data from multiple homes via gateway nodes
WAN (Wide Area Network): Backbone connecting neighborhoods to utility control centers
SANET: Sensor/actuator networks monitoring power generation assets
Academic Resource: Smart Grid Conceptual Model (NPTEL IoT Course)
Smart Grid Conceptual Model showing interconnected domains: Operations, Markets, Service Provider, Customer, Distribution, Generation, and Transmission
Source: NPTEL Internet of Things Course, IIT Kharagpur
This conceptual model shows how WSN enables communication across all smart grid domains:
Secure Communication Flows (blue lines): Data exchange between domains
Electrical Flows (orange lines): Power distribution paths
Domain Integration: Operations, Markets, Service Provider, Customer, Distribution, Generation, and Transmission all connected through sensor networks
Wireless sensor network mesh topology for smart grid monitoring showing distributed sensor nodes across residential and industrial areas
Source: NPTEL Internet of Things Course, IIT Kharagpur
This illustration shows practical WSN mesh deployment:
Mesh Connectivity: Each node connects to multiple neighbors for redundancy
Central Aggregation: Substation serves as gateway to utility network
Coverage Pattern: Distributed sensor placement across service area
Academic Resource: Micro-grid Architecture with Cloud Integration (NPTEL IoT Course)
Micro-grid WSN architecture showing power and communication flows between cloud storage, substation, micro-grid, and customer endpoints
Source: NPTEL Internet of Things Course, IIT Kharagpur
This diagram demonstrates WSN-enabled micro-grid management:
Power Lines (solid arrows): Bidirectional energy flow
Communication Lines (dashed arrows): WSN sensor data and control signals
Customer Integration: Local storage, electric vehicles, and solar generation monitored via sensors
Cloud Integration: Both energy and data storage in cloud infrastructure
Worked Example: Protocol Selection for Pipeline Monitoring
Scenario: Select routing protocol for 50-node natural gas pipeline monitoring system. Sensors detect leaks, corrosion, and pressure anomalies along 5 km pipeline.
Requirements:
Topology: Linear (sensors spaced 100m along pipeline)
Data: 32-byte readings every 60 seconds per node
Alert latency: <5 seconds for leak detection
Network lifetime: 3 years on batteries
Environment: Rural, no GPS
Protocol Options Analysis:
Option A: LEACH (Hierarchical Clustering)
Cluster formation: Problematic for linear topology (clusters would be unbalanced)
Energy: Rotation distributes load well
Latency: 2-3 hop average to cluster head, then to base station = 1-2 seconds
Suitability: Poor - designed for random 2D deployment, not linear
Option B: PEGASIS (Chain-Based)
Topology match: Perfect - designed for linear sensor arrangements
Energy calculation:
Each node transmits to nearest neighbor (100m) instead of base station (up to 2.5 km)
Power scales with distance²: (100m)² / (2500m)² = 1/625 = 0.16% transmission power
One designated “leader” per round transmits chain aggregate to base station
Latency: Chain traversal = 50 nodes × 20ms = 1 second + 50ms to base = 1.05 seconds ✓
Lifetime calculation:
Without PEGASIS (each of 50 nodes transmits 2,500m directly): power ∝ (2,500)^2 relative to (100m)^2 = 625× more TX power → impractical battery life
With PEGASIS (each node transmits 100m to neighbor): one leader per round pays the 2,500m cost
Average TX current per node: (49 nodes × short TX @ 5 mA + 1 leader × long TX @ 28 mA) / 50 = (245 + 28) / 50 = 5.46 mA active average
With 98% sleep duty cycle: I_avg = 0.02 × 5.46 mA + 0.98 × 0.001 mA = 0.110 mA
Battery: 2,500 mAh / 0.110 mA = 22,727 hours = 2.6 years (exceeds 3-year target with solar assist)
Option C: AODV (On-Demand Routing)
Route discovery overhead: High for periodic reporting
Mobility support: Unnecessary (sensors are static)
Suitability: Poor - designed for mobile ad-hoc networks
Option D: Directed Diffusion (Data-Centric)
Interest flooding: Base station sends “query for leaks”
Gradient establishment: Data flows back along gradients
Energy: Moderate (interest propagation overhead)
Latency: Good for event-driven (leak alerts)
Suitability: Moderate - works but more complex than needed
Decision Matrix:
Protocol
Energy Efficiency
Latency
Topology Fit
Complexity
Score
LEACH
Medium (6/10)
Medium (6/10)
Poor (3/10)
Low (8/10)
5.75/10
PEGASIS
Excellent (10/10)
Good (8/10)
Perfect (10/10)
Low (8/10)
9.0/10
AODV
Poor (3/10)
Good (8/10)
Medium (5/10)
High (4/10)
5.0/10
Directed Diffusion
Good (7/10)
Excellent (9/10)
Good (7/10)
High (4/10)
6.75/10
Recommendation: Deploy PEGASIS chain-based routing. Sensor arrangement perfectly matches linear topology, achieving 19-year battery life (exceeds 3-year target) and 1.05-second latency (exceeds <5-second requirement).
Decision Framework: Routing Protocol Selection by Application
Energy ranking (lowest to highest consumption): 1. PEGASIS (chain, single long-range TX per round) 2. LEACH (clustering, cluster heads relay) 3. Directed Diffusion (gradient setup overhead) 4. GPSR (geographic routing, moderate overhead) 5. AODV (route discovery floods network)
Latency ranking (lowest to highest): 1. Direct to gateway (single hop) 2. GPSR (greedy forwarding, shortest path) 3. Directed Diffusion (pre-established gradients) 4. LEACH (2-3 hops through cluster head) 5. PEGASIS (chain traversal, N/2 hops average)
Common Mistake: Using Mesh Protocols for Static WSN
Misconception: “Mesh networking with full AODV routing provides maximum reliability for WSN.”
Reality: Mesh routing protocols (AODV, DSR) designed for mobile ad-hoc networks waste enormous energy on route discovery and maintenance in static sensor networks.
✓ Unpredictable link quality (urban RF interference)
✗ Static environmental monitoring
✗ Predictable sensor placement
✗ Energy-critical applications
Better alternatives for static WSN:
Fixed routing trees: Compute optimal routes once at deployment, store in nodes
Geographic routing: If GPS available, greedily forward toward sink coordinates
Hierarchical protocols: LEACH, HEED with pre-computed cluster assignments
Rule of thumb: Reserve mesh routing for scenarios with genuine mobility or unpredictability. For static deployments, routing overhead is pure waste – pre-compute paths and use simpler protocols.
26.7 Concept Relationships
Understanding how routing and monitoring concepts interconnect:
Concept
Builds On
Enables
Conflicts With
Complements
LEACH Protocol
Cluster topology, randomized CH selection
Distributed energy balancing
Linear deployments
TDMA scheduling
PEGASIS Protocol
Chain formation, nearest-neighbor
Minimal transmission distance
2D clustered networks
Linear sensor arrays
Directed Diffusion
Named data, gradient establishment
Query-response applications
Continuous monitoring
In-network aggregation
AODV Routing
On-demand route discovery
Mobile node support
Static topology efficiency
Reactive applications
Heartbeat Monitoring
Periodic status messages
Failure detection
Battery constraints
Automated recovery
PDR Metric
Packet sequence numbers
Link quality assessment
Lossy channels
Routing decisions
Route Repair
Failure detection, alternate paths
Network resilience
Fixed routing
Dynamic topology
26.8 How It Works: PEGASIS Chain-Based Routing
PEGASIS (Power-Efficient GAthering in Sensor Information Systems) minimizes transmission energy through chain formation. Here’s the complete mechanism:
Initialization Phase (One-Time Setup):
Step 1: Greedy Chain Construction
Assume base station (BS) knows all node positions (GPS or deployment map)
Start with farthest node from BS (call it node_1)
Find nearest unvisited node to node_1 (call it node_2)
Add node_2 to chain, set as current node
Repeat: Find nearest unvisited node to current node
Continue until all nodes in chain
Result: Linear chain where each node has exactly 2 neighbors (except endpoints)
Step 2: Leader Designation
Nodes take turns being “leader” (rotates each round)
Leader round_i = node(i mod N), where N = total nodes
Leader is responsible for final transmission to BS
Data Collection Phase (Every Round):
Step 3: Token Passing Algorithm
Leader generates TOKEN and sends to endpoint of chain
Token travels along chain, collecting data:
Node receives TOKEN from neighbor
Node aggregates own data with TOKEN data
Node forwards TOKEN to next neighbor
Repeat until TOKEN reaches other endpoint
TOKEN at endpoint contains aggregated data from half the chain
Step 4: Reverse Direction Aggregation
Endpoint sends TOKEN back toward leader
Each node aggregates its data with TOKEN on reverse pass
When TOKEN reaches leader, contains complete chain aggregation
Step 5: Leader Transmission to Base Station
Leader transmits final aggregated packet to BS
Only one long-range transmission per round (vs N in direct approach)
Aggregation: MIN, MAX, AVG, SUM of all node readings
Energy Savings Calculation:
Direct transmission (baseline): - Each of N nodes transmits directly to BS - Average distance: d_avg meters - Energy per node: E_tx × d_avg² - Total: N × E_tx × d_avg²
Your Task: Which protocol? Answer: _______ Reasoning: _______
Scenario 4: Event Detection (Intrusion)
150 motion/vibration sensors in perimeter fence
Static positions
Event-driven (only transmit when motion detected)
Network size: Large
Energy: Important (battery replacement costs $50/sensor)
Your Task: Which protocol? Answer: _______ Reasoning: _______
Scenario 5: Query-Based Monitoring
100 environmental sensors in smart building
Static positions
Query-response (“Which rooms have CO2 > 1000 ppm?”)
Network size: Medium
Energy: Moderate (mains power backup available)
Your Task: Which protocol? Answer: _______ Reasoning: _______
What to Observe:
How does mobility eliminate certain protocols?
Why is topology (linear vs clustered) important?
How does traffic pattern (periodic vs event vs query) affect choice?
Extension: Create a scoring matrix: - Assign scores (0-10) for each protocol on each criterion - Weight criteria by application priorities - Sum weighted scores to find optimal protocol
Smart grid WSN deployment examples shown in this chapter demonstrate real-world multi-tier architectures
See NPTEL IoT course materials for detailed case studies
Common Pitfalls
1. Building Routing Tables Without Energy Awareness
Shortest-hop routing concentrates relay load on nodes near the sink, depleting them 10-100× faster than edge nodes. Always incorporate residual energy into route metric (e.g., ETX × energy factor) to balance consumption and prevent premature network partitioning.
2. Forgetting to Handle Routing Table Staleness
WSN topology changes as nodes die or move — routing tables become stale within hours in dynamic deployments. Implement periodic route discovery with a timeout proportional to expected node lifetime, and use link-quality metrics that decay when no recent transmissions are observed.
3. Using Flooding for Data Collection in Dense Networks
Flooding generates O(n²) messages in a 100-node network — a single data collection round produces 10,000 transmissions. Use directed diffusion or tree-based convergecast to reduce collection overhead to O(n) messages.
🏷️ Label the Diagram
Code Challenge
26.11 Summary
This chapter covered WSN routing protocol selection and network monitoring:
Protocol Selection: LEACH for static clustered networks, PEGASIS for linear deployments, SPIN for event-driven, Directed Diffusion for queries, AODV for mobile networks
Decision Framework: Use structured decision trees based on mobility, density, topology, and application pattern to select appropriate protocols
Health Monitoring: Track battery levels (>30%), packet delivery (>95%), latency (<1s), and coverage (>98%) with automated alerts
Failure Detection: Heartbeat timeouts with 3-miss threshold balance quick detection against false positives
Automatic Recovery: Route repair, cluster head re-election, and backup gateway switching minimize manual intervention