What is LoRa: The fundamentals

Vit Prajzler
12 min readOct 30, 2023

--

Photo by Alexey Ruban on Unsplash

Let me start by debunking what even AWS got wrong. As of Oct 27, 2023, the AWS page mistakenly claims that “LoRa is a physical layer protocol“. To add insult to injury, it further claims that “LoRa is a wireless audio frequency technology”.

Sorry AWS, but no. LoRa has nothing to do with audio frequencies.
There are chirps, but not that kind of chirps.

More importantly, LoRa is not a protocol.
At least not if you want to talk about it with a radio engineer.

But I understand why there are so many mix ups. When you first look into LoRa, it might be confusing to draw the line between LoRaWAN and LoRa, and how they are split across the network stack.

And once you start talking about chirps, especially in a long boring meeting with your AWS colleagues, you might drift off and start thinking about birds chirping and audio frequencies. I get it.

Let me set the record straight, and tell you what LoRa is.

But before I go back to a serious tone and dig deeper, why should you even listen to me?

My journey with LoRa

My journey with LoRa and LoRaWAN started a little over 10 years ago (as of October 2023).

I was there when Semtech and IBM Research started working on LoRaWAN, shortly after Semtech bought Cycleo, the original company and masterminds behind LoRa. Two of my former colleagues literally (co-)wrote the LoRaWAN standard — check the second page of the LoRaWAN 1.0.

That was all long before The Things Network came around, long before Chirpstack. Even SX1301 did not exist yet — we had to use FPGAs!

In 2015, I founded a company to build LoRaWAN software for network operators.

I have learned a ton about LoRa since then.

Enough nostalgia, let’s dive into LoRa and what it is and isn’t.

The ground truth

LoRa is a digital spread spectrum modulation, more specifically, a chirp spread spectrum modulation.

But you don’t need to take my word for it. If you want the ground truth about what LoRa is, go ahead and read the patent.

The patent doesn’t claim much about the modulation itself, but is focused on a specific way of building a modulator and demodulator.

You might be surprised, but in the 21st century it’s actually pretty hard to patent a modulation because modulations have been around for ages.

If you wanted to be super-accurate and define LoRa as exactly what is described in the patent, then LoRa is a communication system including a modulator and demodulator for a chirp signal.

That is a mouthful, and unsurprisingly, it’s not something a marketing department would choose to promote a product.

If we dial down the patent language, saying that LoRa is a chirp modulation is fairly accurate.

Either way, LoRa is definitively not a protocol. If you want a protocol to use with LoRa as the physical layer, have a look at LoRaWAN. LoRaWAN is a protocol, LoRa is not.

If you are here for the TL;DR, you can stop reading here.
If you’re here for the nitty-gritty, carry on.

What’s with the chirp, LoRa?

Chirp modulations have been around before LoRa. But Francois, Nicolas, and Olivier created something that has turned a chirp modulation into a solution to problems in the Internet of Things.

So what is a chirp modulation?

You might have heard about other modulation techniques, such as AM or FM, which stand for amplitude modulation and frequency modulation respectively. Those belong to an older family of modulations — analog modulations.

A chirp modulation is more advanced, and closer to a modulation that your Wi-Fi uses. But also not quite the same as Wi-Fi. That family is called digital modulation, and more specifically, spread-spectrum modulation.

Spread spectrum modulation is a modulation technique that was originally used in military applications to avoid detection of wireless communication by hiding it in noise, but has since found its way into the consumer space.

And hiding in noise is where a chirp modulation like LoRa excels.

LoRa chirping — Inspired by nature

It’s not called a chirp modulation by accident. The modulation does have a ton of similarity with bird chirps.

Have you ever thought about how easy it is to hear a chirp of specific bird species, even if there are multiple bird species chirping at the same time? And how far can you hear it and tell it apart from background noise?

You might not think of bats or dolphins as chirpers, but they do chirp, too. Unlike birds, it’s on a higher frequency that is inaudible to humans, but for the same reason — range of propagation, and separation from other noises.

All the sound wave properties of chirps translate well into radio waves. The advantage of a chirp modulation is that it is possible to decode the signal even when it’s completely sunk in noise. And that’s what gives LoRa its superpowers.

Details of a chirp modulated signal

In exact terms, a chirp is a signal in which frequency increases or decreases with time. Let’s break down what that means by comparing it to the less complex, but better known modulation techniques — AM and FM.

AM performs modulation by varying the amplitude of the signal at a constant frequency.

Amplitude modulation illustration
Credit: https://en.wikipedia.org/wiki/File:Illustration_of_Amplitude_Modulation.png

FM varies the signal frequency on top of a carrier frequency. You might be familiar with FM radio broadcast, where carrier is in the MHz range, while the modulated signal is 54 kHz for stereo signal, 59 kHz with RDS.

Frequency modulation illustration
Credit: https://commons.wikimedia.org/wiki/File:Illustration_of_Frequency_Modulation.png

AM and FM are both analog modulations, designed to carry an analog signal (such as audio). We need to make quite a leap to the chirp modulation, which is not an analog but a digital modulation.

Chirp modulation takes the 1s and 0s of the data you want to send, and converts them into a set of chirps. The chirps are sent one after the other on top of a fixed-frequency carrier signal.

Amplitude and frequency of a single chirp symbol. X axis is time, Y axis is amplitude. Credit: https://en.wikipedia.org/wiki/Chirp#/media/File:Linear-chirp.svg

Unfortunately, the chirp modulated signal is too complex to illustrate in a simple diagram. So bear with me, I’ll try to illustrate the LoRa specific case.

Chirp in a LoRa frame

To produce a valid LoRa frame, you need to do more than produce a single chirp. There is a specific way to assemble a series of chirps into a frame that a LoRa radio can demodulate. See the frame illustration below.

Structure of chirps in a LoRa frame

Every blue line in the illustration is a single chirp. As time flows, chirp “sweeps” over a range of frequencies.

In a LoRa frame, there are three groups of chirps. Preamble, sync word, and data. Each group has a different role in a LoRa frame. And each part of the frame is using different type of chirps.

The preamble and sync word are using a simpler up-down chirping to get the “attention” of the receiver. The goal is to make the preamble and sync word easy to detect. They doesn’t need to carry a lot of information. They needs to be noticeable against a noise floor, and easy to demodulate with high accuracy.

The data part is the part that’s actually modulated, where the frequency time profile defines the symbol value.

The frequency time profile of the entire frame and the individual symbols can be shaped in many different ways. If you’re not tired yet, let’s dive into how the chirp modulation is used in LoRa radios.

Using LoRa in the real world

The first thing you notice when you start working with LoRa radios is all the configuration options, like bandwidth, spreading factor, and coding rate. These are the parameters of the modulation. They define how the signal will be generated.

LoRa bandwidth

Bandwidth is the rate at which a signal changes, and defines the theoretical maximum of information that can be communicated per unit of time. The unit of bandwidth is Hertz (Hz).

In theory, you could use any bandwidth with LoRa. In practice, you will always be limited by the available spectrum, spectrum regulations, and physical limits of your transceiver. Because of that, the commonly used bandwidth (channel width) in sub-GHz LoRa is 125 kHz, while most chips can also modulate at 250 kHz and 500 kHz, and lower frequencies too.

In 2.4 GHz, LoRa chips can handle up to 1.625 MHz of bandwidth.

The rule of thumb for bandwidth is

  • The higher the bandwidth, the higher the data rate (chip rate)
  • The lower the bandwidth, the lower the data rate (chip rate)

For final data rate, it is important to consider the two other factors: spreading factor and coding rate.

LoRa spreading factor

A spreading factor defines the ratio between the bandwidth (chip rate) and the data rate (symbol rate). It defines how much a symbol should be spread over time and frequency. Basically, it says how quick or how slow should the chirp sweep be over the selected bandwidth.

The higher the spreading factor, the more spectrum it “eats”, but the easier it is for the other side to decode the signal. That means you can use the spreading factor to increase the range at which a LoRa signal can still be successfully demodulated. No need for a bigger antenna, or a more powerful amplifier. It’s all just configuration.

Eating spectrum means that if your bandwidth is fixed (which is the case in LoRaWAN networks, and most LoRa networks), the higher the spreading factor you use, the lower the data rate (symbol rate) you get. The higher the spreading factor, the longer the Time on Air (ToA) — the longer your transmission will take.

This is where the real power of LoRa is. You can decide, in software, whether you need more range, more bandwidth, or shorter transmissions (lower battery use).

In theory, you could use any spreading factor with LoRa. In practice, you are limited by the available bandwidth and by the demodulator design. The physical microchip size, microchip complexity, and other commercial constraints will define what LoRa modulators and demodulators will be capable of.

While the original LoRa chips had a spreading factor range from SF7 to SF12, modern modulators in modern chips have a range from SF5 to SF12.

If you ever need to compute the exact symbol rate from a defined bandwidth and spread factor, you can use the following formula:

SYMBOL RATE in chips/s = BANDWIDTH in Hz divided by (2 to the power of SPREADING FACTOR)

In simple terms, symbol rate decreases exponentially with increase in spreading factor.

Rule of thumb: Increase spreading factor by one, divide the symbol rate in half.

You can use the following table to check the symbol rates with 125 kHz of bandwidth. Please note that symbol rate is not the same as data rate. Read further to learn how to convert symbol rate to data rate.

| Spreading factor | Bandwidth | Symbol rate             |
| (integer) | (Hz) | (chips/s, rounded down) |
| ---------------- | --------- | ------------------------|
| 5 | 125000 | 3906 |
| 6 | 125000 | 1953 |
| 7 | 125000 | 976 |
| 8 | 125000 | 488 |
| 9 | 125000 | 244 |
| 10 | 125000 | 122 |
| 11 | 125000 | 61 |
| 12 | 125000 | 30 |
| 13 | 125000 | 15 |
| 14 | 125000 | 7 |

Why not go beyond SF12? SF13, SF14? That’s where we’re hitting the bandwidth constraint. At some point, the symbol rate will be so low that with the available bandwidth it will be beyond what’s practically usable.

Spreading factor TL;DR:

  • The higher the spreading factor, the lower the data rate
  • The higher the spreading factor, the longer the range
  • The higher the spreading factor, the slower the transmission will be
  • The lower the spreading factor, the higher the data rate
  • The lower the spreading factor, the shorter the range
  • The lower the spreading factor, the faster the transmission will be

Ultimately, it’s the combination of spreading factor, bandwidth and coding rate that defines the data rate.

LoRa coding rate

There is little talk about the coding rate in the LoRa community or the LoRaWAN standard. That’s likely because the LoRaWAN standard fixes the coding rate to 4/5.

What is a coding rate (code rate)? What do the two numbers stand for? In any digital modulation, a coding rate defines the efficiency of error-correcting codes. Chirp modulation and LoRa is no different.

The ratio stands for the number of information (error-corrected) bits to the total number of bits transmitted. The number of information bits is always lower to the number of total bits.

A coding rate of 4/5 means there are 4 information bits and 5 bits in total per symbol.

If the numbers were equal, there would be no error correcting. That is an option, just not commonly used with LoRa.

Coding rates and error correction codes are a bit of mathematical magic. You add a number of redundant bits to your message, and those bits allow the receiver to use those redundant bits to recover from demodulation errors, as long as the errors are not significant. If the errors are significant or you have too few bits to spare, you might only be able to tell if there was an error or not.

To compute the actual data rate from a symbol rate, multiply the symbol rate by the spreading factor and by the coding rate ratio.

DATA RATE in bits/s = SYMBOL RATE times SPREADING FACTOR times CODING RATE RATIO

With the 125kHz bandwidth, these are the rounded-down data rates you can achieve with 4/5 coding rate.

| Spreading factor | Bandwidth | Symbol rate | Coding rate | Data rate |
| ---------------- | --------- | ----------- | ----------- | --------- |
| (integer) | (Hz) | (chips/s) | (ratio) | (bits/s) |
| 5 | 125000 | 3906 | 4/5 | 15624 |
| 6 | 125000 | 1953 | 4/5 | 9374 |
| 7 | 125000 | 976 | 4/5 | 5465 |
| 8 | 125000 | 488 | 4/5 | 3123 |
| 9 | 125000 | 244 | 4/5 | 1756 |
| 10 | 125000 | 122 | 4/5 | 976 |
| 11 | 125000 | 61 | 4/5 | 536 |
| 12 | 125000 | 30 | 4/5 | 288 |
| 13 | 125000 | 15 | 4/5 | 156 |
| 14 | 125000 | 7 | 4/5 | 78 |

Coding rate TL;DR:

  • The higher the # of redundant bits, the lower the effective data rate
  • The lower the # of redundant bits, the higher the effective data rate
  • The higher the # of redundant bits, the higher the resiliency to errors
  • The lower the # of redundant bits, the lower the resiliency to errors

The specific mathematical details of how many redundancy bits translate into ability to detect or recover from how many errors is beyond the scope of this article. Maybe sometime in the future.

Why is LoRa useful?

Ultimately, all these features are technically interesting, but are they useful in the real world? What problems does it solve?

LoRa is a modulation that is not designed for high bandwidth, and will never be the best choice for it. Don’t expect to transfer a video stream over a sub-GHz LoRa channel.

But it is a great choice for sub-GHz free spectrum if you need to compromise between range and data rate, and want to own the radio path end-to-end. Like Wi-Fi, but much longer range and much lower data rate. Unlike Wi-Fi, you need to pick a MAC layer to run on top of LoRa. It might be LoRaWAN, it might not.

LoRa gives you a wide choice of parameters to adjust the physical layer (radio link) to the specific requirements you have in terms of range, data rate, reliability, and battery usage.

Its flexibility is why LoRa is still around after more than a decade of its inception. Its flexibility also means it is hard to simply “use it” out of the box.

It also gives you a choice in the MAC layer, but I’ll leave that for another time.

--

--

Vit Prajzler

IoT and cybersecurity. Entrepreneur and tech leader connecting people, software, and hardware. Engineer & scientist at heart