1081 LoRaWAN Practice Exercises
1081.1 Learning Objectives
By completing these exercises, you will be able to:
- Calculate LoRaWAN range and coverage requirements
- Design ADR strategies for different deployment scenarios
- Select appropriate device classes for various use cases
- Plan multi-gateway deployments with redundancy
- Apply LoRaWAN knowledge to real-world problems
1081.2 Exercise 1: LoRaWAN Range Testing and Optimization
Objective: Understand how environmental factors and spreading factors affect LoRaWAN range in real-world deployments
Tasks: 1. Using range estimation principles, calculate the maximum range for: - Urban environment with SF7 vs SF12 - Rural environment with standard antenna (2 dBi) vs high-gain antenna (6 dBi) - Indoor environment with different TX power settings (14 dBm vs 20 dBm) 2. Document the trade-offs: For each scenario, note the airtime (from spreading factor tables) and calculate how many messages per hour you can send while staying under 1% duty cycle limit (36 seconds per hour) 3. Design a sensor deployment: You have 50 soil moisture sensors to deploy across a 100-acre farm. Determine optimal SF settings and gateway placement to achieve 5-year battery life
Expected Outcome: - Understanding that SF12 provides 7x more range than SF7 but uses 26x more power - Recognition that duty cycle limits (1% EU, 4% US) constrain message frequency at higher SFs - Practical gateway placement strategy balancing coverage and power consumption
Solution Hints: - SF7 range: ~2 km urban, SF12 range: ~15 km rural - At SF7 (56 ms airtime), 1% duty cycle allows ~640 messages/hour - At SF12 (1320 ms airtime), 1% duty cycle allows only ~27 messages/hour - For 100 acres (~0.4 km2), one gateway with 2 km radius provides full coverage
1081.3 Exercise 2: Adaptive Data Rate (ADR) Simulation
Objective: Explore how ADR dynamically optimizes spreading factor based on signal quality
Tasks: 1. Scenario setup: Simulate three LoRaWAN end devices at different distances from gateway: - Device A: 500m away (strong signal, RSSI -80 dBm) - Device B: 3 km away (medium signal, RSSI -110 dBm) - Device C: 10 km away (weak signal, RSSI -130 dBm) 2. Manually determine optimal SF for each device using the rule: RSSI > -100 dBm -> SF7, RSSI -100 to -120 dBm -> SF10, RSSI < -120 dBm -> SF12 3. Calculate battery life improvement: Using airtime values from the chapter (SF7: 56ms, SF10: 370ms, SF12: 1320ms), compute how much longer Device A’s battery lasts compared to if all devices used SF12 4. Test ADR response: What happens if Device A moves from 500m to 5km? How many uplink messages before network server adjusts SF?
Expected Outcome: - Device A uses SF7 (56ms airtime), Device B uses SF10 (370ms), Device C uses SF12 (1320ms) - Device A battery lasts 23x longer than if forced to SF12 - Understanding that ADR takes 20-30 uplinks to converge on optimal SF - Recognition that mobile devices shouldn’t use ADR (signal strength changes too quickly)
Solution Calculation:
Battery life comparison for Device A:
- With SF12: 1320ms airtime per message
- With SF7: 56ms airtime per message
- Ratio: 1320/56 = 23.6x longer battery life with SF7
ADR convergence:
- Default ADR needs 20 uplinks to calculate optimal SF
- At 1 uplink/15 minutes: 20 x 15 = 300 minutes = 5 hours
- During movement, SF may oscillate as signal changes
1081.4 Exercise 3: LoRaWAN Class Comparison for Use Cases
Objective: Select appropriate device class (A, B, C) based on application requirements
Tasks: 1. Analyze three IoT scenarios: - Smart water meter: Sends reading once per hour, never needs downlink commands, must run 10 years on battery - Smart street light: Needs to turn on/off within 5 seconds of command, plugged into mains power - Industrial valve actuator: Sends status every 10 minutes, must respond to emergency close command within 2 minutes, battery-powered with solar charging 2. For each scenario, determine: - Which LoRaWAN class (A, B, or C)? - Estimated power consumption (use Class A: 15 uA sleep, Class B: 50 uA, Class C: 15 mA continuous RX) - Downlink latency (Class A: minutes-hours, Class B: seconds-minutes via beacon windows, Class C: <1 second) 3. Calculate battery life: If device sends 50-byte message with SF10 (370ms airtime), compute battery life for 2000 mAh battery: - Water meter (Class A, 1 msg/hour) - Valve actuator (Class B, 6 msg/hour with ping slot every 128 seconds)
Expected Outcome: - Water meter -> Class A (10+ year battery life) - Street light -> Class C (mains powered, instant response) - Valve actuator -> Class B (2-3 year battery, 2-minute response acceptable) - Understanding power consumption trade-offs between listening modes
Solution Table: | Scenario | Class | Downlink Latency | Battery Life | |———-|——-|——————|————–| | Water meter | A | 1 hour (next uplink) | 10+ years | | Street light | C | <1 second | N/A (mains) | | Valve actuator | B | 2 minutes (ping slot) | 2-3 years |
1081.5 Exercise 4: LoRaWAN Gateway Coverage Planning
Objective: Design a multi-gateway deployment for reliable coverage
Tasks: 1. Campus deployment scenario: Deploy LoRaWAN network for university campus (1 km x 1 km) with: - 200 parking sensors (Class A, outdoor, SF7-SF10) - 50 building environmental sensors (Class A, indoor, SF10-SF12) - 20 smart locks (Class B, indoor, must respond within 30 seconds) 2. Calculate minimum gateway count: - Outdoor range: 2 km radius per gateway (SF7-SF10) - Indoor penetration: -10 dB loss through walls (reduces range by ~50%) - Overlap requirement: Every end device must reach at least 2 gateways (redundancy) 3. Determine gateway placement: Sketch campus map and mark gateway locations to achieve: - 100% outdoor coverage with 2x redundancy - 90%+ indoor coverage (acceptable dead zones in basements) - Load balancing (no gateway handling >100 devices) 4. Capacity planning: Gateway supports 8 channels x 6 SFs = 48 concurrent transmissions. With 270 devices sending avg 1 msg/5 min, calculate channel utilization
Expected Outcome: - Minimum 4-6 gateways needed for 1 km2 campus with redundancy - Strategic placement at building rooftops for maximum coverage - Understanding that indoor sensors need higher SF -> longer airtime -> more gateway capacity consumed - Channel utilization stays <30% to avoid congestion
Solution Approach:
Gateway placement strategy:
1. Place first gateway at campus center (covers ~3 km2 outdoor)
2. Add 3 gateways at corners for 2x redundancy
3. Add 1-2 gateways inside large buildings for indoor coverage
Capacity calculation:
- 270 devices x 1 msg/5 min = 54 msgs/min = 0.9 msgs/sec
- Average airtime: (56 + 370 + 1320) / 3 = ~580 ms
- Channel utilization: 0.9 x 0.58 = 0.52 channels busy
- With 48 concurrent channels: 0.52/48 = 1.1% utilization
- Conclusion: Network has 30x capacity headroom
1081.6 Exercise 5: Troubleshooting LoRaWAN Deployments
Objective: Diagnose and fix common LoRaWAN problems
Scenario: A smart agriculture deployment has the following issues:
- Problem 1: 30% of devices stopped reporting data after firmware update
- Symptoms: Devices show “TX complete” but network server receives nothing
- Hint: Frame counter reset
- Problem 2: Battery life is only 6 months instead of expected 5 years
- Symptoms: All devices using SF12 despite being within 2 km of gateway
- Hint: ADR disabled or not working
- Problem 3: Devices work fine for 30 minutes, then stop for 2 hours
- Symptoms: Messages transmitted but immediately rejected
- Hint: Duty cycle violation
Tasks: 1. For each problem, identify the root cause 2. Propose a fix 3. Explain how to prevent this in future deployments
Expected Solutions:
Problem 1 - Frame Counter Reset: - Cause: ABP devices reset FCnt to 0, but network server expects higher value - Fix: Enable “FCnt reset allowed” on network server, or switch to OTAA - Prevention: Always use OTAA in production
Problem 2 - ADR Not Working: - Cause: ADR disabled in firmware, or devices marked as mobile - Fix: Enable ADR, verify devices are stationary profile - Prevention: Default ADR enabled for stationary sensors
Problem 3 - Duty Cycle Violation: - Cause: Devices transmitting too frequently at high SF - Fix: Reduce transmission frequency or lower SF - Prevention: Calculate duty cycle budget before deployment
1081.7 Summary
These exercises covered:
- Range Planning: SF selection based on distance and environment
- ADR Strategy: Enabling ADR for stationary devices, disabling for mobile
- Class Selection: Class A for sensors, Class C for mains-powered actuators
- Gateway Deployment: Redundancy, indoor coverage, capacity planning
- Troubleshooting: Frame counters, ADR, duty cycle issues
1081.9 What’s Next
Return to LoRaWAN Overview for the complete chapter index, or continue to LoRaWAN Architecture for detailed protocol specifications.