1077  LoRaWAN Link Budget and ADR

1077.1 Learning Objectives

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

  • Calculate Link Budget: Compute maximum transmission range based on TX power, antenna gains, and receiver sensitivity
  • Understand Spreading Factor: Explain how SF affects range, data rate, and airtime
  • Apply ADR Algorithm: Describe how Adaptive Data Rate optimizes network performance
  • Design LPWAN Deployments: Use worked examples to plan LoRaWAN coverage and capacity

1077.2 Prerequisites

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

Link Budget is like calculating whether someone can hear you shouting across a field:

  • TX Power: How loud you shout (measured in dBm)
  • Antenna Gain: Using a megaphone to focus your voice (measured in dBi)
  • Path Loss: Sound gets quieter with distance (depends on frequency and obstacles)
  • Receiver Sensitivity: How quiet a whisper the listener can hear (measured in dBm)

If your “voice” (signal) is still louder than the listener’s “hearing threshold” (sensitivity) after traveling the distance, communication succeeds!

Spreading Factor (SF) is like speaking slowly vs quickly: - SF7 (fast): Like normal speech—clear if close, but hard to hear far away - SF12 (slow): Like spelling out each word slowly—can be understood from farther away, but takes much longer

Term Simple Explanation
Link Budget Total signal strength calculation (TX power + gains - losses)
Path Loss Signal weakening over distance (follows physics)
Spreading Factor Trade-off between range and speed (SF7=fast, SF12=far)
ADR Network automatically adjusts SF for each device
Duty Cycle Regulatory limit on how much you can transmit (1% in EU)

1077.3 Interactive: Wireless Range and Link Budget Calculator

Estimate the maximum transmission range for your LoRaWAN deployment (and other sub-GHz links with similar parameters) based on transmit power, antenna gains, receiver sensitivity, operating frequency, and environment:

NoteUnderstanding Link Budget

Link Budget is the total gain/loss in a wireless transmission path: - TX Power: How much power your device transmits (14 dBm typical for LoRa) - Antenna Gains: Better antennas focus energy in desired directions - RX Sensitivity: How weak a signal your gateway can detect (-137 dBm for SF12) - Path Loss: Signal weakens with distance and obstacles

Range Factors: - Free-space range: Ideal line-of-sight with no obstacles (satellite-like conditions) - Rural range: Often ~50-70% of free-space due to terrain and vegetation - Suburban range: Buildings and trees reduce range further - Urban range: Dense buildings and interference may reduce range to ~20% of free-space - Spreading Factor: For LoRaWAN, SF12 has better sensitivity (-137 dBm) than SF7 (-123 dBm), which directly increases the link budget

TipHands-On: Try This from the Simulation Playground
  • Use the sliders above to model your own deployment (sensor power, antenna gains, environment).
  • You can also open this calculator directly from the Simulation Playground via LoRaWAN Range & Link Budget, where it sits alongside other networking tools.

1077.4 Interactive: Spreading Factor Demo

Explore how LoRa’s Spreading Factor (SF) dramatically affects transmission characteristics. SF controls the trade-off between range, data rate, power consumption, and airtime.

1077.4.1 What is Spreading Factor?

LoRa uses chirp spread spectrum (CSS) modulation where each symbol is represented by a frequency sweep (“chirp”). The Spreading Factor determines how many chips encode each bit:

  • SF7: 128 chips per symbol (fastest, shortest range)
  • SF12: 4096 chips per symbol (slowest, longest range)

Higher SF = longer symbols = more robust against noise = more range, but slower data rate and longer airtime.

1077.4.2 Interactive SF Explorer

1077.4.3 Transmission Characteristics

1077.4.4 Spreading Factor Comparison Chart

1077.4.5 Key Takeaways

SF Best For Trade-off
SF7-8 Near gateways, high data rate needs Short range, fast
SF9-10 Most urban/suburban deployments Balanced
SF11-12 Rural, weak signals, deep indoor Long range, slow
NoteKey Insight: Spreading Factor Trades Speed for Range

flowchart LR
    subgraph SF7["SF7: Fast, Short Range"]
        F1["41ms airtime"]
        F2["2km range"]
        F3["878 msg/hour"]
    end

    subgraph SF12["SF12: Slow, Long Range"]
        S1["1.3s airtime"]
        S2["15km range"]
        S3["27 msg/hour"]
    end

    SF7 -.->|"32x slower<br>7x longer range"| SF12

    style SF7 fill:#16A085,color:#fff
    style SF12 fill:#E67E22,color:#fff

Figure 1077.1: LoRaWAN SF7 vs SF12 Airtime, Range, and Throughput Trade-off

In Plain English: Higher spreading factor stretches each bit over more time. Like shouting slowly vs speaking quickly - slower is heard farther, but you can say less per minute.

WarningDuty Cycle Constraints

Higher SF = longer airtime = hits duty cycle limits faster!

  • EU868: 1% duty cycle = max 36 seconds per hour TX time
  • SF12 @ 51 bytes = ~1.8 seconds per message = only 20 messages/hour
  • SF7 @ 51 bytes = ~0.1 seconds per message = 360 messages/hour

ADR helps maximize messages within duty cycle limits.

The Misconception: SF12 has the longest range, so use it for reliable communication.

Why It’s Wrong: - SF12 airtime: 1.3 seconds vs SF7: 41ms (32x longer) - Duty cycle limit: SF12 allows only 27 messages/hour vs 878 for SF7 - Energy: SF12 uses 32x more battery per message - Collision probability increases with longer airtime

Real-World Example: - Smart parking sensor in city center (good coverage) - Using SF12 “to be safe”: 27 updates/hour max - Parking turnover: 4 cars/hour average - Result: Can’t report all events! - With SF7: 878 updates/hour capacity, plenty of margin

The Correct Understanding: - Use ADR (Adaptive Data Rate) to automatically optimize - Start with SF7, only increase if packets are lost - SF12 is for extreme range cases only (rural, basement) - Higher SF = diminishing returns on range, major cost in capacity

Let the network optimize, don’t manually set SF12.

1077.5 Adaptive Data Rate (ADR) Algorithm

1077.5.1 How ADR Works

1077.6 Worked Example: LoRaWAN Airtime and Duty Cycle Calculation

This worked example demonstrates how to calculate time-on-air for LoRaWAN transmissions and determine maximum message rates under EU868 regulatory duty cycle constraints.

NoteReal-World Context: Smart Parking Sensor

A municipality is deploying 500 smart parking sensors across their city center. Each sensor detects vehicle presence using a magnetometer and reports status changes to a central parking management system. The deployment must comply with EU868 regulations (1% duty cycle limit on the 868.0-868.6 MHz band).

Design Questions: 1. How long does each transmission take at different spreading factors? 2. How many messages can each sensor send per hour/day while remaining compliant? 3. What is the trade-off between range and message capacity?

1077.6.1 Given Parameters

Parameter Value Notes
Payload 10 bytes Parking status (occupied/vacant) + battery level + timestamp
Region EU868 Sub-band g1: 868.0-868.6 MHz, 1% duty cycle
Bandwidth (BW) 125 kHz Standard LoRaWAN bandwidth
Coding Rate (CR) 4/5 Standard CR = 1
Preamble 8 symbols Standard LoRaWAN preamble
Header Explicit (enabled) Includes payload length
CRC Enabled 16-bit CRC

1077.6.2 Step 1: Symbol Time Calculation

The fundamental timing unit in LoRa is the symbol time (\(T_s\)):

\[T_s = \frac{2^{SF}}{BW}\]

Where: - \(SF\) = Spreading Factor (7 to 12) - \(BW\) = Bandwidth in Hz (125,000 Hz)

Calculations for each SF:

SF \(2^{SF}\) Symbol Time (\(T_s\))
SF7 128 \(\frac{128}{125000} = 1.024\) ms
SF8 256 \(\frac{256}{125000} = 2.048\) ms
SF9 512 \(\frac{512}{125000} = 4.096\) ms
SF10 1024 \(\frac{1024}{125000} = 8.192\) ms
SF11 2048 \(\frac{2048}{125000} = 16.384\) ms
SF12 4096 \(\frac{4096}{125000} = 32.768\) ms

Key Insight: Each SF increase doubles the symbol time, which doubles the airtime but improves receiver sensitivity by ~2.5 dB (extending range by ~40%).

1077.6.3 Step 2: Total Time-on-Air

Complete calculations:

SF Symbol Time Preamble Symbols Payload Symbols Total Symbols Time-on-Air
SF7 1.024 ms 12.25 28 40.25 41.2 ms
SF8 2.048 ms 12.25 28 40.25 82.4 ms
SF9 4.096 ms 12.25 23 35.25 144.4 ms
SF10 8.192 ms 12.25 23 35.25 288.8 ms
SF11 16.384 ms 12.25 23 35.25 577.5 ms
SF12 32.768 ms 12.25 23 35.25 1155.1 ms

1077.6.4 Step 3: EU868 Duty Cycle Compliance

EU868 sub-band g1 (868.0-868.6 MHz) has a 1% duty cycle limit:

\[T_{allowed} = 0.01 \times 3600 \text{ seconds} = 36 \text{ seconds per hour}\]

Maximum messages per hour:

\[N_{max/hour} = \frac{T_{allowed}}{T_{packet}}\]

SF Time-on-Air Max Messages/Hour Max Messages/Day Typical Range (Suburban)
SF7 41 ms \(\frac{36000}{41}\) = 878 21,072 2-3 km
SF8 82 ms \(\frac{36000}{82}\) = 439 10,536 3-4 km
SF9 144 ms \(\frac{36000}{144}\) = 250 6,000 4-6 km
SF10 289 ms \(\frac{36000}{289}\) = 124 2,976 6-9 km
SF11 578 ms \(\frac{36000}{578}\) = 62 1,488 9-12 km
SF12 1155 ms \(\frac{36000}{1155}\) = 31 744 12-15+ km

1077.6.5 Final Answer: Design Recommendations

TipParking Sensor Design Decision Matrix
Deployment Scenario Recommended SF Daily Message Budget Justification
City center (gateway every 500m) SF7-SF8 10,000-21,000 Dense gateway coverage, maximize message capacity
Suburban streets (gateway every 2km) SF9-SF10 3,000-6,000 Balance range and capacity, typical municipal deployment
Remote parking lots (sparse coverage) SF11-SF12 700-1,500 Prioritize range, accept lower message rate

For our 500-sensor deployment:

  • With SF10: Each sensor can send 124 status changes/hour
  • Parking turnover: Average 4 status changes per spot per day (2 arrivals + 2 departures)
  • Margin: \(\frac{2976}{4}\) = 744x safety margin for status updates
  • Heartbeat messages: Can add 1 heartbeat/hour (24/day) and still have 2952 messages/day capacity

Conclusion: SF10 provides 6-9 km range with comfortable margin for parking status + hourly heartbeats + occasional retransmissions.

1077.6.6 Interpretation: The Range vs. Capacity Trade-off

%%{init: {'theme': 'base', 'themeVariables': {'primaryColor': '#2C3E50', 'primaryTextColor': '#fff', 'primaryBorderColor': '#16A085', 'lineColor': '#16A085', 'secondaryColor': '#E67E22', 'tertiaryColor': '#7F8C8D', 'background': '#ffffff', 'mainBkg': '#2C3E50', 'secondBkg': '#16A085', 'tertiaryBkg': '#E67E22'}}}%%
graph LR
    subgraph tradeoff[" LoRaWAN SF Trade-off Space "]
        SF7[SF7<br/>41ms airtime<br/>878 msg/hr<br/>2-3 km range]
        SF10[SF10<br/>289ms airtime<br/>124 msg/hr<br/>6-9 km range]
        SF12[SF12<br/>1155ms airtime<br/>31 msg/hr<br/>12-15 km range]
    end

    FAST[High Throughput<br/>Short Range] --> SF7
    SF7 --> SF10
    SF10 --> SF12
    SF12 --> LONG[Low Throughput<br/>Long Range]

    ADR[ADR Algorithm<br/>Optimizes SF<br/>per device]

    ADR -.->|Near gateway| SF7
    ADR -.->|Medium distance| SF10
    ADR -.->|Edge of coverage| SF12

    style tradeoff fill:#f0f0f0,stroke:#2C3E50,stroke-width:2px
    style SF7 fill:#16A085,stroke:#2C3E50,color:#fff
    style SF10 fill:#E67E22,stroke:#2C3E50,color:#fff
    style SF12 fill:#2C3E50,stroke:#16A085,color:#fff
    style FAST fill:#16A085,stroke:#2C3E50,color:#fff
    style LONG fill:#2C3E50,stroke:#16A085,color:#fff
    style ADR fill:#7F8C8D,stroke:#2C3E50,color:#fff

Figure 1077.2: LoRaWAN Spreading Factor Trade-off with ADR Optimization {fig-alt=“LoRaWAN spreading factor trade-off diagram showing SF7 with 41ms airtime, 878 messages per hour, and 2-3km range at one end, SF10 with 289ms airtime, 124 messages per hour, and 6-9km range in the middle, and SF12 with 1155ms airtime, 31 messages per hour, and 12-15km range at the other end. ADR algorithm automatically optimizes SF based on link quality, selecting lower SF for devices near gateways and higher SF for devices at edge of coverage.”}

Key Takeaways:

  1. SF12 has 28x longer airtime than SF7 (1155ms vs 41ms)
  2. Duty cycle limits scale inversely with airtime - SF12 allows only 31 messages/hour vs 878 for SF7
  3. ADR is essential - The network automatically optimizes SF per device based on link quality
  4. Design for worst case - Size your deployment assuming devices at coverage edge use SF10-SF12
  5. Regulatory compliance is non-negotiable - Exceeding duty cycle can result in fines and interference
WarningCommon Mistake: Forgetting Retransmissions

The calculations above assume 100% delivery rate. In practice, include margin for:

  • Confirmed uplinks: Require acknowledgment, may need 1-2 retries
  • Interference: Other devices, weather, temporary obstacles
  • Network congestion: Gateway capacity limits

Rule of thumb: Design for 50% of theoretical maximum to ensure reliable operation.

1077.10 Interactive Lab: LoRaWAN Network Server Simulation

NoteHands-On: Build a Complete LoRaWAN Network Stack

In this lab, you’ll implement a LoRaWAN Class A end device with network server simulation running on an ESP32. This comprehensive simulation demonstrates:

Core Concepts: - Device Classes: Class A (power-optimized), Class B (scheduled downlinks), Class C (continuous reception) - Join Procedures: OTAA (Over-the-Air Activation) vs ABP (Activation By Personalization) - Message Flow: Uplink data transmission, RX1/RX2 downlink windows, MAC commands - Security: AES-128 encryption with NwkSKey and AppSKey, frame counter management - ADR Algorithm: Adaptive Data Rate optimization based on link quality

What You’ll Learn: 1. How OTAA join procedure works with DevEUI, AppEUI, and AppKey 2. RX1 and RX2 receive window timing (1s and 2s delays) 3. Duty cycle management (1% EU868 regulations) 4. ADR algorithm adjusting spreading factor based on SNR/RSSI 5. Confirmed vs unconfirmed uplink trade-offs

Hardware Required: - ESP32 development board (simulated in Wokwi) - Serial monitor for viewing network activity

Lab Duration: 30-45 minutes

1077.10.1 Embedded Simulation

TipHow to Use This Simulation

Getting Started: 1. Click “Start Simulation” in the Wokwi window above 2. Open the Serial Monitor (bottom panel) to see network activity 3. The simulation will automatically perform an OTAA join and start sending uplinks

What You’ll See: - Join Request/Accept: OTAA activation sequence with key derivation - Uplink Messages: Periodic sensor data transmissions with frame counter - RX Windows: RX1 (1s) and RX2 (2s) receive windows after each uplink - MAC Commands: LinkADRReq/Ans for spreading factor optimization - ADR Updates: Automatic adjustment of SF based on link quality - Duty Cycle: Transmission timing respecting 1% duty cycle limits

Understanding the Output:

[JOIN] DevEUI: 0x1122334455667788
[JOIN] AppEUI: 0x7766554433221100
[JOIN] Sending Join Request...
[JOIN] Join Accept received!
[JOIN] DevAddr: 0x26011234
[JOIN] NwkSKey and AppSKey derived
[UPLINK] FCnt: 0, SF: 10, Power: 14dBm
[UPLINK] Payload: Temperature=22.5C
[RX1] Window opened (1000ms after TX)
[ADR] LinkADRReq received: SF9, TxPower=11dBm
[ADR] LinkADRAns sent, new settings applied

1077.10.2 Challenge Exercises

Try these hands-on experiments to deepen your understanding:

WarningChallenge 1: Simulate Poor Link Quality

Task: Force the ADR algorithm to increase spreading factor due to bad link conditions.

Steps: 1. Find the simulateLinkQuality() function 2. Set SNR to -10 dB and RSSI to -120 dBm (very poor signal) 3. Observe ADR increasing SF from SF10 to SF11 or SF12 4. Calculate the impact on airtime and battery life

Questions: - How many times longer is SF12 vs SF7 airtime? (Hint: ~128x for same payload) - Why does the network server wait 20+ uplinks before changing SF? (Stability) - What’s the trade-off between range and battery life? (SF12 = better range but more power)

WarningChallenge 2: Measure Duty Cycle Compliance

Task: Verify that the device respects EU868 1% duty cycle regulations.

Steps: 1. Count uplink transmissions over 100 seconds 2. Calculate total time-on-air (ToA) using the formula in code 3. Verify: (ToA / 100s) <= 0.01 (1%) 4. Try sending faster and observe duty cycle blocking

Questions: - At SF10, 20-byte payload = ~370ms airtime. Max messages per hour? (97 messages) - What happens if you violate duty cycle? (Transmission blocked, data queued) - How does ADR help with duty cycle? (Lower SF = shorter ToA = more messages allowed)

1077.11 Summary

This chapter covered:

  • Link Budget Calculation: How to estimate maximum range using TX power, antenna gains, and receiver sensitivity
  • Spreading Factor Trade-offs: Higher SF = longer range but slower data rate and more airtime
  • ADR Algorithm: How the network automatically optimizes SF and TX power per device
  • Duty Cycle Constraints: Regulatory limits that restrict message rates, especially at higher SF
  • Practical Design: Worked examples for sizing deployments and ensuring compliance

Key Takeaway: Let ADR optimize your network. Start with lower SF (SF7-SF8) and trust the algorithm to increase SF only when needed. This maximizes throughput and minimizes battery consumption while ensuring reliable delivery.

TipWhat’s Next?

Return to the LoRaWAN Architecture Overview for a summary of all architecture topics, or continue to LoRaWAN Topic Review for deeper coverage of specific topics.