back to writing
LoRaWAN Series · Part 1 of 4 · also on LinkedIn

LoRaWAN: how it actually works

LoRaWAN is not just a radio protocol. It is a full network architecture with device classes, join procedures, and tradeoffs that only become visible when you deploy it in the real world.

A shorter version of this post is on LinkedIn. Follow along for the weekly series.

follow on linkedin

Most people who have heard of LoRaWAN think of it as a long-range radio technology. That is not wrong, but it is incomplete in a way that causes real problems when you try to build with it.

LoRa, the physical radio layer, is made by Semtech. It uses chirp spread spectrum modulation to achieve impressive range at very low power. That part is the radio chip on your PCB.

LoRaWAN is the network protocol built on top of LoRa. It defines how devices join a network, how data flows from device to cloud, how the network manages thousands of nodes, and how downlink messages get delivered to devices that spend most of their time asleep. It is the part that most documentation glosses over, and it is the part that determines whether your product actually works at scale.

I have been working with LoRaWAN since 2016, when the ecosystem was young enough that no production-ready network server existed. I wrote one from scratch. What follows is what I wish someone had explained to me at the start.

The network architecture

A LoRaWAN network has four layers. Understanding what each one does and where your responsibilities begin and end is the foundation of everything else.

Layer 1
End devices

The sensors, meters, or actuators in the field. They transmit data uplink to the network and occasionally receive downlink messages from it. Most end devices spend the vast majority of their time in deep sleep. They wake up, transmit, listen briefly for a downlink window, and go back to sleep. This is what makes the battery life possible.

Layer 2
Gateways

Gateways are radio bridges. They receive packets from end devices over LoRa and forward them to the network server over an IP backhaul, typically Ethernet, Wi-Fi, or cellular. Critically, gateways are transparent to the network. They do not process or decrypt the packets. They just forward them. This means a packet transmitted by a device can be received by multiple gateways simultaneously, and the network server handles the deduplication.

Layer 3
Network server

The network server is the brain of the LoRaWAN network. It handles device authentication, frame deduplication when multiple gateways receive the same packet, adaptive data rate management, and downlink scheduling. It also manages the receive windows: the brief periods after an uplink when a device listens for a downlink. Miss those windows and you have to wait for the next uplink cycle. This is the layer that most product teams underestimate until they are debugging a production deployment.

Layer 4
Application server

The application server receives decrypted payloads from the network server and does something useful with them: storing data, triggering alerts, feeding dashboards, integrating with other systems. This is where your business logic lives. The network server hands you the bytes. The application server figures out what they mean.

How devices join the network

Before a device can exchange data, it has to join the network. LoRaWAN supports two join methods.

OTAA (Over-The-Air Activation) is the right way to do it. The device transmits a join request containing its unique identifier and a cryptographic key derived from the root keys provisioned at the factory. The network server validates this, derives session keys, and sends a join accept. From that point forward, all communication uses those session keys. If a device re-joins, new session keys are derived, which means compromised session keys do not permanently compromise the device.

ABP (Activation By Personalization) hardcodes the session keys directly into the firmware. It is simpler to implement and avoids the join procedure overhead, but it is a security and operational problem. The session keys never rotate. Frame counters do not reset correctly across power cycles unless you handle it carefully. If your device ends up in someone's hands, those static keys are extractable. Avoid ABP in production unless you have a very specific reason for it.

Device classes and the downlink problem

This is the part that surprises most people building LoRaWAN products for the first time.

End devices are asleep most of the time. The network cannot send a downlink message to a device whenever it wants. It has to wait for the device to open a receive window, which only happens after the device transmits an uplink. This constraint shapes everything about how you design the communication pattern for your application.

LoRaWAN defines three device classes to handle different tradeoffs between power consumption and downlink latency.

Class A
Lowest power, highest downlink latency

Class A devices open two short receive windows after every uplink transmission. If the network server wants to send a downlink, it must use one of those two windows. If it misses them both, it has to wait for the next uplink. For a water meter that transmits once per hour, that means downlink latency of up to one hour. For most sensor applications this is fine. For anything that needs responsive remote control it is not. Every LoRaWAN device must support Class A as the baseline.

Class B
Scheduled receive windows, predictable latency

Class B devices open additional receive windows at scheduled intervals, synchronized to the gateway beacon. This gives the network server predictable downlink slots without requiring the device to be always listening. The tradeoff is that the device must wake up periodically to synchronize with the beacon, which increases power consumption compared to Class A. Class B is useful when you need lower and more predictable downlink latency without going to always-on.

Class C
Always listening, lowest latency, highest power

Class C devices keep their receiver open continuously, except when transmitting. Downlink latency is near-zero. Power consumption is much higher. Class C makes sense for mains-powered devices or actuators where immediate response to a command matters more than battery life. A smart street light controller is a good Class C use case. A battery-powered sensor is not.

Spreading factors and the range vs data rate tradeoff

LoRa uses a spreading factor, SF7 through SF12, to trade data rate for range and noise immunity. This is one of the most misunderstood knobs in the protocol.

Think of it as a conversation volume dial. At SF7, you are talking at a normal volume: fast, efficient, but you need to be relatively close to be heard. At SF12, you are shouting slowly and deliberately: much further range and resistance to noise, but the transmission takes significantly longer and uses more airtime.

The airtime implications matter for two reasons. First, longer transmissions consume more battery. Second, LoRaWAN operates in unlicensed spectrum subject to duty cycle limits. In Europe, for example, most channels have a 1% duty cycle limit, meaning a device can only transmit for 36 seconds per hour on a given channel. A long SF12 transmission eats into that budget fast. At SF7 the same payload transmits roughly 50 times faster than at SF12.

Adaptive Data Rate (ADR) is the network server's mechanism for automatically adjusting the spreading factor based on link quality. Devices closer to the gateway get pushed to lower spreading factors to free up airtime for devices at the edge of coverage. When it works well, ADR optimizes the network automatically. When it is misconfigured or the device is mobile, it can cause more problems than it solves. For fixed installations, ADR is generally a good idea. For moving assets, think carefully before enabling it.

What the network server actually does

When I built the network server for the water meter project in 2016, I had to figure out all of this the hard way because there was no reference implementation to look at. The things that took the most time to get right were not the radio parts. They were the edge cases in the network protocol.

Frame counter management is one of them. LoRaWAN uses incrementing frame counters to prevent replay attacks. The network server rejects any frame with a counter lower than or equal to the last received counter. This sounds simple but creates a real problem: what happens when a device resets? Its frame counter resets to zero. The network server sees what looks like a replay attack and rejects the frames. If you do not handle this gracefully, your device goes silent after a reset and you have no idea why.

Deduplication is another one. A single uplink from a device might be received by three gateways simultaneously. The network server receives three copies of the same packet with the same frame counter. It needs to recognize them as duplicates, pick the best one based on signal quality, and forward only one to the application server. Get this wrong and your application sees triplicate data.

Downlink scheduling is the third. The Class A receive windows open exactly one second and two seconds after the uplink ends. The network server has to schedule the downlink transmission on the correct gateway, at the correct frequency, with the correct data rate, within that one-second window. Miss it and the device will not hear the response.

The things that only become visible in production

Reading the spec gives you the happy path. Deploying a network gives you everything else.

In dense urban deployments, interference from other LoRaWAN networks on the same channels is real. The protocol uses listen-before-talk in some regions and does not in others. Channel planning and gateway placement matter more than the spec suggests.

Gateway backhaul failures are invisible to end devices. If your gateway loses its internet connection, devices keep transmitting and hearing nothing back. They have no way to know the network is down. Your monitoring needs to track gateway connectivity independently of device connectivity.

Regional parameters are not optional knowledge. Frequency bands, channel plans, duty cycle limits, and maximum transmit powers are all region-specific. A device configured for EU868 will not work correctly deployed in the US915 band. This seems obvious but it catches teams who build and test in one region and ship to another.

LoRaWAN is one of the best tools available for wide-area, low-power IoT deployments. But it rewards the teams who understand what is actually happening at the network layer, not just the teams who got a sensor transmitting in a demo environment. The gap between those two things is where most production problems live.


Next in series
LoRaWAN PCB design: antenna placement, RF layout, and what kills your range before the firmware runs
Coming later
LoRaWAN power consumption: real numbers, duty cycle math, and what the spec does not tell you

This is Part 1 of 4. The next three Tuesdays cover PCB design, power consumption, and when to use LoRaWAN versus when to walk away.

MY
Muhammet YILDIZ

Principal Embedded Systems Engineer at Hum Industrial. Founder of Ameza. 15+ years shipping IoT hardware.

linkedin