443 WSN Routing Labs and Exercises
443.1 Learning Objectives
By the end of this chapter, you will be able to:
- Experiment with Routing Protocols: Compare AODV, DSR, and LEACH in simulation
- Analyze Energy Consumption: Measure and optimize routing for network lifetime
- Implement Route Discovery: Practice route request/reply mechanisms
- Evaluate Protocol Trade-offs: Assess delivery rate, latency, and overhead
443.2 Prerequisites
Before diving into this chapter, you should be familiar with:
- WSN Routing Challenges: Understanding why specialized routing is needed
- Directed Diffusion: Data-centric routing concepts
- Data Aggregation: In-network processing benefits
- Link Quality Routing: ETX and link metrics
- Trickle Algorithm: Efficient dissemination
443.3 Comprehensive Review Quiz
Test your understanding of all WSN routing concepts covered in this series.
443.4 WSN Routing Lab: Multi-Hop Routing Simulation
443.4.1 Lab Overview
This hands-on lab simulates a Wireless Sensor Network with multiple ESP32 nodes demonstrating different routing protocols. Youβll experiment with routing decisions, energy-aware path selection, and compare the performance of AODV, DSR, and LEACH protocols in real-time.
What Youβll Learn:
- How multi-hop routing works in wireless sensor networks
- Differences between reactive (AODV, DSR) and proactive (LEACH) routing
- Energy-aware routing decisions and their impact on network lifetime
- Route discovery, maintenance, and recovery mechanisms
- Cluster-based routing and aggregation strategies
443.4.2 Lab Setup
The simulation creates a 9-node WSN topology with:
- 3 Sensor Nodes (S1, S2, S3) - Generate temperature/humidity data
- 4 Intermediate Nodes (R1, R2, R3, R4) - Forward packets and aggregate data
- 1 Cluster Head (CH) - Coordinates LEACH protocol
- 1 Sink Node (SINK) - Destination for all data
Each node has a simulated battery level that depletes with transmission/reception, demonstrating energy-aware routing.
443.4.3 Network Topology
βββββββββββββββββββββββββββββββββββββββ
β Network Topology β
βββββββββββββββββββββββββββββββββββββββ€
β β
β S1 βββ¬ββ R1 βββ¬ββ CH ββ SINK β
β β β β β
β S2 βββΌββ R2 βββ€ β β
β β β β β
β S3 βββ΄ββ R3 βββ΄ββ R4 β
β β
β Links: S1-R1, S1-R2, S2-R2, S2-R3 β
β S3-R3, S3-R4, R1-R2, R2-R3 β
β R3-R4, R1-CH, R2-CH, R4-CH β
β CH-SINK β
βββββββββββββββββββββββββββββββββββββββ
443.4.4 Challenge Exercises
Try these modifications to deepen your understanding:
- Energy-Aware Path Selection
- Modify
getNextHop()to prioritize high-energy nodes - Implement adaptive energy thresholds based on network-wide energy levels
- Compare network lifetime with and without energy awareness
- Modify
- Route Quality Metrics
- Add link quality estimation based on signal strength (RSSI)
- Implement Expected Transmission Count (ETX) metric
- Update
calculateLinkQuality()to factor in packet loss
- LEACH Cluster Rotation
- Implement probabilistic cluster head election (5% probability)
- Rotate cluster heads based on residual energy
- Compare energy consumption across nodes
- Multipath Routing
- Modify DSR to maintain multiple routes
- Implement route splitting for load balancing
- Measure improvement in delivery rate
- Route Recovery
- Add RERR (Route Error) packet handling for broken links
- Implement local route repair before triggering new discovery
- Measure reduction in route discovery overhead
- Protocol Comparison
- Run each protocol for 2 minutes and record statistics
- Compare delivery rate, latency, and energy consumption
- Analyze which protocol performs best under different network densities
443.4.5 Expected Learning Outcomes
After completing this lab, you should be able to:
- Explain the differences between reactive (AODV, DSR) and proactive (LEACH) routing
- Identify when energy-aware routing improves network lifetime
- Analyze the trade-offs between hop count and energy consumption
- Implement route discovery and maintenance mechanisms
- Evaluate protocol performance under different network conditions
- Design hierarchical routing strategies for large-scale WSNs
443.4.6 Key Observations
| Protocol | Route Discovery | Energy Efficiency | Scalability | Best Use Case |
|---|---|---|---|---|
| AODV | On-demand (flooded RREQ) | Moderate | Good | Mobile, dynamic networks |
| DSR | On-demand (source routing) | Low overhead | Limited | Small networks, stable topology |
| LEACH | Cluster-based (periodic) | High (aggregation) | Excellent | Dense, static sensor deployments |
- AODV: Smart city IoT with mobile nodes (vehicles, wearables)
- DSR: Indoor sensor networks with stable topology
- LEACH: Agricultural monitoring with thousands of static sensors
- Energy-Aware Routing: Battery-powered environmental monitoring
443.4.7 Further Exploration
To extend this lab:
- Add geographic routing using GPS coordinates
- Implement Quality of Service (QoS) routing for priority traffic
- Simulate network partitioning and reconnection
- Add data aggregation functions (min, max, median) for LEACH
- Implement duty cycling where nodes sleep to save energy
443.5 Visual Reference Gallery
Directed diffusion data-centric routing with interest propagation and gradient-based forwarding.
LEACH hierarchical routing with rotating cluster heads for load balancing.
Epidemic routing for delay-tolerant and intermittently connected sensor networks.
443.6 Chapter Summary
This series explored specialized routing approaches for Wireless Sensor Networks:
Key Takeaways:
WSN Routing is Different: Data-centric, energy-aware, application-specific vs traditional address-centric routing
Directed Diffusion: Interest propagation -> gradient establishment -> data delivery -> reinforcement creates efficient data-driven paths
Data Aggregation: Combining data from multiple sensors reduces transmissions, saving energy while maintaining acceptable accuracy
Link Quality Matters: Hop count is insufficient; MIN-T metric accounts for expected retransmissions on lossy links
WMEWMA: Effective link estimation balances short-term responsiveness (Window Mean) with long-term stability (EWMA)
Trickle Algorithm: Polite gossip achieves zero maintenance cost when consistent, rapid propagation when updated
Trade-offs: Message overhead vs latency vs energy consumption requires protocol selection based on application requirements
WSN routing protocols must navigate unique constraints - extreme energy limits, dense deployment, unreliable links - to achieve application objectives efficiently.
443.7 Further Reading
Intanagonwiwat, C., et al. (2003). βDirected diffusion for wireless sensor networking.β IEEE/ACM Transactions on Networking, 11(1), 2-16.
Woo, A., Tong, T., & Culler, D. (2003). βTaming the underlying challenges of reliable multihop routing in sensor networks.β ACM SenSys, 14-27.
Levis, P., et al. (2004). βTrickle: A self-regulating algorithm for code propagation and maintenance in wireless sensor networks.β USENIX NSDI, 15-28.
Fasolo, E., et al. (2007). βIn-network aggregation techniques for wireless sensor networks: A survey.β IEEE Wireless Communications, 14(2), 70-87.
Gnawali, O., et al. (2009). βCollection tree protocol.β ACM SenSys, 1-14.
443.8 Whatβs Next?
Building on these architectural concepts, the next section examines Cloud Computing for IoT deployments.
Continue to Cloud Computing ->
WSN Routing Series: - WSN Routing Overview - Series index - WSN Routing Challenges - Why traditional routing fails - Directed Diffusion - Data-centric routing - Data Aggregation - In-network processing - Link Quality Routing - ETX and metrics - Trickle Algorithm - Network reprogramming
Deep Dives: - Wireless Sensor Networks - WSN architecture - Routing Fundamentals - Core routing concepts - RPL Operation - RPL for IoT