$ curl tarnowski.io/lora

LoRa

LoRa (from "Long Range") is physical radio protocol for Low-Power Wide-Area Networks (LPWANs) utilizing Chirp Spread Spectrum (CSS) modulation. The MAC layer protocol, known as LoRaWAN, operates on top of the LoRaPHY. Signal can be transmitted over long distances and to be received even when it is below the noise floor.

Chirp Spread Spectrum

In Chirp Spread Spectrum (CSS) data is encoded using chirps - the sinusoids with variable frequency. The signals sweep across the radio band, creating diagonal stripes on the spectrogram. Information is stored in the initial phase (cyclic shift) of the chirp.

There are two posible types of symbols, up-chirp or down-chirp, identified by the direction of the frequency sweep. A single frame, apart from a few symbols in the preamble, consists of one type. Symbol direction may be used to differentiate between uplink and downlink messages.

All symbols of frame are of identical (configurable) length, except for the last symbol in the preamble, which is shortened to 1/4.

Configurable Communication Parameters

The LoRa physical layer's performance and energy consumption can be tuned by configuring several transmission parameters. The primary configurable parameters are Carrier Frequency, Bandwidth, Spreading Factor, Coding Rate, and Transmit Power.

Carrier Frequency

The Carrier Frequency (CF) is the center frequency for the transmission. LoRa transceivers can operate on a wide range of frequencies, typically in the sub-gigahertz bands (eg. 433 MHz or 868 MHz). All communicating devices must be configured to the same carrier frequency.

Bandwidth

Bandwidth (BW) defines the range of frequencies over which the chirp signal is spread. LoRa supports multiple bandwidth settings, commonly 125 kHz, 250 kHz, and 500 kHz. A wider bandwidth corresponds to a higher data rate and shorter time on air, but it also reduces receiver sensitivity due to integrating more noise. Conversely, a narrower bandwidth improves sensitivity and range at the cost of a lower data rate. The chip rate is equal to the bandwidth; for example, a 125 kHz bandwidth results in a chip rate of 125 kcps.

Spreading Factor

Spreading Factor (SF) determines the number of bits encoded per symbol. It ranges from SF7 to SF12. Some chips also support SF5 and SF6. Each symbol can encode SF bits of information.

A higher SF prolongs symbol duration (extending the signal's time on air), which increases the robustness to noise and improves receiver sensitivity, thus extending the communication range. This, however, decreases the data rate. Each step increase in the spreading factor halves the data rate.

To demodulate, the receiver multiplies the incoming signal with a base chirp and performs an FFT. The resulting frequency peak identifies the original cyclic shift, thereby decoding the symbol.

Coding Rate

The Coding Rate (CR) specifies the degree of forward error correction (FEC) applied to the data payload. It is expressed as a ratio 4/(4+n), where n can be 1, 2, 3, or 4, resulting in coding rates of 4/5, 4/6, 4/7, or 4/8. This ratio indicates that for every 4 useful bits of information, n redundant bits are added for error correction.

A higher coding rate (e.g., 4/8) provides more protection against bursts of interference but increases the amount of data to be transmitted, thus extending the time on air. This makes the link more reliable but decreases the effective data rate. If devices use an explicit header, they can communicate even with different coding rates for the payload, as the header specifies the payload's CR and is always encoded at a fixed rate (CR 4/8).

Transmit Power

Transmit Power (TP), the output power of the amplifier, is typically configurable in discrete steps. Higher TP increases the signal strength at the receiver, improving the link budget and range. However, this comes at the cost of increased energy consumption.