381  WSN Implementation: Architecture and Topology Design

381.1 Learning Objectives

By the end of this chapter, you will be able to:

  • Design WSN Architecture: Create multi-tier wireless sensor network systems with appropriate component organization
  • Select Node Hardware: Choose microcontrollers, radios, and sensors based on deployment requirements
  • Implement Cluster Topology: Deploy hierarchical network structures with cluster heads and data aggregation
  • Optimize Communication: Use TDMA scheduling and aggregation techniques to reduce energy consumption

381.2 Prerequisites

Before diving into architecture design, you should be familiar with:

A Wireless Sensor Network (WSN) is a collection of small devices (nodes) that work together to monitor an environment. Think of it like a team of observers spread across an area, all communicating wirelessly to report what they see.

Simple Example: Imagine monitoring a forest for fires. You scatter hundreds of small sensor nodes throughout the forest. Each node measures temperature and smoke levels, then sends alerts to a central station if conditions become dangerous.

Key Components: - Sensor Nodes: Small devices with sensors, processor, radio, and battery - Cluster Heads: Nodes that collect data from nearby sensors - Gateway: Connects the sensor network to the internet - Base Station: Where all the data is collected and analyzed

Main Challenge: These nodes run on batteries, so every design decision must consider energy efficiency to keep the network running as long as possible.

381.3 WSN Architecture Design

⏱️ ~10 min | ⭐⭐ Intermediate | πŸ“‹ P05.C32.U01

381.3.1 System Architecture Overview

A complete WSN implementation consists of multiple tiers working together:

%% fig-alt: "Data aggregation at cluster head showing four sensor nodes sending raw temperature readings (22.3Β°C, 22.7Β°C, 22.5Β°C, 22.4Β°C) to cluster head which aggregates them into a single packet with average, min, and max values, reducing 4 packets to 1 packet and saving 75% energy"
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#2C3E50', 'primaryTextColor': '#fff', 'primaryBorderColor': '#16A085', 'lineColor': '#16A085', 'secondaryColor': '#E67E22', 'tertiaryColor': '#7F8C8D'}}}%%

graph TB
    subgraph Tier1["Tier 1: Sensor Nodes"]
        S1[Sensor 1] & S2[Sensor 2] & S3[Sensor 3]
    end

    subgraph Tier2["Tier 2: Cluster Heads"]
        CH[Cluster Head<br/>Aggregation]
    end

    subgraph Tier3["Tier 3: Gateway"]
        GW[Gateway<br/>Protocol Bridge]
    end

    subgraph Tier4["Tier 4: Cloud"]
        Cloud[Cloud Platform<br/>Analytics]
    end

    S1 & S2 & S3 -->|Raw Data| CH
    CH -->|Aggregated| GW
    GW -->|Internet| Cloud

    style S1 fill:#16A085,stroke:#2C3E50,color:#fff
    style S2 fill:#16A085,stroke:#2C3E50,color:#fff
    style S3 fill:#16A085,stroke:#2C3E50,color:#fff
    style CH fill:#E67E22,stroke:#2C3E50,color:#fff
    style GW fill:#2C3E50,stroke:#16A085,color:#fff
    style Cloud fill:#2C3E50,stroke:#16A085,color:#fff

Figure 381.1: Multi-tier WSN architecture showing sensor nodes, cluster heads, gateway, and cloud platform

This variant shows the same architecture with energy consumption profiles at each tier, helping engineers understand where optimization has the greatest impact.

%% fig-alt: "WSN tier architecture with energy profiles: Sensor nodes in Tier 1 consume 50 microamps average due to duty cycling spending 99% in sleep mode, lifetime 3-5 years on coin cell. Cluster heads in Tier 2 consume 5 milliamps average due to aggregation and longer active periods, lifetime 1-2 years on AA batteries. Gateway in Tier 3 consumes 500 milliamps continuous, mains-powered. Cloud in Tier 4 has data center consumption. Energy optimization focus should be on Tier 1 as it has most nodes and battery constraints."
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#2C3E50', 'primaryTextColor': '#fff', 'primaryBorderColor': '#16A085', 'lineColor': '#16A085', 'secondaryColor': '#E67E22', 'tertiaryColor': '#7F8C8D'}}}%%
flowchart TB
    subgraph T1["Tier 1: Sensor Nodes (Γ—100)"]
        S1["Energy: ~50Β΅A avg<br/>Battery: Coin cell<br/>Lifetime: 3-5 years<br/>Duty cycle: 1%"]
    end

    subgraph T2["Tier 2: Cluster Heads (Γ—10)"]
        CH["Energy: ~5mA avg<br/>Battery: AAΓ—2<br/>Lifetime: 1-2 years<br/>Always-on aggregation"]
    end

    subgraph T3["Tier 3: Gateway (Γ—1)"]
        GW["Energy: ~500mA<br/>Power: Mains/Solar<br/>Lifetime: N/A<br/>Continuous operation"]
    end

    subgraph T4["Tier 4: Cloud"]
        CL["Energy: Data center<br/>Scales with data<br/>$/GB processing"]
    end

    T1 -->|"~1KB/day each"| T2
    T2 -->|"~100KB/day aggregated"| T3
    T3 -->|"~1MB/day"| T4

    style T1 fill:#16A085,stroke:#2C3E50,color:#fff
    style T2 fill:#E67E22,stroke:#2C3E50,color:#fff
    style T3 fill:#2C3E50,stroke:#16A085,color:#fff
    style T4 fill:#7F8C8D,stroke:#2C3E50,color:#fff

Optimization Priority: Tier 1 (sensor nodes) has the most units and strictest battery constraints. A 10% improvement at Tier 1 has 100Γ— more impact than at Tier 3.

381.3.2 Node Types and Roles

Node Type Role Power Budget Communication
Sensor Node Data collection Ultra-low (battery) Single-hop to CH
Cluster Head Data aggregation Medium (larger battery) Multi-hop capable
Relay Node Message forwarding Low (battery) Multi-hop
Gateway Network bridge High (mains power) Internet connected

381.3.3 Hardware Component Selection

Choosing the right components impacts network lifetime significantly:

%% fig-alt: "Diagram showing IoT sensor node components including microcontroller, radio, sensors, and power supply with their key specifications."
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#2C3E50', 'primaryTextColor': '#fff', 'primaryBorderColor': '#16A085', 'lineColor': '#16A085', 'secondaryColor': '#E67E22', 'tertiaryColor': '#7F8C8D'}}}%%

graph LR
    Node[Sensor Node] --> MCU[Microcontroller<br/>ATmega/STM32]
    Node --> Radio[Radio<br/>802.15.4/LoRa]
    Node --> Sensor[Sensors<br/>Temp/Humidity]
    Node --> Power[Power<br/>Battery/Solar]

    MCU --> Sleep[Sleep Mode<br/>1 Β΅A]
    Radio --> DutyCycle[Duty Cycling<br/>1% active]
    Power --> Lifetime[2-year<br/>Lifetime]

    style MCU fill:#16A085,stroke:#2C3E50,color:#fff
    style Radio fill:#E67E22,stroke:#2C3E50,color:#fff
    style Sensor fill:#16A085,stroke:#2C3E50,color:#fff
    style Power fill:#2C3E50,stroke:#16A085,color:#fff

Figure 381.2: Sensor node component architecture showing MCU, radio, sensors, and power subsystems

Processor Selection Criteria:

Parameter Low-End Mid-Range High-End
MCU ATmega328 STM32L0 ESP32
RAM 2 KB 8 KB 512 KB
Flash 32 KB 64 KB 4 MB
Sleep Current 1 Β΅A 0.5 Β΅A 10 Β΅A
Active Current 5 mA 10 mA 80 mA
Best For Simple sensing Edge processing Complex analytics

Radio Selection Criteria:

Standard Range Data Rate Power Best For
802.15.4 100m 250 kbps Low Indoor WSN
LoRa 15 km 50 kbps Very Low Rural monitoring
BLE 50m 1 Mbps Ultra Low Wearables
Wi-Fi 100m 54 Mbps High Gateway only

381.4 Network Topology Implementation

⏱️ ~10 min | ⭐⭐ Intermediate | πŸ“‹ P05.C32.U02

381.4.1 Hierarchical Cluster Topology

The most common WSN topology uses clusters to reduce communication overhead:

%% fig-alt: "Hierarchical cluster topology showing sensor nodes grouped into clusters, each with a cluster head that aggregates data before sending to the base station."
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#2C3E50', 'primaryTextColor': '#fff', 'primaryBorderColor': '#16A085', 'lineColor': '#16A085', 'secondaryColor': '#E67E22', 'tertiaryColor': '#7F8C8D'}}}%%

graph TB
    subgraph C1["Cluster 1"]
        N1[Node 1] & N2[Node 2] --> CH1[CH 1]
    end

    subgraph C2["Cluster 2"]
        N3[Node 3] & N4[Node 4] --> CH2[CH 2]
    end

    CH1 & CH2 -->|Multi-hop| BS[Base<br/>Station]

    style N1 fill:#16A085,stroke:#2C3E50,color:#fff
    style N2 fill:#16A085,stroke:#2C3E50,color:#fff
    style N3 fill:#16A085,stroke:#2C3E50,color:#fff
    style N4 fill:#16A085,stroke:#2C3E50,color:#fff
    style CH1 fill:#E67E22,stroke:#2C3E50,color:#fff
    style CH2 fill:#E67E22,stroke:#2C3E50,color:#fff
    style BS fill:#2C3E50,stroke:#16A085,color:#fff

Figure 381.3: Hierarchical cluster topology with sensor nodes, cluster heads, and base station

Cluster Formation Algorithm:

CLUSTER FORMATION PROCESS
═══════════════════════════════════════

Phase 1: Setup (performed periodically)
─────────────────────────────────────
1. Each node calculates threshold T(n):

   T(n) = p / (1 - p Γ— (r mod 1/p))

   where: p = desired percentage of CHs
          r = current round number

2. Node generates random number [0,1]
3. If random < T(n), become Cluster Head
4. CH broadcasts advertisement message

Phase 2: Cluster Formation
─────────────────────────────────────
1. Non-CH nodes receive all advertisements
2. Join cluster with strongest signal (nearest CH)
3. Send join message to chosen CH
4. CH creates TDMA schedule for members

Phase 3: Steady State (data transmission)
─────────────────────────────────────
1. Sensor nodes collect data
2. Transmit in assigned TDMA slot
3. CH aggregates all member data
4. CH transmits aggregated data to BS

Repeat from Phase 1 after timer expires

381.4.2 Energy-Efficient Data Aggregation

Cluster heads aggregate data to reduce transmissions:

Aggregation Method Compression Energy Savings Use Case
Average 10:1 90% Temperature monitoring
Min/Max 10:1 90% Threshold detection
Median 10:1 90% Outlier resistance
Delta encoding 3:1 67% Slowly changing data
Compression 2:1 50% Complex data

Data Aggregation at Cluster Head:

%% fig-alt: "Data aggregation example showing four sensor nodes sending temperature readings to cluster head which computes average, min, and max, reducing 4 packets to 1 packet."
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#2C3E50', 'primaryTextColor': '#fff', 'primaryBorderColor': '#16A085', 'lineColor': '#16A085', 'secondaryColor': '#E67E22', 'tertiaryColor': '#7F8C8D'}}}%%
graph TB
    N1["Node 1<br/>Temp: 22.3Β°C"] --> |Raw Data| CH["Cluster Head<br/>Aggregation Function"]
    N2["Node 2<br/>Temp: 22.7Β°C"] --> |Raw Data| CH
    N3["Node 3<br/>Temp: 22.5Β°C"] --> |Raw Data| CH
    N4["Node 4<br/>Temp: 22.4Β°C"] --> |Raw Data| CH

    CH --> |Aggregated Result| Result["Result to BS:<br/>Avg: 22.5Β°C<br/>Min: 22.3Β°C<br/>Max: 22.7Β°C<br/><br/>4 packets β†’ 1 packet<br/>75% energy saved"]

    style N1 fill:#16A085,stroke:#2C3E50,color:#fff
    style N2 fill:#16A085,stroke:#2C3E50,color:#fff
    style N3 fill:#16A085,stroke:#2C3E50,color:#fff
    style N4 fill:#16A085,stroke:#2C3E50,color:#fff
    style CH fill:#E67E22,stroke:#2C3E50,color:#fff
    style Result fill:#2C3E50,stroke:#16A085,color:#fff

Figure 381.4: Data aggregation at cluster head reducing 4 packets to 1 with 75% energy savings

381.5 Knowledge Check

In the LEACH protocol, what determines whether a node becomes a cluster head in a given round?

LEACH uses a distributed algorithm where each node calculates a threshold T(n) and generates a random number. If the random number is less than the threshold, the node becomes a cluster head. This ensures fair rotation and balances energy consumption across all nodes.

If a cluster head aggregates data from 10 sensor nodes using averaging, approximately what percentage of transmission energy is saved compared to having each node transmit directly to the base station?

With 10:1 compression through averaging, the cluster head sends 1 packet instead of 10 packets being transmitted to the base station. This results in approximately 90% energy savings for the long-range transmission phase, though nodes still use energy for short-range transmission to the cluster head.

381.6 Summary

This chapter covered WSN architecture and topology design fundamentals:

  • Multi-Tier Architecture: WSN implementations use layered design with sensor nodes, cluster heads, gateways, and cloud platforms, each with distinct power profiles and responsibilities
  • Hardware Selection: Component choices (MCU, radio, sensors) directly impact network lifetime - low-power MCUs with 1Β΅A sleep current enable multi-year battery life
  • Cluster Topology: Hierarchical clustering with rotating cluster heads distributes energy load and reduces communication overhead through data aggregation
  • Data Aggregation: Techniques like averaging, min/max, and delta encoding achieve 67-90% energy savings by reducing packet count at cluster heads

381.7 What’s Next

Continue to WSN Implementation: Deployment and Energy to learn about sensor placement strategies, coverage analysis, duty cycling implementation, and power harvesting techniques.

Fundamentals: - WSN Overview: Fundamentals - Core sensor network concepts - Wireless Sensor Networks - WSN architecture principles

Implementation: - WSN Implementation: Deployment and Energy - Coverage and power management - WSN Implementation: Routing and Monitoring - Protocol selection and network health

Protocols: - RPL Routing - IoT routing protocol for WSNs - 6LoWPAN - IPv6 over low-power networks