LoRaWAN (Long Range Wide Area Network) is one of the most powerful wireless communication protocols in the IoT world. With its low power consumption, long range, and low cost advantages, it forms the core infrastructure for smart agriculture, energy monitoring, smart city, and industrial IoT projects. In this comprehensive guide, you will find all technical details from LoRaWAN network architecture to network server setup, gateway selection to security protocols.
What Is LoRaWAN and How Does It Work?
LoRaWAN is an LPWAN (Low Power Wide Area Network) protocol built on Semtech’s LoRa (Long Range) radio modulation technology and standardized by the LoRa Alliance. It has been used in millions of devices worldwide since 2015.
LoRaWAN vs Other LPWAN Technologies
LoRaWAN offers distinct advantages over other LPWAN technologies such as Sigfox and NB-IoT:
- Unlicensed frequency: Operates in ISM band, operator-independent
- Private network deployment: You can set up your own gateway and network server
- Bidirectional communication: Device control via downlink messages is possible
- Open ecosystem: Gateway and sensor options from hundreds of manufacturers
- Scalability: Manage thousands of devices with a single gateway
LoRa Modulation Technique
LoRa uses the Chirp Spread Spectrum (CSS) modulation technique. The signal spreads across a wide frequency band, providing resilience against noise and interference. This enables reliable communication even at signal strengths as low as -137 dBm.
- Spreading Factor (SF): SF7-SF12 range, range/speed trade-off
- Bandwidth: 125 kHz, 250 kHz, or 500 kHz
- Coding Rate: Error correction between 4/5 and 4/8
What Are the Key Features of LoRaWAN?
LoRaWAN’s standout features make it ideal especially for IoT applications in remote locations. Here are the key technical specifications:
Range and Coverage
LoRaWAN’s most impressive feature is its long range:
- Open field: 15-20 km (with line of sight)
- Urban area: 2-5 km (between buildings)
- Indoor: 1-2 km (wall penetration)
- Underground: Works even in challenging environments like basements and caves
Battery Life
A sensor operating in Class A mode can run for 5-10 years on AA batteries. This is a critical advantage, especially for sensors in hard-to-reach locations. Factors affecting battery life:
- Message transmission frequency (uplink interval)
- Payload size and airtime
- Spreading factor (consumption increases with higher SF)
- TX power setting
- Sensor measurement frequency
Capacity and Scalability
A single 8-channel gateway can support between 1,000-5,000 devices with traffic management and ADR (Adaptive Data Rate). For higher density, coverage areas can be overlapped with multiple gateways.
How Is the LoRaWAN Network Architecture Structured?
LoRaWAN network architecture is organized in a star-of-stars topology. This architecture provides scalability and centralized management advantages.
Architecture Components
LoRaWAN Ağ Mimarisi
Yıldız-yıldız (star-of-stars) topolojisi
End Node
Uç Cihazlar
LoRa modüllü sensörler ve aktüatörler. Veri toplama ve kontrol.
Gateway
Ağ Geçidi
LoRa RF sinyallerini IP paketlerine çevirir. Packet Forwarder.
Network Server
Ağ Sunucusu
MAC layer yönetimi, cihaz kimlik doğrulama, ADR, güvenlik.
Application Server
Uygulama Sunucusu
Veri işleme, görselleştirme, alarm yönetimi ve raporlama.
End Node
Uç Cihazlar
LoRa modüllü sensörler ve aktüatörler. Veri toplama ve kontrol.
Gateway
Ağ Geçidi
LoRa RF sinyallerini IP paketlerine çevirir. Packet Forwarder.
Network Server
Ağ Sunucusu
MAC layer yönetimi, cihaz kimlik doğrulama, ADR, güvenlik.
Application Server
Uygulama Sunucusu
Veri işleme, görselleştirme, alarm yönetimi ve raporlama.
Detayları görmek için kutulara tıklayın
Layers and Their Roles
- End Node (End Device): Sensors, meters, actuators. Sends data to gateways via LoRa module.
- Gateway: Receives LoRa RF signals, converts to IP packets. Runs “packet forwarder” software. Not intelligent, merely forwards.
- Network Server: MAC layer management, device authentication, ADR, deduplication, downlink scheduling.
- Application Server: Payload decode, application logic, data storage, API serving.
Device Classes
LoRaWAN defines three device classes based on different energy and latency requirements:
Class A
Usage: Sensors, meters
Class B
Usage: Actuators, valves
Class C
Usage: Gateways, rechargeable devices
What Is a Network Server and How Does It Work?
The Network Server (NS) is the brain of the LoRaWAN network. It manages all MAC layer operations, performs device authentication, and coordinates data traffic.
Core Tasks of the Network Server
- Device Activation: OTAA join request/accept operations, session key derivation
- Deduplication: Preventing duplicate messages received from multiple gateways
- MAC Command Management: MAC commands such as ADR, DevStatusReq, LinkCheckReq
- Downlink Scheduling: Sending downlink in the correct RX window
- Frame Counter Control: Preventing replay attacks
- Roaming: Cross-network handover support (v1.1+)
ADR (Adaptive Data Rate)
ADR is a critical feature that optimizes network performance. The Network Server analyzes the signal quality (RSSI, SNR) of incoming messages to determine the optimal spreading factor and TX power:
- Good signal → Low SF → Faster, less airtime, less battery consumption
- Weak signal → High SF → More reliable, longer range
Need Help with LoRaWAN Infrastructure Setup?
Get expert support for ChirpStack or The Things Stack deployment, gateway placement, and network optimization. We serve across Northern Cyprus and Turkey.
Our Industrial IoT ServicesNetwork Server Options Comparison
Various network server solutions are available on the market. A wide range is offered from open-source options to enterprise solutions. Making the right choice according to your needs is critically important.
Popular Network Server Solutions
| Network Server | Type | Deployment | Cost | Best For |
|---|---|---|---|---|
| ChirpStack | Open Source | On-premise / Cloud | Free | Full control, customization |
| The Things Stack | Open/Commercial | Cloud (TTN) / On-premise | Freemium / Enterprise | Community + Enterprise projects |
| AWS IoT Core for LoRaWAN | Managed Service | AWS Cloud | Pay-as-you-go | AWS ecosystem integration |
| Actility ThingPark | Commercial | Cloud / On-premise | Enterprise license | Large-scale, carrier-grade |
| Loriot | Commercial | Cloud | Subscription | SMBs and quick start |
ChirpStack vs The Things Stack
Comparison of the two most popular open-source solutions:
- ChirpStack: Fully open source (MIT), self-hosted, high customization, gRPC API, easy setup with Docker
- The Things Stack: Community and Enterprise editions, global community via TTN (The Things Network), LoRa Cloud integration
Our recommendation: The Things Stack Community for small-medium projects and getting started, ChirpStack for full control and customization.
How to Choose a LoRaWAN Gateway?
Gateway selection is critically important for the success of your LoRaWAN project. Coverage area, capacity, reliability, and budget balance must be considered.
Gateway Categories
Indoor Mini Gateway
Compact, easy setup, WiFi/Ethernet
Outdoor Standard Gateway
IP67, external antenna, GPS, 4G backhaul
Carrier Grade Gateway
High capacity, redundancy, SLA
Gateway Placement Tips
- Height: The higher the antenna, the wider the coverage
- Fresnel Zone: No obstacles in the line of sight
- Backhaul: Ethernet, WiFi, 4G, or fiber connection
- Power source: PoE, DC, or solar panel
- Protection class: IP67 required for outdoor use
Device Management: OTAA and ABP
LoRaWAN devices can join the network using two different methods: OTAA (Over-The-Air Activation) and ABP (Activation By Personalization). Each method has its advantages and disadvantages.
OTAA vs ABP Comparison
OTAA (Over-The-Air Activation)
RecommendedNew session keys are derived each time the device powers up or a join is triggered. Authentication is done using DevEUI and AppKey.
ABP (Activation By Personalization)
Test OnlyDevAddr, NwkSKey and AppSKey are pre-written to the device. The join process is skipped but this creates a security risk.
Device Provisioning Best Practices
- DevEUI: Unique device identifier assigned at factory (64-bit)
- AppKey: Root key, must be stored securely (128-bit AES)
- Device Profile: Class, codec, uplink interval definitions
- Application: Device grouping and authorization
Planning a LoRaWAN Pilot Project?
Get end-to-end support from gateway and sensor procurement to installation for your smart agriculture, energy monitoring, or industrial IoT project.
Free Discovery MeetingFrequency Plans and EU868
LoRaWAN operates in different ISM bands worldwide. Compliance with regional regulations is critically important. The EU868 frequency plan applies in Turkey and Northern Cyprus.
Regional Frequency Plans
| Region | Frequency Band | Channel Count | Duty Cycle | Regulation |
|---|---|---|---|---|
| EU868 (Turkey/N. Cyprus/Europe)(Our region) | 863-870 MHz | 8 + 1 (G3) | 1% (per sub-band) | ETSI EN 300 220 / BTK |
| US915 (Americas) | 902-928 MHz | 64 uplink + 8 downlink | None (dwell time) | FCC Part 15 |
| AS923 (Asia-Pacific) | 915-928 MHz | 8 channels | Varies by country | Various (country-based) |
| AU915 (Australia) | 915-928 MHz | 64 uplink + 8 downlink | None | ACMA |
EU868 Duty Cycle Restriction
According to European regulations, a duty cycle restriction applies in the ISM band. This limits how much transmission a device can make within a given period:
- g band (868.0-868.6 MHz): 1% duty cycle
- g1 band (868.7-869.2 MHz): 0.1% duty cycle
- g2 band (869.4-869.65 MHz): 10% duty cycle
Practical impact: You can use 36 seconds of airtime per hour (g band, 1%). This is sufficient for typical sensor applications.
LoRaWAN Security Architecture
LoRaWAN offers a robust security architecture by design. Industrial-grade security is provided through AES-128 encryption, dual-layer protection, and frame counter mechanisms.
Security Layers
| Layer | Encryption | Key | Protection | Scope |
|---|---|---|---|---|
| Network Layer (Hop-by-hop) | AES-128 CTR mode | NwkSKey (Network Session Key) | MAC commands, frame counter, MIC | Between device and Network Server |
| Application Layer (End-to-end) | AES-128 CTR mode | AppSKey (Application Session Key) | Application payload | Between device and Application Server |
| Join Layer (Device Authentication) | AES-128 ECB mode | AppKey (Application Key) | Join request/accept, key derivation | OTAA device authentication |
| LoRaWAN 1.1 Additional Security | AES-128 | NwkKey, AppKey, JSIntKey, JSEncKey | Advanced key management, roaming security | For v1.1+ devices |
Security Best Practices
- Use OTAA: Dynamic key derivation instead of ABP
- Store AppKey securely: Secure element or HSM recommended
- TLS/SSL: Encryption for Gateway-NS and NS-AS communication
- Firmware updates: Apply security patches
- Network segmentation: Isolate IoT traffic
Application Integration and APIs
Application integration is critically important for transforming data collected from the LoRaWAN network into value. MQTT, HTTP webhook, and gRPC are the most commonly used integration methods.
Integration Protocols
MQTT
Pub/Sub messaging • Low (ms) latency
application/+/device/+/event/upHTTP Webhook
Push (server-to-server) • Medium latency
POST https://api.example.com/lorawangRPC
Bidirectional streaming • Lowest latency
Ideal for ChirpStack APIREST API
Request/Response • Medium latency
GET /api/devices/{devEUI}Code Examples
1. Payload Decoder (JavaScript)
Sample decoder function that can be used in ChirpStack and The Things Stack:
function decodeUplink(input) {
var bytes = input.bytes;
var decoded = {
// First byte: battery voltage (0.1V resolution)
battery: bytes[0] / 10,
// Bytes 2-3: temperature (0.01°C resolution, signed)
temperature: ((bytes[1] << 8) | bytes[2]) / 100,
// Bytes 4-5: humidity (0.01% resolution)
humidity: ((bytes[3] << 8) | bytes[4]) / 100,
// Bytes 6-7: soil moisture (0.01% resolution)
soilMoisture: ((bytes[5] << 8) | bytes[6]) / 100
};
return { data: decoded };
}2. ChirpStack Device Profile (YAML)
name: "Soil Sensor Profile"
description: "Profile for soil moisture sensor"
region: EU868
macVersion: LORAWAN_1_0_3
regParamsRevision: RP002_1_0_1
supportsOTAA: true
supportsClassB: false
supportsClassC: false
classBTimeout: 0
classCTimeout: 0
payloadCodecRuntime: JS
payloadCodecScript: |
// Decoder function goes here
uplinkInterval: 3600 # 1 hour
deviceStatusReqInterval: 1
adrAlgorithmId: default
flushQueueOnActivate: true3. MQTT Integration (Python)
import paho.mqtt.client as mqtt
import json
def on_connect(client, userdata, flags, rc):
print(f"Connected: {rc}")
# Subscribe to uplink messages from all devices
client.subscribe("application/+/device/+/event/up")
def on_message(client, userdata, msg):
payload = json.loads(msg.payload.decode())
dev_eui = payload.get("deviceInfo", {}).get("devEui")
data = payload.get("object", {})
print(f"Device: {dev_eui}")
print(f"Data: {json.dumps(data, indent=2)}")
client = mqtt.Client()
client.on_connect = on_connect
client.on_message = on_message
client.connect("localhost", 1883, 60)
client.loop_forever()Use Cases and Case Studies
LoRaWAN provides an ideal solution for many IoT scenarios requiring low data rates and long range. Here are the most common use cases:
Smart Agriculture and Greenhouse
Smart agriculture is one of LoRaWAN’s strongest areas. In large fields and greenhouses:
- Soil moisture and temperature monitoring
- Automatic irrigation control
- Weather station data
- Pest and disease early warning
Energy Monitoring
Consumption tracking in distributed locations with wireless energy meters:
- Electricity, water, gas meter reading
- Leak detection
- Tariff optimization
Smart City
- Smart parking sensors
- Waste container fill-level monitoring
- Air quality measurement
- Street lighting control
Industrial IoT
Industrial IoT applications with LoRaWAN:
- Equipment monitoring and asset tracking
- Environmental condition monitoring (temperature, humidity)
- Vibration and predictive maintenance sensors
Cost Analysis and ROI Calculation
The total cost of ownership (TCO) of LoRaWAN infrastructure is highly competitive compared to other wireless technologies. Low device costs, unlicensed frequency, and open-source options minimize costs.
Example Project Costs
| Project | Sensors | Gateway | Server | Total (Year 1) | ROI |
|---|---|---|---|---|---|
| Smart Agriculture (50 sensors) | ~$5,000 | ~$1,500 | Free (ChirpStack) | ~$8,000 | 12-18 months |
| Energy Monitoring (20 meters) | ~$8,000 | ~$2,000 | ~$1,200/year (TTS) | ~$13,200 | 6-12 months |
| Smart Parking (100 sensors) | ~$15,000 | ~$5,000 | ~$3,600/year | ~$28,600 | 18-24 months |
| Industrial IoT (30 devices) | ~$12,000 | ~$3,000 | Free (ChirpStack) | ~$18,000 | 8-14 months |
Implementation Steps
Steps to follow for a successful LoRaWAN project:
Coverage and Requirements Analysis
1-2 daysDefine the target area and map sensor locations. Clarify data transmission frequency, payload size, and battery life requirements.
Gateway Positioning
1 dayGateway locations are determined considering antenna height, Fresnel zone, and obstacles. Link budget is calculated.
Network Server Setup
2-3 daysChirpStack or The Things Stack is installed. Gateways are added and region configuration (EU868) is set up.
Device Provisioning
1 dayDevEUI and AppKey are defined. Device profile (Class A/B/C, codec) is created. OTAA join test is performed.
Payload Decoder Development
1-2 daysA JavaScript/WASM codec is written to decode sensor data. Unit conversions and data validation are added.
Application Integration
2-3 daysData transfer to ThingsBoard, Grafana, or a custom application is set up via MQTT or HTTP webhook.
Field Installation and Testing
2-3 daysGateways and sensors are installed on site. Coverage testing (RSSI, SNR) is performed. Problem areas are identified.
Optimization and Go-Live
1-2 daysADR parameters are tuned. Duty cycle optimization is performed. Alerts and notifications are configured.
Summary: Why Choose LoRaWAN?
- 15+ km range - Coverage with minimal infrastructure over large areas
- 10+ year battery life - Low operating costs, operation in inaccessible locations
- Unlicensed ISM band - Operator-independent, set up your own network
- Thousands of device capacity - Scalable solutions with a single gateway
- AES-128 encryption - Industrial-grade security
- Open ecosystem - ChirpStack, TTN, and hundreds of gateway/sensor options
Start Your LoRaWAN Project
At Olivenet, we provide LoRaWAN infrastructure deployment, gateway procurement, and network server management services across Northern Cyprus and Turkey. Contact us for a free discovery analysis.
Free Discovery Meeting