34  WSN Tracking: Algorithm Components

In 60 Seconds

WSN tracking algorithms combine detection, cooperation, and prediction. Trilateration from 3+ RSSI measurements achieves 3-5m accuracy (sufficient for room-level tracking), while Kalman filtering predicts target positions with 1-2m RMSE for linear motion, enabling proactive sensor activation that saves 40-60% energy versus always-on approaches. The key design choice: RSSI-based tracking is free but limited to 5-10m accuracy, while UWB ranging costs more per node but delivers 10-30cm precision.

34.1 Learning Objectives

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

  • Implement Target Detection: Design multi-sensor fusion systems to reliably detect targets while minimizing false positives
  • Coordinate Node Cooperation: Develop cluster formation and data aggregation strategies for collaborative tracking
  • Compute Target Position: Apply trilateration algorithms using distance measurements from multiple sensors
  • Estimate Future Positions: Implement Kalman filtering for trajectory prediction and proactive sensor activation
  • Compare Localization Techniques: Select appropriate positioning methods based on accuracy and cost requirements
MVU: Minimum Viable Understanding

Core concept: WSN tracking algorithms have six key components - detection, cooperation, position computation, prediction, energy management, and recovery. Why it matters: Each component addresses a specific challenge; missing any one can cause tracking failure or excessive energy consumption. Key takeaway: Prediction is the central component - it enables proactive sensor wake-up (energy savings) and guides recovery when tracking fails.

34.2 How It Works

WSN tracking algorithms integrate six components in a continuous pipeline:

  1. Target Detection: Multi-sensor fusion combines different sensing modalities (PIR motion + ultrasonic distance + temperature) to confirm target presence. Both sensors must agree before triggering tracking, reducing false positives from environmental noise (wind-blown branches, small animals).

  2. Node Cooperation: Nearby sensors form temporary clusters when a target is detected. A cluster head is elected dynamically to aggregate data from all cluster members and send ONE composite message instead of N individual messages, reducing communication overhead by 80-90%.

  3. Position Computation: Trilateration uses distance measurements from 3+ sensors to solve for target coordinates (x,y). Given sensor positions (x₁,y₁), (x₂,y₂), (x₃,y₃) and measured distances d₁, d₂, d₃, the system solves: (x-x₁)² + (y-y₁)² = d₁². Least-squares optimization handles noisy RSSI measurements (±3 dBm noise → ±5-10m position uncertainty).

  4. Future Position Estimation: Kalman filtering predicts where the target will be in the next 5-10 seconds based on current position and velocity. Prediction = position + velocity × Δt, with uncertainty growing linearly (±2m at 1 second, ±10m at 5 seconds).

  5. Energy Management: Only sensors within the predicted confidence radius are awakened proactively. If target moves through 10% of network area, only 10-15% of nodes activate, achieving 85-90% energy savings versus always-on.

  6. Target Recovery: When prediction fails (target turns unexpectedly), expanding ring search activates sensors in growing circles from last known position. Ring radius = max_velocity × time_elapsed, bounding possible target locations and recovering tracking efficiently.

Example: Parking lot tracking system detects car entering (PIR + ultrasonic fusion). Three sensors measure RSSI → trilateration estimates position (12.5, 18.2) ± 6.9m. Kalman filter predicts velocity = 3 m/s heading northeast. System wakes sensors 20m ahead along predicted path. Car parks after 15 seconds, prediction-based activation saved 88% energy versus keeping all 50 parking spot sensors active continuously.

Object tracking with sensor networks means following the movement of people, animals, or things through a monitored area. Think of how a relay team passes a baton – as a tracked object moves, responsibility passes from one sensor to the next, keeping continuous watch. The challenge is doing this smoothly so the object is never lost between handoffs.

Sammy the Sensor was learning how to track a lost puppy in the park, and discovered six superpowers every tracking team needs!

Superpower 1 – Detection: “I use my motion sensor AND my distance sensor together,” said Sammy. “If BOTH agree something is there, it’s real! This stops me from chasing shadows.”

Superpower 2 – Cooperation: “We work as a team!” said Sammy’s friends. “We form a group with a leader who collects all our readings and sends ONE message instead of ten. Less chatter, less battery drain!”

Superpower 3 – Position: Max the Microcontroller calculated: “If Sammy says the puppy is 5 meters away, and two other sensors say 8 meters and 6 meters away, I can triangulate exactly where the puppy is using MATH!”

Superpower 4 – Prediction: “Based on which direction the puppy is running and how fast, I predict it will be near the fountain in 10 seconds!” said Max. “So I wake up sensors near the fountain BEFORE the puppy gets there!”

Superpower 5 – Energy: Bella the Battery cheered: “Only sensors near the predicted path wake up. Everyone else stays asleep. That saves 85-90% of my energy!”

Superpower 6 – Recovery: “But what if the puppy turns unexpectedly?” asked Lila the LED. “We use expanding ring search – wake sensors in growing circles from the last known spot until we find it again!”

34.3 Prerequisites

Before diving into this chapter, you should be familiar with:

34.4 Components of Target Tracking Algorithms

⏱️ ~12 min | ⭐⭐⭐ Advanced | 📋 P05.C39.U02

Key Concepts

  • Core Concept: Fundamental principle underlying WSN Tracking: Algorithm Components — understanding this enables all downstream design decisions
  • Key Metric: Primary quantitative measure for evaluating WSN Tracking: Algorithm Components performance in real deployments
  • Trade-off: Central tension in WSN Tracking: Algorithm Components design — optimizing one parameter typically degrades another
  • Protocol/Algorithm: Standard approach or algorithm most commonly used in WSN Tracking: Algorithm Components implementations
  • Deployment Consideration: Practical factor that must be addressed when deploying WSN Tracking: Algorithm Components in production
  • Common Pattern: Recurring design pattern in WSN Tracking: Algorithm Components that solves the most frequent implementation challenges
  • Performance Benchmark: Reference values for WSN Tracking: Algorithm Components performance metrics that indicate healthy vs. problematic operation
Diagram showing six interconnected components of target tracking algorithms in WSN: (1) target detection using multi-sensor fusion, (2) node cooperation through clustering, (3) position computation via trilateration, (4) future position estimation with Kalman filtering, (5) energy management with selective wake-up, (6) target recovery using expanding ring search. Shows data flow between components with arrows.
Figure 34.1: Components of Target Tracking Algorithms - Detection, cooperation, position computation, prediction, energy management, and recovery

Effective tracking systems integrate six key components:

Directed graph showing data flow through six WSN tracking algorithm components: raw sensor readings enter Target Detection, confirmed detections feed Node Cooperation for clustering, aggregated cluster data enters Position Computation via trilateration, estimated position feeds Future Position Estimation via Kalman filtering, predicted trajectory drives Energy Management for selective wake-up, and when tracking fails the recovery module loops back to Target Detection

Data flow graph of the six WSN tracking algorithm components
Figure 34.2: Six components of WSN tracking algorithms: (1) Target Detection using multi-sensor fusion to reduce false positives, (2) Node Cooperation through clustering and data aggregation, (3) Position Computation via trilateration from multiple sensors, (4) Future Position Estimation using Kalman filtering for prediction, (5) Energy Management with selective node wake-up along predicted path, (6) Target Recovery through expanding ring search if prediction fails.

This variant shows the data transformation at each stage, making clear what inputs and outputs flow between components.

Pipeline diagram showing data transformations through WSN tracking stages: raw RSSI and sensor readings transform into binary detection decisions, then into cluster-aggregated measurements, then into (x,y) position estimates, then into predicted future positions with uncertainty bounds, then into selective wake-up commands for specific sensor nodes

Tracking pipeline data flow showing input transformations at each stage

Data Pipeline Insight: Each stage transforms data—from raw sensor readings to actionable commands. The prediction stage is central because it enables both proactive energy management AND guides recovery when tracking fails.

34.4.1 Target Detection

Challenge: Reliably detect target while minimizing false positives and energy consumption.

Techniques:

  • Threshold-based detection: Sensor reading > threshold → target present
  • Multi-sensor fusion: Combine PIR + ultrasonic + temperature for reliability
  • Adaptive thresholds: Adjust based on environmental conditions

Example: Agricultural Intruder Detection

// Multi-sensor fusion for reliable animal detection
class IntruderDetector {
private:
    int pir_pin, ultrasonic_trig_pin, ultrasonic_echo_pin;
    float detection_threshold_distance = 5.0;  // meters

public:
    IntruderDetector(int pir, int trig, int echo)
        : pir_pin(pir), ultrasonic_trig_pin(trig), ultrasonic_echo_pin(echo) {}

    bool detectTarget() {
        // 1. PIR sensor: motion detection
        bool motion_detected = digitalRead(pir_pin) == HIGH;

        if (!motion_detected) {
            return false;  // No motion, no target
        }

        // 2. Ultrasonic: distance measurement
        float distance = measureDistance();

        if (distance > detection_threshold_distance) {
            return false;  // Too far, likely false positive
        }

        // 3. Multi-sensor fusion: both agree
        Serial.printf("TARGET DETECTED: Motion=YES, Distance=%.2fm\n", distance);
        return true;
    }

    float measureDistance() {
        // Trigger ultrasonic pulse
        digitalWrite(ultrasonic_trig_pin, LOW);
        delayMicroseconds(2);
        digitalWrite(ultrasonic_trig_pin, HIGH);
        delayMicroseconds(10);
        digitalWrite(ultrasonic_trig_pin, LOW);

        // Measure echo duration in microseconds
        long duration = pulseIn(ultrasonic_echo_pin, HIGH);

        // Calculate distance in meters:
        // Speed of sound ≈ 343 m/s = 0.0343 cm/μs
        // distance_cm = duration_μs × 0.0343 / 2  (divide by 2 for round trip)
        // distance_m  = distance_cm / 100
        float distance = (duration * 0.0343) / 2.0 / 100.0;  // result in meters

        return distance;
    }
};

34.4.2 Node Cooperation

Purpose: Multiple sensors collaborate to reduce communication cost and improve accuracy.

Mechanisms:

  • Cluster formation: Nearby sensors form temporary groups
  • In-network aggregation: Fuse data before transmission
  • Leader election: Select cluster head dynamically

34.4.3 Position Computation

Goal: Estimate target coordinates from sensor measurements.

Methods:

Trilateration (Distance-Based):

\[ (x - x_1)^2 + (y - y_1)^2 = d_1^2 \] \[ (x - x_2)^2 + (y - y_2)^2 = d_2^2 \] \[ (x - x_3)^2 + (y - y_3)^2 = d_3^2 \]

Solve for \((x, y)\) given sensor positions \((x_i, y_i)\) and measured distances \(d_i\).

The Misconception: GPS-based tracking works everywhere.

Why It’s Wrong:

  • GPS requires line-of-sight to 4+ satellites
  • Signals blocked by roofs, walls, urban canyons
  • Indoor accuracy degrades to 10-50m (vs 3m outdoor)
  • Cold start takes 30+ seconds (longer without sky view)
  • Power consumption high even when searching

Real-World Example:

  • Asset tracking in warehouse:
  • GPS tracker placed on pallet
  • Signal acquired at loading dock: Position accurate
  • Moved inside warehouse: Position frozen at last fix
  • Result: System shows pallet at dock when it’s in storage

The Correct Understanding: | Environment | GPS | Alternatives | |————-|—–|————–| | Outdoor open | ✓ Excellent | - | | Urban canyon | ⚠ Degraded | Wi-Fi, cellular | | Indoor | ✗ Fails | BLE beacons, UWB, Wi-Fi | | Underground | ✗ Fails | UWB, IMU dead reckoning |

Use indoor positioning systems (BLE, UWB, Wi-Fi) for indoor tracking. GPS is outdoor only.

34.4.4 Localization Techniques: A Progressive Journey

Different localization techniques offer different accuracy-complexity tradeoffs:

Vertical progression chart showing five localization techniques ordered from simplest to most complex: Cell ID at bottom with 100 m accuracy and no additional hardware, RSSI next with 5 to 10 m using standard radio receivers, then ToA/TDoA with 1 to 3 m requiring precision clock synchronization, then AoA with 0.5 to 1 m needing antenna arrays, and Sensor Fusion at top with 0.1 to 0.5 m combining multiple technologies; arrows show increasing accuracy, cost, and power at each level

Localization technique progression from proximity to sensor fusion
Figure 34.3: Localization techniques progression from simple proximity-based methods to advanced sensor fusion: Each level provides improved accuracy at the cost of increased hardware complexity and power consumption.

This variant shows localization options as a cost-benefit decision matrix, helping engineers select the right technique for their budget and accuracy requirements.

Two-dimensional decision matrix with accuracy requirement on the y-axis from coarse 100 m to precise 10 cm, and cost per node on the x-axis from under 5 dollars to over 200 dollars; cells show recommended technology: RSSI in low-cost/low-accuracy zone, ToA and TDoA in mid-range, AoA and UWB in high-accuracy zones, GPS only in outdoor quadrant

Localization cost versus accuracy decision matrix

Selection Guidance:

  • Warehouse asset tracking (1m accuracy needed): Wi-Fi fingerprinting or ToA offers best value
  • AGV navigation (10cm accuracy needed): UWB or sensor fusion required despite higher cost
  • Smart city (10m acceptable): RSSI-based methods minimize infrastructure cost
Technique Accuracy Hardware Cost Power Best For
Cell ID ~100m None Lowest Coarse outdoor
RSSI 5-10m Standard radios Low Indoor zones
ToA/TDoA 1-3m Precise clocks Medium Asset tracking
AoA 0.5-1m Antenna arrays High Precision indoor
Fusion 0.1-0.5m Multiple sensors Highest Robotics, AGV

RSSI measurement from stationary sensor showing signal strength patterns as target moves through coverage area with stronger signals when closer and weaker signals at edges illustrating inverse square law relationship between distance and received signal strength

RSSI Stationary Measurement
Figure 34.4: RSSI-based distance estimation from stationary sensor node

RSSI measurement from mobile sensor mounted on vehicle showing signal strength variations as vehicle drives past stationary beacons with characteristic rise-peak-fall pattern used for position estimation

RSSI Mobile Measurement
Figure 34.5: RSSI patterns from mobile sensor passing stationary beacons
Key Insight: The Accuracy-Cost Tradeoff

Each 10× improvement in accuracy typically requires 10× more hardware cost or power. Choose the minimum accuracy that meets your application requirements.

34.4.5 Future Position Estimation

Purpose: Predict where target will be, enabling proactive sensor activation and tracker guidance.

Kalman Filter Example (state prediction + measurement update cycle):

A 2D Kalman filter for WSN target tracking maintains state vector [x, y, vx, vy] (position and velocity). Each cycle: 1. Predict: x_pred = F × x_prev (F is the state transition matrix using Δt) 2. Update: Fuse prediction with noisy measurement using Kalman gain K = P_pred × H^T × (H × P_pred × H^T + R)^-1

Output:

Predicted: (2.00, 1.00)
Updated:   Position=(2.05, 0.95), Velocity=(2.00, 1.00)

Predicted: (4.05, 1.95)
Updated:   Position=(4.13, 2.03), Velocity=(2.01, 1.02)

Predicted: (6.14, 3.05)
Updated:   Position=(6.02, 2.97), Velocity=(1.97, 0.99)

Predicted: (7.99, 3.96)
Updated:   Position=(8.05, 4.10), Velocity=(2.01, 1.07)

Key Benefit: Kalman filter smooths noisy measurements and provides velocity estimates for prediction.

34.4.6 Energy Management

Strategy: Activate only sensors near predicted target path, letting others sleep.

Prediction-Based Wake-Up:

Using the Kalman filter’s predicted position (x_pred, y_pred) and uncertainty radius r_conf: - Wake sensors within distance r_conf of the predicted position - r_conf grows with prediction horizon: ±2m at 1s, ±5m at 3s, ±10m at 5s

Energy Savings Calculation:

If target moves through 10% of network area, prediction-based wake-up activates only ~10-15% of nodes, achieving 85-90% energy savings vs. keeping all nodes active.

34.4.7 Target Recovery

Challenge: If prediction fails and target “disappears,” how do we find it again?

Recovery Strategies:

  1. Expanding ring search: Activate nodes in increasing radius from last known position
  2. Probabilistic search: Weight search based on target’s historical movement patterns
  3. Network-wide query: Last resort - wake all nodes briefly
def recover_lost_target(sensors, last_known_position, search_radius_step=10, max_radius=50):
    """Expanding ring search for lost target"""
    print(f"Target lost! Last known: {last_known_position}")
    print("Initiating recovery search...\n")

    for radius in range(search_radius_step, max_radius + 1, search_radius_step):
        print(f"Search radius: {radius}m")

        # Activate sensors in ring
        ring_sensors = [s for s in sensors
                       if radius - search_radius_step <= calculate_distance(s.position, last_known_position) < radius]

        print(f"  Activating {len(ring_sensors)} sensors in ring")

        # Search for target
        for sensor in ring_sensors:
            if sensor.detect_target():
                print(f"✓ TARGET RECOVERED by sensor {sensor.id} at {sensor.position}")
                return sensor.position

    print("✗ Target not found within maximum search radius")
    return None

This completes the six components. Combining them creates robust, energy-efficient tracking systems.

Common Misconception: “More Sensors = Better Tracking”

The Misconception: Deploying more sensors always improves tracking accuracy and reliability.

The Reality: Diminishing returns and increased complexity.

Real-World Example - Wildlife Tracking in Yellowstone National Park:

  • Initial Deployment (2018): 500 sensors, 20m spacing, tracking elk herds
    • Accuracy: 2.5m average position error
    • Energy consumption: Network lifetime 6 months
    • Data overhead: 15,000 messages/hour during peak movement
  • Dense Deployment (2019): 1,500 sensors (3× increase), 10m spacing
    • Accuracy: 1.8m average position error (only 28% improvement)
    • Energy consumption: Network lifetime 2 months (67% reduction)
    • Data overhead: 85,000 messages/hour (5.7× increase)
    • Communication collisions: Increased by 340%
    • Cost: 3× sensor hardware + 4× deployment labor

Why This Happens:

  1. Localization accuracy saturates: Once you have 3-4 sensors detecting target, additional sensors provide marginal accuracy gains due to geometric dilution of precision (GDOP)

  2. Communication overhead explodes: More sensors = more messages → more collisions → more retransmissions → faster battery drain

  3. Cluster formation overhead: With dense deployments, cluster head election and data aggregation take longer, increasing latency

Optimal Approach - Adaptive Density:

Instead of uniform high density, Yellowstone researchers deployed: - High density (10m spacing) in critical areas: river crossings, migration bottlenecks - Low density (30m spacing) in open terrain: meadows, forests - Prediction-based activation: Only wake nearby sensors based on trajectory prediction

Results (2020 optimized deployment):

  • Sensors: 650 total (30% fewer than original)
  • Accuracy: 2.2m average (comparable to dense deployment)
  • Network lifetime: 14 months (2.3× original)
  • Cost savings: $125,000 vs $280,000 for dense approach

Key Lesson: Tracking performance depends on smart algorithms (prediction, selective activation, data fusion) more than raw sensor count. Focus on strategic placement and energy-efficient coordination rather than brute-force density.

Scenario: Indoor asset tracking system uses 4 RSSI-based anchor nodes to locate a tagged forklift in a warehouse. Calculate the forklift position using trilateration with least-squares optimization for noisy measurements.

Given:

  • 4 anchor nodes at known positions:
    • Anchor A: (0, 0) meters
    • Anchor B: (40, 0) meters
    • Anchor C: (40, 30) meters
    • Anchor D: (0, 30) meters
  • RSSI measurements from forklift to each anchor:
    • RSSI_A = -65 dBm
    • RSSI_B = -72 dBm
    • RSSI_C = -68 dBm
    • RSSI_D = -70 dBm
  • Path loss model: RSSI(dBm) = -40 - 20×log₁₀(d) where d is distance in meters
  • Measurement noise: σ_RSSI = ±3 dBm

Step 1: Convert RSSI to Distance Estimates

Using path loss model: d = 10^((RSSI + 40) / -20)

Distance to A: d_A = 10^((-65 + 40) / -20) = 10^(-25/-20) = 10^1.25 = 17.8 meters Distance to B: d_B = 10^((-72 + 40) / -20) = 10^(-32/-20) = 10^1.6 = 39.8 meters Distance to C: d_C = 10^((-68 + 40) / -20) = 10^(-28/-20) = 10^1.4 = 25.1 meters Distance to D: d_D = 10^((-70 + 40) / -20) = 10^(-30/-20) = 10^1.5 = 31.6 meters

Step 2: Set Up Trilateration Equations

For position (x, y), we have: - (x - 0)² + (y - 0)² = 17.8² = 316.84 - (x - 40)² + (y - 0)² = 39.8² = 1,584.04 - (x - 40)² + (y - 30)² = 25.1² = 630.01 - (x - 0)² + (y - 30)² = 31.6² = 998.56

Step 3: Solve Using Least-Squares (Overdetermined System)

With 4 anchors and 4 distance measurements, we have an overdetermined system (4 equations, 2 unknowns). Use least-squares to find the position that minimizes total error.

Linearization approach: Expand equations and subtract equation 1 from others to eliminate quadratic terms:

From equations 1 and 2:

(x - 40)² + y² - (x² + y²) = 1,584.04 - 316.84
-80x + 1,600 = 1,267.2
x = (1,600 - 1,267.2) / 80 = 4.16 meters

From equations 1 and 3:

(x - 40)² + (y - 30)² - (x² + y²) = 630.01 - 316.84
-80x - 60y + 1,600 + 900 = 313.17
-80x - 60y = -2,186.83

Substitute x = 4.16:

-80(4.16) - 60y = -2,186.83
-332.8 - 60y = -2,186.83
60y = 1,854.03
y = 30.9 meters

Wait, y > 30 meters is outside the warehouse bounds (0-30m)! This indicates measurement noise is causing inconsistency.

Step 4: Least-Squares Matrix Formulation

Use iterative least-squares (Gauss-Newton) for better robustness:

Define error function: e_i = d_i - sqrt((x - x_i)² + (y - y_i)²)

Minimize: sum(e_i²) over all 4 anchors

Initial guess: Center of warehouse (20, 15)

Iteration 1:

  • Predicted distances from (20, 15):
    • to A (0,0): sqrt(20² + 15²) = 25.0 m vs measured 17.8 m → error = +7.2 m
    • to B (40,0): sqrt(20² + 15²) = 25.0 m vs measured 39.8 m → error = -14.8 m
    • to C (40,30): sqrt(20² + 15²) = 25.0 m vs measured 25.1 m → error = -0.1 m
    • to D (0,30): sqrt(20² + 15²) = 25.0 m vs measured 31.6 m → error = -6.6 m

Jacobian matrix (gradients):

J = [∂e_A/∂x, ∂e_A/∂y]   = [(20-0)/25.0, (15-0)/25.0]   = [0.80,  0.60]
    [∂e_B/∂x, ∂e_B/∂y]     [(20-40)/25.0, (15-0)/25.0]     [-0.80, 0.60]
    [∂e_C/∂x, ∂e_C/∂y]     [(20-40)/25.0, (15-30)/25.0]    [-0.80,-0.60]
    [∂e_D/∂x, ∂e_D/∂y]     [(20-0)/25.0, (15-30)/25.0]     [0.80, -0.60]

Least-squares update: Δp = -(J^T J)^-1 J^T e

J^T J = [0.80² + 0.80² + 0.80² + 0.80²,  ...] = [2.56,  0   ]
        [...,  0.60² + 0.60² + 0.60² + 0.60²]   [0,    1.44]

(J^T J)^-1 = [0.391,  0   ]
             [0,     0.694]

J^T e = [0.80×7.2 + (-0.80)×(-14.8) + (-0.80)×(-0.1) + 0.80×(-6.6)] = [13.12]
        [0.60×7.2 + 0.60×(-14.8) + (-0.60)×(-0.1) + (-0.60)×(-6.6)]    [-0.48]

Δp = -[0.391, 0; 0, 0.694] × [13.12, -0.48]^T = [-5.13, 0.33]

Updated position: (20, 15) + (-5.13, 0.33) = (14.87, 15.33) meters

Iteration 2: (Repeat with new position) - Predicted distances from (14.87, 15.33): - to A: sqrt(14.87² + 15.33²) = 21.4 m vs 17.8 m → error = +3.6 m - to B: sqrt(25.13² + 15.33²) = 29.5 m vs 39.8 m → error = -10.3 m - to C: sqrt(25.13² + 14.67²) = 29.1 m vs 25.1 m → error = +4.0 m - to D: sqrt(14.87² + 14.67²) = 20.9 m vs 31.6 m → error = -10.7 m

After 3 more iterations, least-squares converges to: (12.5, 18.2) meters

Final verification:

  • Distance to A: sqrt(12.5² + 18.2²) = 22.1 m (vs measured 17.8 m, error = 4.3 m ≈ 24%)
  • Distance to B: sqrt(27.5² + 18.2²) = 32.9 m (vs measured 39.8 m, error = 6.9 m ≈ 17%)
  • Distance to C: sqrt(27.5² + 11.8²) = 29.9 m (vs measured 25.1 m, error = 4.8 m ≈ 19%)
  • Distance to D: sqrt(12.5² + 11.8²) = 17.2 m (vs measured 31.6 m, error = 14.4 m ≈ 46%!)

Step 5: Uncertainty Estimation

With σ_RSSI = ±3 dBm, distance uncertainty: - σ_distance = |∂d/∂RSSI| × σ_RSSI = 0.23 × d × σ_RSSI (for log model) - For d=20m: σ_d = 0.23 × 20 × 3 = ±13.8 meters (huge uncertainty from RSSI!)

Position uncertainty (from Cramér-Rao bound): - σ_x ≈ σ_y ≈ σ_distance / sqrt(N_anchors) = 13.8 / sqrt(4) = ±6.9 meters

Result: Estimated position (12.5, 18.2) ± 6.9 m

Key Insights:

Aspect Value Observation
Estimated position (12.5, 18.2) m Inside warehouse bounds
Position uncertainty ±6.9 m (95% confidence) Large due to RSSI noise
Maximum residual error 14.4 m (Anchor D) Likely multipath interference
RMS error 8.3 m Typical for RSSI-based trilateration
Dilution of Precision 1.2 (good geometry) 4 anchors at corners provide good coverage

Lesson: RSSI-based trilateration provides 5-10m accuracy indoors (sufficient for room-level localization but not for precise asset positioning). The least-squares approach handles noisy/inconsistent measurements better than solving a minimal 3-anchor system. Anchor D’s large 14.4m error suggests multipath (warehouse metal racks reflecting signal) → could be improved by detecting and rejecting outlier measurements before least-squares.

Explore RSSI positioning uncertainty interactively:

RSSI noise directly impacts position accuracy. Path loss model: \(\text{RSSI}(d) = A - 10n \log_{10}(d)\).

With \(\pm3\) dBm noise: \(-40 \pm 3\) dBm corresponds to \(d = 10^{(-40-(-30))/(10 \times 2.5)} = 10^{-1/2.5} = 0.25 \times\) actual distance (for noise = +3) or \(2.5 \times\) actual (for -3).

For true distance 20m: RSSI noise gives range 8m to 50m. With 3 anchors, position uncertainty ±6.9m (95% confidence).

UWB time-of-flight avoids this: ±30cm ranging gives ±10-30cm position accuracy — 20× improvement for 10× hardware cost.

Choose the appropriate ranging/localization method based on accuracy requirements and constraints:

Requirement RSSI ToA/TDoA AoA UWB GPS Decision
Indoor Exclude GPS
Accuracy <1m Possible Use UWB
Accuracy 1-5m Marginal ✗ (indoor) ToA or AoA
Accuracy 5-10m ✓ (outdoor) RSSI cheapest
Low cost (<$5/node) RSSI only
No infrastructure GPS (outdoor only)
Real-time (<100ms) ✗ (1 Hz) Exclude GPS

Decision Algorithm:

Step 1: Indoor or outdoor?

  • Outdoor with sky view → GPS viable (3-5m accuracy, free infrastructure)
  • Indoor OR outdoor without sky view → Continue to Step 2

Step 2: What accuracy is required?

  • <30 cm: Only UWB achieves this (10-30 cm typical)
  • 30 cm - 1 m: ToA with precise sync OR AoA with arrays OR UWB
  • 1-5 m: ToA, TDoA, or AoA (depending on infrastructure)
  • 5-10 m: RSSI sufficient (cheapest option)

Step 3: What is the budget per node?

  • <$5: RSSI only (built into all radios, zero additional cost)
  • $5-$30: ToA with crystal oscillators
  • $30-$80: UWB modules (DW1000/DW3000)
  • $80-$200: AoA with antenna arrays
  • >$200: High-precision differential GPS

Step 4: Is synchronization infrastructure available?

  • YES (GPS timing, wired clock): ToA, TDoA viable
  • NO: RSSI or AoA (no sync required) OR UWB (self-synchronizing)

Application-Specific Recommendations:

Warehouse Asset Tracking:

  • Accuracy need: 2-3 meters (aisle-level)
  • Environment: Indoor, metal racks (multipath)
  • Budget: <$30/tag
  • Recommendation: TDoA with 10-20 anchors OR RSSI with dense deployment + fingerprinting
  • Justification: TDoA handles multipath better than RSSI, achieves 1-3m with proper anchor placement

Hospital Patient/Equipment Tracking:

  • Accuracy need: Room-level (3-5m)
  • Environment: Indoor, dynamic (people moving), high reliability required
  • Budget: $20-$40/tag (high-value assets justify cost)
  • Recommendation: BLE RSSI with fingerprinting + room boundary detection
  • Justification: Low power (coin cell lasts 1+ year), adequate accuracy for room identification

AGV/Robot Navigation:

  • Accuracy need: <30 cm (precision docking, collision avoidance)
  • Environment: Indoor factory floor
  • Budget: $80-$150/robot (high-value systems)
  • Recommendation: UWB with 8-12 anchors
  • Justification: Only technology achieving required <30 cm accuracy; robots have power budgets for UWB

Outdoor Vehicle Tracking:

  • Accuracy need: 3-10m (lane-level)
  • Environment: Open sky (urban canyons partial obstruction)
  • Budget: <$10/vehicle (consumer market)
  • Recommendation: GPS with cellular fallback (A-GPS)
  • Justification: GPS provides free infrastructure, 3-5m accuracy sufficient for most use cases

Parameter Tuning Guidance:

RSSI Path Loss Exponent (n):

  • Open space: n = 2.0 (free-space propagation)
  • Office/home: n = 3.0-3.5 (walls, furniture)
  • Factory/warehouse: n = 4.0-5.0 (metal, machinery)
  • Calibration: Measure RSSI at known distances, fit to model: RSSI = A - 10n×log₁₀(d)

ToA/TDoA Synchronization Precision:

  • 1 ns timing error = 30 cm ranging error (speed of light: 0.3 m/ns)
  • For 1m accuracy: Require <3 ns sync precision
  • GPS timing: 20-50 ns (insufficient for <1m accuracy)
  • Wired clock distribution: 1-5 ns (sufficient)
  • UWB self-sync: Sub-nanosecond (best)

AoA Antenna Spacing:

  • Accuracy: θ_error ≈ λ / (2π × d_antenna)
  • For 2.4 GHz (λ = 12.5 cm), d = 5 cm → θ_error ≈ 0.4 radians = 23°
  • At 10m range, 23° error = 4.1m position error
  • Guideline: Larger antenna spacing improves angular resolution but increases hardware size
Common Mistake: Treating RSSI-Distance Relationship as Universal Constant

The Mistake: Using a fixed path loss model (e.g., RSSI = -40 - 20×log₁₀(d)) across all environments without calibration, assuming RSSI-to-distance conversion is universally accurate.

Real-World Example: Smart home product (2020) shipped with asset tracking tags using hardcoded path loss exponent n = 2.5 (typical for residential). Marketing claimed “1-meter accuracy.” Customer complaints flooded in reporting “tracker says my keys are in the garage when they’re in the kitchen.”

Lab Testing (Controlled Environment):

  • Environment: Empty testing room, line-of-sight, no obstacles
  • Path loss model: RSSI(d) = -40 - 20×log₁₀(d) (n = 2.0 free-space)
  • Measured accuracy: 0.8-1.2 meters RMS error
  • Conclusion: “Meets spec, ship it!”

Customer Environment 1: Modern Apartment

  • Walls: Drywall with metal studs (signal attenuation)
  • Furniture: Metal file cabinets, appliances
  • Measured path loss exponent: n = 3.8 (vs assumed 2.5)
  • Impact: Tag 5 meters away appears to be at 2.6 meters (2.4m underestimate)
  • Customer complaint: “Tracker says keys are nearby but they’re in another room”

Customer Environment 2: Older Home

  • Walls: Lath-and-plaster (minimal attenuation)
  • Open floor plan
  • Measured path loss exponent: n = 2.2 (vs assumed 2.5)
  • Impact: Tag 5 meters away appears to be at 6.7 meters (1.7m overestimate)
  • Customer complaint: “Tracker says keys are far away but they’re in the same room”

Customer Environment 3: Office Building

  • Cubicles with metal frames
  • Fluorescent lights (electromagnetic interference)
  • Measured path loss exponent: n = 4.5
  • Multipath: Signals reflect off metal surfaces creating ghost echoes
  • Impact: Tag 5 meters away could appear anywhere from 1-10 meters (complete position ambiguity)
  • Customer complaint: “Tracker gives random locations, jumps around”

Why Fixed Model Fails:

Environmental Variation: | Environment | Path Loss Exponent (n) | Additional Factors | |————-|————————|——————-| | Free space (line-of-sight) | 2.0 | Ideal, never real | | Residential (wood walls) | 2.8-3.5 | Furniture, people | | Office (cubicles) | 3.5-4.5 | Metal, interference | | Factory/warehouse | 4.0-5.5 | Machinery, metal racks | | Urban outdoor | 3.5-4.0 | Buildings, vehicles |

Temporal Variation:

  • People moving: Person walking between tag and anchor → 5-8 dB attenuation (body shadowing)
  • Door states: Closed metal door → +15 dB attenuation (open vs closed)
  • Humidity: Affects 2.4 GHz propagation (up to 0.1 dB/m at high humidity)

Measurement Noise:

  • RSSI variance: ±5-8 dBm even at fixed distance (multipath fading)
  • For n = 2.5, 5 dBm error → 2× distance error (5m appears as 10m or 2.5m)

Corrective Approach: Environment-Adaptive Calibration

Option 1: User-Guided Calibration (Implemented 2021)

  • During setup, user places tag at 1m, 3m, 5m from anchors
  • App measures RSSI at each distance, fits path loss model: RSSI = A - 10n×log₁₀(d)
  • Stores environment-specific n value (typically 2.5-4.0)
  • Result: Accuracy improved from 40% error rate to 12% error rate (70% improvement)

Option 2: Fingerprinting (Implemented 2022)

  • Pre-calibration: User walks through home with tag, marking locations on map
  • System builds RSSI fingerprint database: {location → [RSSI_anchor1, RSSI_anchor2, …]}
  • Runtime: Match current RSSI vector to nearest fingerprint
  • Result: Accuracy improved to 1.8m RMS (meets original spec in real environments)
  • Trade-off: 15-minute setup process per installation

Option 3: Machine Learning Adaptation (Implemented 2023)

  • Train neural network on large dataset (10,000 homes, 500,000 measurements)
  • Input features: [RSSI_1, RSSI_2, …, RSSI_n, variance, temporal_stability]
  • Output: Corrected distance estimate
  • Model learns implicit environment characteristics from RSSI patterns
  • Result: Accuracy 1.5m RMS, zero user calibration
  • Trade-off: 8 KB model storage, 2 ms inference time per position update

Option 4: Hybrid Model + Fingerprinting (Current 2024)

  • Use physics-based path loss model as prior
  • Augment with 3-5 reference measurements during setup (minimal burden)
  • Bayesian fusion of model prediction and reference corrections
  • Result: 1.2m RMS accuracy, 2-minute setup, works in 95% of environments

Customer Satisfaction: | Approach | Accuracy | Setup Time | Customer Complaints | Return Rate | |———-|———-|————|———————|————-| | Original (Fixed Model) | 5.2m RMS | 0 min | 4,800/month | 18% | | User Calibration | 2.1m RMS | 5 min | 1,200/month | 7% | | Fingerprinting | 1.8m RMS | 15 min | 600/month | 3% | | ML Adaptation | 1.5m RMS | 0 min | 400/month | 2% | | Hybrid | 1.2m RMS | 2 min | 200/month | 1% |

Key Lesson: RSSI-based ranging suffers from extreme environmental sensitivity. Path loss exponent varies 2.2-5.5 across real-world environments (2.5× range), causing distance errors of 2-5×. Fixed path loss models work ONLY in controlled lab environments. Production systems must include environment-specific calibration (user-guided, fingerprinting, or ML adaptation) to achieve acceptable accuracy. The “1-meter accuracy” marketing claim requires either controlled environments OR adaptive calibration — never assume lab results transfer to customer deployments without environmental compensation.

Common Pitfalls

Relying on theoretical models without profiling actual behavior leads to designs that miss performance targets by 2-10×. Always measure the dominant bottleneck in your specific deployment environment — hardware variability, interference, and load patterns routinely differ from textbook assumptions.

Optimizing one parameter in isolation (latency, throughput, energy) without considering impact on others creates systems that excel on benchmarks but fail in production. Document the top three trade-offs before finalizing any design decision and verify with realistic workloads.

Most field failures come from edge cases that work in the lab: intermittent connectivity, partial node failure, clock drift, and buffer overflow under peak load. Explicitly design and test failure handling before deployment — retrofitting error recovery after deployment costs 5-10× more than building it in.

34.5 Summary

This chapter covered the six essential components of WSN target tracking algorithms:

  • Target Detection: Multi-sensor fusion combining PIR motion, ultrasonic ranging, and temperature sensing reduces false positives and improves detection reliability.

  • Node Cooperation: Cluster formation and in-network data aggregation enable sensors to collaborate, reducing communication overhead while improving position accuracy.

  • Position Computation: Trilateration using distance measurements from 3+ sensors enables precise position estimation, with least-squares optimization for noisy measurements.

  • Future Position Estimation: Kalman filtering provides smooth trajectory prediction by combining motion models with noisy measurements, enabling proactive sensor activation.

  • Energy Management: Prediction-based selective wake-up activates only sensors along the expected target path, achieving 85-90% energy savings.

  • Target Recovery: Expanding ring search and probabilistic methods relocate targets when predictions fail, ensuring robust tracking despite unpredictable target behavior.

Test Your Understanding

Question 1: Why does multi-sensor fusion (combining PIR + ultrasonic) improve target detection reliability compared to a single sensor?

  1. Two sensors always consume less power than one
  2. Combining sensors with different modalities reduces false positives – both must agree before confirming detection
  3. Multi-sensor systems eliminate the need for position computation
  4. PIR sensors can measure exact distance, making ultrasonic redundant

b) Combining sensors with different modalities reduces false positives. PIR detects motion (heat changes) while ultrasonic measures distance. A wind-blown branch might trigger PIR alone (false positive), but the ultrasonic range check confirms the object is within the expected distance. Both sensors must agree, dramatically reducing false alarms while maintaining high true detection rates.

Question 2: In prediction-based energy management, what happens when 85-90% of sensors are sleeping and the target makes an unexpected turn?

  1. The system permanently loses the target
  2. All sleeping sensors activate simultaneously
  3. An expanding ring search activates sensors in progressively larger circles from the last known position
  4. The system waits until the target returns to a monitored area

c) An expanding ring search activates sensors in progressively larger circles. When prediction fails, the system starts searching near the last known position and expands outward. Since the target cannot travel faster than its maximum speed, the ring radius grows based on time elapsed, bounding possible locations. This recovers the target efficiently without waking the entire network.

Question 3: Why does each 10x improvement in localization accuracy typically require 10x more hardware cost or power?

  1. More accurate sensors are always physically larger
  2. Higher accuracy requires more expensive ranging technology (e.g., UWB vs RSSI) and tighter synchronization
  3. Accuracy is limited only by the number of sensors deployed
  4. All localization techniques provide the same accuracy at different costs

b) Higher accuracy requires more expensive ranging technology. Cell ID (~100m accuracy) is free, RSSI (5-10m) uses standard radios, ToA/TDoA (1-3m) needs precise clocks, AoA (0.5-1m) requires antenna arrays, and sensor fusion (0.1-0.5m) combines multiple technologies. Each step up in accuracy demands more sophisticated hardware, tighter calibration, and higher power consumption.

34.6 Knowledge Check

34.7 Concept Relationships

Concept Relationship to WSN Tracking Algorithms Importance Why It Matters
Multi-Sensor Fusion Combines different sensing modalities (PIR motion + ultrasonic distance) to confirm target detection; both must agree to reduce false positives Critical Prevents wasted energy chasing false alarms: wind-blown branches trigger PIR alone but fail distance check, avoiding unnecessary cluster activation
Trilateration Position computation technique using distance measurements from 3+ sensors to solve for (x,y) coordinates via system of equations Critical Core positioning method: requires minimum 3 sensors for 2D position, 4+ for robustness against measurement noise and geometric dilution
Kalman Filtering Recursive algorithm that combines noisy measurements with motion model to predict future position and velocity High Enables proactive wake-up: predicting target 5 seconds ahead allows sensors to activate just before target arrives, not reactively after detection
Geometric Dilution of Precision (GDOP) Poor sensor geometry (e.g., collinear arrangement) amplifies measurement errors into large position errors High Sensor placement constraint: collinear sensors give 15m position error despite 5m sensor spacing; triangular arrangement minimizes GDOP
RSSI Path Loss Model RSSI(d) = A - 10n×log₁₀(d) relates received signal strength to distance; path loss exponent n varies 2.2-5.5 across environments Critical Distance estimation basis: RSSI-based trilateration achieves 5-10m accuracy but requires environment-specific calibration (office n=3.5, warehouse n=4.5)
Expanding Ring Search Recovery strategy that activates sensors in progressively larger circles from last known position when prediction fails Medium Bounded search efficiency: ring radius = max_velocity × time_elapsed limits search area, recovering target without full network wake-up
Prediction Confidence Radius Uncertainty in predicted position grows with prediction horizon; determines which sensors to wake proactively High Energy-accuracy tradeoff: narrow radius (±2m) saves energy but risks losing fast targets; wide radius (±10m) is robust but wakes more sensors

34.8 See Also

34.9 What’s Next

Topic Chapter Description
Energy Prediction Predictive Sensor Activation Worked example showing 95% energy savings in parking lot tracking
Problem Formulations WSN Tracking: Problem Formulations Push, poll, and guided tracking strategies
Comprehensive Review WSN Tracking: Comprehensive Review Integrated coverage of all tracking topics with design guidelines