LoRa and LoRaWAN
Pervasive IoT deployments demand low-power wide area networking (LPWAN) solutions that can connect hundreds of thousands of sensors and ‘things’ over a large area with minimal infrastructure cost. The low-power solution is needed to ensure that the battery-powered sensors can last for many years with a tiny battery. While Bluetooth is certainly low-powered, it works only for short ranges. Cellular networks are designed for wide area coverage, but they consume too much power which requires large batteries and frequent battery recharging for the end nodes. Consequently, there is a significant momentum in standardizing new networking solutions for LPWAN. New developments are emerging from both cellular and WiFi standard bodies, i.e., from the 3GPP and IEEE/WiFi-alliance, respectively, to fill this gap, but there is a third momentum that is proving very successful. It is called LoRa Alliance (LoRa stands for long range), which is a industry alliance committed to accelerate the development and deployment of LPWAN networks. In this chapter, we shall study the details of the LoRa technology.
LoRa is a proprietary and patented PHY technology originally developed by a small company called Cycleo in France [SEMTECH-BLOG]. Later it was acquired by Semtech corporation, which formed the LoRa Alliance [LORA-ALLIANCE]. Now LoRa Alliance has 500+ members. The first version was LoRa was released to public in July 2015. Since then it enjoyed rapid adoption with many different types of products selling fast. For long range IoT, this is at the moment the major choice in the market currently implemented in over 100 million devices.
Copyright By cscodehelp代写 加微信 cscodehelp
The main advantage of LoRa is the support for extremely long-range connectivity. It supports communications up to five kilometers in urban areas depending on how deep within indoor the sensors are located, and up to 15 kilometers or more in rural areas with line of sight [LORA-SEMTECH]. Such long distances are supported with extremely low power and low cost. These advantages are gained by trading off the data rate. LoRa supports very low rates, on the order of only a few kbps. However, these rates are sufficient for the targeted IoT applications which only need to upload a small message once in a while.
11.2 LoRa frequencies
Like 802.11ah, LoRa also uses sub-GHz ISM license-exempt bands to reach long distances at low power. Different regions have different restrictions on the use of LoRa frequencies. The following bands are specified in LoRa developers guide from SEMTECH [LORA-SEMTECH]:
© 2022 [Wireless and Mobile Networking, CRC Press 2022] 1
• 915 MHz MHz in US. Power limit. No duty cycle limit.
• 868/433 MHz in Europe. 1% and 10% duty cycle limit
• 430 MHz in Asia
Note that there is a power limit in the US, but no duty cycle. It means devices can be awake all the time and transmit as often as they like. However, in Europe, devices have to implement 10% duty cycle, which means they can be up only 10% of the time on average. Limiting the duty cycle enables more devices to be connected to the LoRa network with minimum infrastructure at the expense of slightly higher latency.
LoRa uses channels with significantly smaller bandwidth compared to Bluetooth, WiFi, or cellular networks. Specifically, LoRa channels are either 125kHz or 500kHz wide [LORA-SEMTECH]. For example, in the US, 125kHz channels can be used only for the uplink (end device to gateway) whereas 500kHz can be used for both uplink and downlink.
11.3 LoRa modulation: chirp spread spectrum
Supporting long range communication with low power is challenging because the receiver will be required to demodulate a signal that can be very weak and even below the noise floor, i.e., demodulation with negative signal-to-noise ratio (SNR) would be required. To achieve this objective, LoRa adopts a specific form of chirp spread spectrum that spreads the signal power to all frequencies over the entire channel bandwidth by continuously increasing or decreasing the frequency during the symbol transmission. This which allows the receiver to combine samples from many frequencies to reconstruct the signal despite low signal power. The chirp phenomenon with linear frequency increasing or decreasing rates is illustrated in Figure 11.1.
Figure 11.1 Frequency domain representation of a linearly increasing chirp symbol. The power is spread over the entire channel bandwidth and the received signal power is below the noise floor.
Chirps with increasing frequency are called up-chirps and the ones with decreasing frequency are called down-chirps. In time-frequency graphs, these up-chirps and down-chirps are shown as straight lines with positive and negative slopes, respectively, as shown in Figure 11.2.
© 2022 [Wireless and Mobile Networking, CRC Press 2022] 2
Frequency fmax fmax
fmin fmin Sweep Duration Time
Sweep Duration Time
Figure 11.2 Up-chirps and down-chirps.
As we can see in Figure 11.2, the chirps sweep the entire bandwidth, from the minimum frequency to the maximum frequency, within a specified chirp sweep duration. The sweeping speed, k, is thus obtained as:
𝑘 = 𝐵 𝐻𝑧/𝑠𝑒𝑐 (11.1)
Where B is the bandwidth in Hz and TS is the chirp sweeping duration in second.
So, how does LoRa encode information with chirps? Clearly, these chirps need to be modulated in some ways to convey data. In LoRa, data bits are encoded with either up-chirps or down-chirps depending on the direction of communication, i.e., uplink vs. downlink. Each chirp represents one symbol, which means that the symbol duration is equivalent to the chirp duration, TS.
LoRa shifts the starting frequency of the chirp to produce different symbol patterns [LORA-SYMBOL]. The amount of frequency shift is then used to code the symbol, which represents the data bits carried by that symbol. Figure 11.3 illustrates an example of 4-ary modulation that uses 4 possible frequency shifts, including zero shift, to create 4 different symbol patterns. Note that for the non-zero shifts, the chirp is `broken’ into two pieces because it reaches the maximum (for upchirp) or minimum (for downchirp) frequency sooner than the symbol duration. The second piece of the chirp then starts from the minimum (for upchirp) or maximum (for downchirp) frequency and continues the frequency sweep until the end of the symbol duration.
A LoRa transmitter configured with SF=8 can send how many bits per symbol? Solution:
8 bits. SF=8 means there are 28 different symbol patterns, thus each symbol can be coded with an 8-bit pattern.
© 2022 [Wireless and Mobile Networking, CRC Press 2022] 3
A striking difference between LoRa and the conventional wireless networks is that the symbol duration in LoRa is not fixed but is a function of the modulation order. The larger the modulation order, the longer the symbol duration, and vice versa. Both the modulation order and the symbol duration are controlled by the parameter called, spreading factor (SF). For M-ary modulation, SF=log2(M) and Ts=2SF/B seconds, where B is in Hz. This means that by increasing SF by 1 would not only double the modulation order (increase bits per symbol by 1), but also double the symbol duration. The relationship between SF, modulation order, and the symbol duration is illustrated in Figure 11.4 for upchirps.
A LoRa transmitter configured with SF=10 would take how long to transmit one symbol over a 125kHz channel?
Ts = 2SF/B = 210/125 ms = 8.192 ms
LoRa increases the symbol duration to increase the communication range, as longer symbols help decode the signal at the receiver despite weak receptions. Hence SF is adaptively adjusted based on the received signal strength. By choosing to exponentially increase both the modulation order and the symbol duration, LoRa seeks to achieve orthogonality between signals of different SF. Thus, two signals from two transmitters would not interfere or collide at the receiver even if they are transmitted on the same channel at the same time if they use different SFs [LORA- SEMTECH].
00 01 10 11
00 01 10 11
Figure 11.3 LoRa symbol patterns for 4-ary modulation.
© 2022 [Wireless and Mobile Networking, CRC Press 2022] 4
A major consequence of exponentially increasing the symbol duration with increase in SF is that the symbol rate, i.e., the number of symbols per second, is reduced exponentially as well. This means that instead of increasing the data rate with increasing modulation order, the data rate is actually reduced with increasing SF. This can be clearly seen in the following universal equation that derives data rate as a function of the modulation rate (bits per symbol), symbol rate, and the coding rate (CR) that reflects the forward error correction (FEC) overhead:
𝐷𝑎𝑡𝑎 𝑟𝑎𝑡𝑒 = 𝑏𝑖𝑡𝑠 𝑝𝑒𝑟 𝑠𝑦𝑚𝑏𝑜𝑙 𝑥 𝑠𝑦𝑚𝑏𝑜𝑙 𝑟𝑎𝑡𝑒 𝑥 𝑐𝑜𝑑𝑖𝑛𝑔 𝑟𝑎𝑡𝑒
= 𝑆𝐹𝑥 𝐵 𝑥𝐶𝑅𝑏𝑝𝑠. (11.2) 2″#
Where B is in Hz and CR is the FEC ratio between actual data bits and the total encoded bits. In LoRa, CR can technically take values from 4/5, 4/6, 4/7, and 4/8, although the default value of 4/5 is often used. As can be seen from Eq. (11.2), data rate would be reduced nearly exponentially by increasing the SF. Thus, SF is the main control knob used by LoRa to trade-off between data rate and range. A total of six spreading factors, SF=7 to SF=12, are supported by LoRa [LORA-SEMTECH].
A LoRa sensor is allocated a 125kHz uplink channel. What would be its effective data rate if it is forced to use a spreading factor of 10 and 50% redundancy for forward error correction?
SF=10; 2SF=1024; CR=0.5
Symbol rate = B/2SF sym/s = 125,000/1024 sym/s Effective data rate = 10 x 125000/1024 x 0.5 = ~610 bps
© 2022 [Wireless and Mobile Networking, CRC Press 2022] 5
2SF/B = 32μs
2SF/B = 64μs
Figure 11.4 Relationship between SF, modulation order, and symbol duration.
Energy is another important parameter affected by the choice of SF. For a given message, the total energy consumed is proportional to the airtime of the message, i.e., the amount of time the LoRa module needs to be active and consume power. The higher the data rate, the shorter is the airtime, and vice-versa. Thus, shorter SF would reduce the energy consumption, and vice versa. That is why LoRa implements adaptive data rate (ADR), which tries to select the minimum possible SF. For example, devices closer to the gateway would be using shorter SF (due to good quality link) and enjoy longer battery life compared to the ones located further from the gateway.
11.4 LoRa networking with LoRaWAN
LoRa actually refers to only the PHY layer of the LoRa network protocol stack as shown in Figure 11.5. The PHY is available for all frequency bands available in different regions of the world. The MAC layer is called LoRaWAN, which is an open standard. The MAC supports connecting LoRa end devices to the LoRa gateways, which in turn are connected to the network servers in the backbone. The end-to-end LoRa network system is illustrated in Figure 11.6.
Figure 11.5 LoRa network protocol stack
868/433 (EU) 915 (US) 430 (AS)
Class A (basic) Class B (beacon) Class C (continuous)
© 2022 [Wireless and Mobile Networking, CRC Press 2022] 6
The gateways are like the base stations in cellular networks. Many gateways are controlled by a central network server. However, unlike cellular networks, LoRa end devices do not associate with a single gateway; instead all gateways within range receive and process the messages transmitted by all end devices. The gateways work only at the PHY layer. They only check data integrity if CRC is present. The message is dropped if CRC is incorrect. They pass the LoRa message to the network server only if the CRC is correct along with some metadata such as received signal strength (RSSI) and timestamp. The network server actually runs the MAC and makes all networking decisions. It assigns each device a frequency, spreading code, eliminates duplicate receptions, and schedules acknowledgements. If requested by the end device, the network server also implements the adaptive data rate (ADR) for that device by dynamically controlling its transmitters parameters such as its SF, bandwidth, and transmit power.
LoRa supports scalable and flexible deployment of networks by provisioning for cost- optimized gateways. For small networks, very simple gateways made from can be used with limited number of channels. For carrier-grade networks run by city municipalities, more heavy-duty gateways with large number of channels (up to 64 channels in the US) can be used, which can be deployed on the rooftop of high-rise buildings, cellular towers, etc.
LoRa supports bidirectional communications. This allows the sensors (LoRa end devices) to upload data to the server and the server to send acknowledgements or update software/firmware on the sensors. Gateways listen to multiple transmissions on multiple channel and all gateway listen to all transmissions, which provides antenna diversity and improved reliability for the simple aloha protocol. For example, if one gateway could not receive it because of collision, another gateway may receive it and forward it to the server. The server selects one gateway for the downlink ACK to the device.
Figure 11.6 End-to-end LoRa network system [LORA-SEMTECH].
LoRa frame format is shown in Figure 11.7 [HAX2017]. The preamble, which uses a series of upchirps followed by a few downchirps, is used to synchronize the
Network Server Application Server
End devices (sensors/actuators) Gateways
© 2022 [Wireless and Mobile Networking, CRC Press 2022] 7
transmitter and receiver clocks. An optional header is used before the payload to automate the configuration of several important parameters, namely the payload length, coding rate, and the use of CRC. When the header is not used (to save transmission energy), these parameters must be configured manually before the start of the session. Finally, the payload is optionally followed by a CRC field to detect errors in the payload.
Figure 11.7 Lora packet format.
Application servers are ultimately responsible for processing and interpreting the received LoRa payload data. They also generate the appropriate payload for the downlink messages.
Join servers are used to facilitate over-the-air activation of LoRa end devices. A join server contains the necessary to process an uplink join-request message from an end device and a downlink join-accept message. It also informs the network server about the application server a particular end-device should be connected to. Thus, with join servers in place, users can connect their LoRa sensors and actuators by simply turning them on.
11.5 LoRa device classes
LoRaWAN supports three classes of devices, A, B, and C [LORA-SEMTECH. Class A is the most basic mode of operation, which must be supported by any device. Class B devices must also support Class A option. Finally, Class C devices must have the option to operate in either of the three classes. Let us have a look at the operational features of each of these classes.
Class A: These are the lowest power and lowest traffic LoRa devices mostly sleeping and waking up once in a while to transmit data if a monitoring event is detected. For each uplink (end device to gateway) transmission, the device will be allowed to receive up to two 2 short downlink (gateway to end device) transmissions. One may be for ACK, but another can be used for other kind of information, such as an actuation signal triggered by the application based on the uplink information. Example of these devices include various environmental sensors and monitors with limited actuation capabilities.
The device cannot receive anything else until it transmits again. When it does, again it gets two credits for downlink communication. This cycle repeats. Class A devices are very simple and they use Pure Aloha for channel access, which is basically contention-based. Pure Aloha performs well under light traffic, but will struggle under heavy load. Its performance under sustained heavy load approaches 1/2e or approximately 18.4%.
© 2022 [Wireless and Mobile Networking, CRC Press 2022] 8
Class B: This is basically Class A plus extra receive window at scheduled time following the periodic beacons from Gateway. That is the beacon contains reserved slots for the stations. This class is for stations which need to receive more frequent traffic from the network or server. All gateways transmit beacons every 2n seconds (n=0..7), which provides plenty of opportunity for the network to synchronize with Class B end devices. All gateways are synchronized using GPS so they all can align to the exact beacon timing.
Class C: These are the most powerful stations typically connected to mains power and almost always awake. They can receive anytime, unless transmitting. As such, the server enjoys the lowest latency in reaching a Class C device compared to the other classes. Class C devices include things such as streetlights, electrical meters, etc., which can be constantly monitored and controlled by a server. Figure 11.8 illustrates and compares the operations of the three classes.
Random Fixed Fixed
Tx Rx Rx ClassA
Beacon Beacon Interval Interval
Tx Rx Tx Rx Tx ClassC Transmit at random intervals
Figure 11.8 Operations of Class A vs. Class B vs. Class C.
11.6 Chapter Summary
The main aspects of LoRa can be summarized as follows:
1. LoRa is designed to work with narrow bandwidth channels, long symbols, and low data rates; data rate is sacrificed for longer range.
2. LoRa modulation is a variation of chirp spread spectrum where the modulation order as well as the frequency sweeping speed of the chirp is modulated by an integer variable called spreading factor (SF).
3. For a given bandwidth B Hz and spreading factor SF, modulation order = 2SF and symbol duration = 2SF/B sec. As a result, contrary to typical wireless communications, increasing the modulation order actually decreases the data rate in LoRa.
4. For a given bandwidth, the larger the SF, the longer the symbol duration and longer the range at the expense of reduced data rates.
5. Orthogonality of the SF enables transmission of multiple LoRa chirps at the same frequency channel and at the same time slot.
© 2022 [Wireless and Mobile Networking, CRC Press 2022] 9
6. There are 6 valid SF values in LoRa: 7 to 12.
7. LoRa data contains either all upchirps or all downchirps depending on the
direction of communication (uplink vs. downlink); upchirps and downchirps
are never mixed within the same LoRa packet except for the preamble field.
8. LoRa end devices broadcast to all gateways within range. The gateway with
the best connectivity replies back.
9. LoRa gateways are only PHY-layer devices; all MAC processing is done at
the network server.
10. LoRa supports 3 classes of devices. Class A devices can sleep most of the time
to conserve energy but allow most restricted access from the network. Class B devices can be accessed more frequently by the network at the expense of higher energy consumption. Class C devices are usually powered by the mains; they never sleep and hence can be reached by the network at any time without delay.
[LORA-SEMTECH] “LoRa and LoRaWAN: A Technical Overview
程序代写 CS代考 加微信: cscodehelp QQ: 2235208643 Email: email@example.com