LoRa for IoT

hen it comes to Internet of Things, connectivity to the internet is the primary area of focus.  The sensors on the IoT devices, wearables and electronic devices need to get connected easily – preferably wirelessly. IoT LPWA market is expected to grow at an annual rate of 90 percent. It is expected that in 2021 the market size of about EUR 24.5 billion. SigFox and LoRa have been competitors in the LPWAN space for several years.

I earlier wrote about Sigfox LPWA system.  It was pretty simple story. Now it is time to take a look at the competing technology LoRa. It is a more complicated, and maybe more interesting story.

LoRaWAN tries to bridges the gap between WLAN and cellular networks while allowing low power operations (sensors can work years with batteries). LoRaWAN is a Low Power Wide Area Network (LPWAN) and allows for Internet of Things connectivity making way for secure bidirectional communication. LoRa offers good bidirectionality because of the symmetric link.

LoRAWAN and LoRa radio

LoRa system consists of two parts: LoRaWAN media access control and LoRa physical layer technology.

LoRaWAN is a media access control (MAC) layer protocol designed for large-scale public networks with a single operator. It is built using Semtech’s LoRa modulation scheme. LoRaWAN as a protocol is strictly for wide-area networks.

LoRa as a lower-level physical layer technology (PHY) can be used in all sorts of applications outside of wide area. No, you do not need a gateway for applications that don’t need to connect to Internet. You can easily implement simple protocols using LoRa, either with modules or with the chips themselves.

There are two options to use this type of radio technology: LoRa and LoRaWAN

  • LoRa contains only the link layer protocol and is perfect to be used in P2P communications between nodes in the 868 and 900MHz bands. LoRa modules are a little cheaper that the LoRaWAN ones.  For details Go to the LoRa Tutorial.
  • LoRaWAN includes the network layer too so it is possible to send the information to any Base Station already connected to a Cloud platform. LoRaWAN modules may work in the 868/900/433MHz bands. For more details Go to the LoRaWAN Tutorial.

Nice thing about LoRa’s open standard is its potential to be very flexible; it’s not going to be driven by a specific company. The LoRa Alliance strategy is that the specification that governs how the network is managed is relatively open. You can download the specifications and join the LoRa Alliance, and any hardware or gateway manufacturer can build a module or gateway that conforms with the LoRa specifications. While the ecosystem itself is open, it does have a closed element: currently the only company that makes the radio for LoRa is Semtech. (They’ve announced licensing to other silicon manufacturers in the future).

If you need command-and-control functionality—for, say, electric grid monitoring—LoRa is your best option. It has true bidirectionality because of the symmetric link.

LoRa radio details

LoRa communications systems for IoT consists of LoRa (a chirped modulation format) and LoRaWAN (a MAC-layer protocol) . LoRa is a spread-spectrum technology that uses quite wide band (usually 125 kHz or more). Its frequency-modulated chirp utilizes coding gain for increased receiver sensitivity.

The great performance of LoRa in 3 features (good sensitivity, low path loss, good obstacle penetration) makes LoRa a disruptive technology enabling really long range links. Because LoRa receiver looks at quite wide amount of spectrum (so receiver gets much more noise than narrowband systems like SigFox), it needs to elevate noise due to a larger receiver bandwidth is mitigated by the coding gains. Practical link budgets are about the same for SigFox and LoRaWAN. For example Semtech SX1272 LoRa transceiver IC promises 157 dB maximum link budget. With more realistic sensitivity of -134 dBm and +14 dBm we get 148 dB link budget, that should be able to provide more than 22km (13.6 miles) in LOS links and up to 2km (1.2miles) in NLOS links in urban environment (going through buildings).

LoRa is a unique modulation format that can be generated by Semtech LoRa parts, including the SX1272 and SX1276 transceiver chips. It’s a really inexpensive, efficient way to get processing gain in a small chip-scale transceiver. LoRa is a spread spectrum technology, but it is not a direct sequence spread spectrum technology. LoRa uses an unmodulated carrier in an FM chirp, which has similarities to M-ary FSK. Other notable LoRa’s features are long preambles and variable bit rates.

LoRaWAN data rates range from 0.3 kbps to 50 kbps (some chips can offer bit rate up to 300 kbps). To maximize both battery life of the end-devices and overall network capacity, the LoRaWAN network server is managing the data rate and RF output for each end-device individually by means of an adaptive data rate (ADR) scheme.

You can transmit and receive the LoRa modulation at many frequencies between 150 MHz and 1 GHz. The Semtech basestation architecture is designed to operate only at 850 MHz to 1 GHz. Most typically LoRa is used in 868 MHz (Europe) and 915 MHz (USA) unlicensed frequency bands. LoRaWAN modules may work in the 868/900/433MHz bands.

In radio communications at license free there are limits on transmitter duty cycles. In Europe, 863 to 870  MHz band has been allocated for license-free operation with transmission duty cycle of 0.1%, 1% or 10% (or other control means like LBT and AFA). At 868 MHz the duty cycle is 1%. For other regions, quite similar limitations apply.

There are also other recommendations, for example TTN Fair Access Policy limits the data each end-device can send, by allowing:  An average of 30 seconds uplink time on air, per day, per device. At most 10 downlink messages per day. A good goal is to keep the application payload under 12 bytes, and the interval between messages at least several minutes (application packet size can vary between 51 bytes for the slowest data rate, and 222 bytes for faster rates).

LoRa has so far relied on unlicensed spectrum to provide connectivity for sensors used in smart meters, asset-tracking devices and other “Internet of Things” (IoT) networks, but it is also heading to licensed frequencies as well?. Mobile operators that have made investments in LoRa networks are now looking at using licensed spectrum to support the technology. Running the technology over licensed spectrum could help operators overcome one of the main drawbacks of the technology — the interference and congestion that can occur in unlicensed airwaves.“The only benefit carriers have is that they can guarantee quality of service because it’s a licensed band,” said the mystery mouthpiece.  Going to other than ISM bands should not be a big problem, because for example The SX1272 LoRa transceiver covers a frequency range of 860 to 1,020 MHz and SX1276 transceiver spans a frequency range from 137 to 1,020 MHz.

LoRaWAN details

LoRaWAN includes the network layer too so it is possible to send the information to any Base Station already connected to a Cloud platform. LoRaWAN was designed for the centralized architecture of telecom operators.

LoRaWAN network architecture is typically laid out in a star-of-stars topology in which gateways is a transparent bridge relaying messages between end-devices and a central network server in the backend. Gateways are connected to the network server via standard IP connections while end-devices use single-hop wireless communication to one or many gateways. All end-point communication is generally bi-directional, but also supports operation such as multicast enabling software upgrade over the air or other mass distribution messages to reduce the on air communication time. For some more details, read Go to the LoRaWAN Tutorial.

In LoRa system both the endpoint and the basestation are relatively inexpensive. This is primarily because you can use the same radio for a receiver on the basestation and at the endpoint. Typically LoRaWAN basestation tends to be more expensive than the endpoint.

Advantages and disadvantages of LoRaWAN

Following are the advantages of LoRaWAN:
➨It uses 868 MHz/ 915 MHz ISM bands which is available world wide.
➨It has very wide coverage range about 5 km in urban areas and 15 km in suburban areas.
➨It consumes very little power and hence battery will last for long duration.
➨Single LoRa Gateway device is designed to take care of 1000s of end devices or nodes.
➨It is easy to deploy due to its simple architecture
➨It uses Adaptive Data Rate technique to vary output data rate/Rf output of end devices. The data rate can be varied from 0.3 kbps to 27 Kbps for 125 KHz bandwidth.
➨The physical layer uses robust CSS modulation (Chirp Spread Spectrum). It uses 6 SF (spreading factors) from SF 7 to 12. This delivers orthogonal transmissions at different data rates. Moreover it provides processing gain. LoRa modulation has constant envelope modulation similar to FSK modulation (easy for PA design)
➨LoRaWAN supports three different types of devices viz. class-A, class-B and class-C.

Following are the disadvantages of LoRaWAN:
➨It can be used for applications requiring low data rate i.e. upto about 27 Kbps.
➨LoRaWAN network size is limited based on parameter called as duty cycle. This parameter arises from the regulation as key limiting factor for traffic served in the LoRaWAN network.
➨It is not ideal candidate to be used for real time applications requiring lower latency and bounded jitter requirements.

Security is important. National wide networks targeting internet of things such as critical infrastructure, confidential personal data or critical functions for the society has a special need for secure communication. This has been solved in LoRaWAN system by several layer of encryption as detailed in this picture from LoRa Alliance.

 

The security model uses several keys: Unique Network key (EUI64) and ensure security on network level, Unique Application key (EUI64) ensure end to end security on application level and Device specific key (EUI128). Some discussion on LoRaWAN security can be found at Security of an IoT network using AES (LoRaWAN) web page:MIC (Message Integrity Code) for each message and the end-to-end (application to application) ciphering of the payload both use AES 128 bits key.

Pictures of some LoRa products

Here is LoRa dev board by Espotel.

Here is Jaakko Ala-Paavola from Espotel showing LoRa demo that uses their LoRa dev board and commercial LoRa gateway (also uses Node-RED to implement control logic).

 

The Things Network

The Things Network is a global, crowdsourced, open, free and decentralized internet of things networkThe Things Network (TTN) comprises a number of internet connected LoRaWAN gateways deployed by enthusiastic supporters in a growing number of areas around the world.

Because the costs of LoRa technology are very low, the idea is that we do not have to rely on large telco corporations to build such a network. For example  the city of Amsterdam was covered with only 10 gateways at the cost of 1200 dollars each – a single Gateway can serve thousands of devices. If you don’t already have local coverage, then you can deploy your own gateway and connect it to TTN. While gateways are expensive at around $500 each, many local funding opportunities exist.

Although the goal of The Things Network is to support for any protocol that can be useful for the community, the focus is currently on LoRaWAN. LoRaWAN is perfect for the Internet of Things as it is low battery, long range, and low bandwidth.

The Things Network is about enabling low power Devices to use long range Gateways to connect to an open-source, decentralized Network to exchange data with Applications and Platforms.

Gateways form the bridge between devices and The Things Network. Devices use low power networks like LoRaWAN to connect to the Gateway, while the Gateway uses high bandwidth networks like WiFi, Ethernet or Cellular to connect to The Things Network. All Gateways within reach of a device will receive its messages and forward them to The Things Network.

The network will deduplicate the messages. The Backend handles the received data.The aim is make the different backend components as decoupled as possible, so there is a clear separation of the responsibilities of each component. The Things Network’s different routing service components:
Gateway, Router, Broker, NetworkServer, Handler and Application

LoRaWAN is a “network-intensive” protocol, intensive in the sense that due to the simple and minimalistic approach for devices, the backend systems are responsible for most of the logic. Firstly, there are some Gateway-related functions such as scheduling and managing the utilization of the gateways. Scheduling is needed because a gateway can only do one transmission at the same time. The utilization information is used to evenly distribute load over different gateways and to be compliant with the European duty cycles. Another important feature is monitoring the status of each gateway. We also need device-related functions that manage the state of devices in the network: Addressing is such that device address are non-unique, so the network has to keep track of which addresses are used by which devices in order to map a message to the correct device and application). Other things the network must keep track of are the security keys and frame counters. The Handlers need to know how to interpret binary data, and bridge to higher-layer protocols, such as AMQP and MQTT. As The Things Network will be a distributed network, there has to be functionality that supports this distribution.

The default Handler implementation simply publishes a JSON representation of uplink messages to a topic <app_eui>/devices/<dev_eui>/up on an MQTT broker. This allows applications to simply subscribe to the same MQTT topic and process the data in any way.

EXAMPLE: From the following message, the application could for example see that the temperature measured by device 001122334455667788 was 12.86 degrees:

Topic: 0102030405060708/devices/001122334455667788/up

{ payload: 'BQY=',
  fields:{temperature: 12.86 },
  port: 14,
  counter: 1234,
  metadata:
  [ { frequency: 868.1,
      datarate: 'SF7BW125',
      codingrate: '4/5',
      ...
      longitude: 6.55738,
      latitude: 53.18977 } ] }

The public community network will probably stick with this API and format, but this behaviour can be easily adapted to other use cases.  After publishing the uplink message to MQTT, the Handler will determine whether it is necessary to reply to the device with a downlink message.

In an open network with many different end-devices (nodes), which are not connected but just start sending when they need to (ALOHA-like protocol), and all have a different data need and connection quality, there are many limiting factors to keep things working.

The data rate and maximum packet size roughly depend on the distance to the nearest gateway and the type of data to be sent. For the European 863-870MHz band, the application packet size varies between 51 bytes for the slowest data rate, and 222 bytes for faster rates  (LoRaWAN protocol adds at least 13 bytes to the application payload). When an end-device is far away from a gateway, it needs to use a low data rate to ensure at least one gateway receives its data. But a lower data rate implies a longer air time for each byte. For the European EU 863-870MHz ISM Band limits the duty cycle to 1% for data. For other regions, quite similar limitations apply. For 1000 nodes per gateway and dutu cycle limitations, we end up approximately 30 seconds per node per day. With this Fair Access Policy for 10 bytes of payload, this translates in (approx.): 20 messages per day at SF12 or 500 messages per day at SF7.

By default, gateways transmit with maximum allowed TX power (14 for EU-868). Every device has the same transmit duty cycle, gateways are no exception, so gateway must have less than 1% transmit duty cycle.

 APIs

IoT device end: Semtech SX1272 LoRa transceiver IC provides SPI interface to communicate with it. RN2483LoRa module from Microchip connects over a serial interface.

The Things Network backend:  The default Handler implementation simply publishes a JSON representation of uplink messages to a topic <app_eui>/devices/<dev_eui>/up on an MQTT broker. This allows applications to simply subscribe to the same MQTT topic and process the data in any way.

 

371 Comments

  1. Tomi Engdahl says:

    Amazon Sidewalk Welcomes First LoRa-Based Devices
    May 10, 2023
    The latest devices outfitted with Semtech’s LoRa technology are designed to exploit Amazon’s Sidewalk IoT network.
    https://www.mwrf.com/technologies/embedded/systems/media-gallery/21265641/microwaves-rf-amazon-sidewalk-welcomes-first-lorabased-devices

    Reply
  2. Tomi Engdahl says:

    Rezodo: Long Range irrigation and weather station
    https://hackaday.io/project/190577-rezodo-long-range-irrigation-and-weather-station

    Rezodo aims at building a distributed irrigation system and a weather station with farmers. It’s also a fully open platform for IoT learning

    Reply
  3. Tomi Engdahl says:

    Amazon Sidewalk Welcomes First LoRa-Based Devices
    May 10, 2023
    The latest devices outfitted with Semtech’s LoRa technology are designed to exploit Amazon’s Sidewalk IoT network.
    https://www.mwrf.com/technologies/embedded/systems/media-gallery/21265641/microwaves-rf-amazon-sidewalk-welcomes-first-lorabased-devices?utm_source=RF+MWRF+Today&utm_medium=email&utm_campaign=CPS230512068&o_eid=7211D2691390C9R&rdx.identpull=omeda|7211D2691390C9R&oly_enc_id=7211D2691390C9R

    Reply
  4. Tomi Engdahl says:

    SenseCAP Indicator D1Pro Review – An ESP32-S3 & RP2040 IoT devkit with a 4-inch display, LoRa connectivity, sensors
    https://www.cnx-software.com/2023/05/27/sensecap-indicator-d1pro-review-an-esp32-s3-rp2040-iot-devkit-with-a-4-inch-display-lora-connectivity-sensors/

    Reply
  5. Tomi Engdahl says:

    oRa-powered solar PV monitoring system
    LoRa-powered solar PV monitoring system with Blues &Qubitro
    https://hackaday.io/project/191600-lora-powered-solar-pv-monitoring-system

    Reply
  6. Tomi Engdahl says:

    LoRa, the Long Range wireless protocol is pretty great for trickling data across long distances. There are some great embedded devices based around STM32, NRF52, and ESP32 microcontrollers. What’s been missing for quite a while is a device that allows for full access to a LoRa radio from a more capable CPU. The wait may be over, as there’s now the LoShark……

    HACKADAY PRIZE 2023: LOSHARK, THE RADIO DEBUGGER FOR LORA
    https://hackaday.com/2023/08/06/hackaday-prize-2023-loshark-the-radio-debugger-for-lora/?fbclid=IwAR2hMgyQ3nMmN604ZykWlkqOQJf2Zt27KBDA5PVmGtKlDvhdrc2EDqxOLB4

    LoRa, the Long Range wireless protocol is pretty great for trickling data across long distances. There are some great embedded devices based around STM32, NRF52, and ESP32 microcontrollers. What’s been missing for quite a while is a device that allows for full access to a LoRa radio from a more capable CPU. The wait may be over, as there’s now the LoShark. It’s a USB key form factor, with a MIPS processor running a real Linux kernel.

    The team at SudoMaker is working on their Resonance runtime, which allows interacting with the onboard sx126x radio chip using JavaScript code. That chip can both send and receive, so this device should be capable of more than just capturing traffic. And if JavaScript isn’t your thing, the Linux system on the device means you can knock yourself out with C or C++ code.

    If this gets you excited, it’s already available for order for a reasonable $59.99. The LoShark ships in 433, 868, and 915 megahertz versions.

    https://shop.sudomaker.com/products/loshark-l1?variant=42491298611395

    Reply
  7. Tomi Engdahl says:

    LoShark
    The Ultra-Compact Powerhouse for LoRa Debugging and Connectivity
    https://hackaday.io/project/192129-loshark

    Reply
  8. Tomi Engdahl says:

    Lora/LoraWan IoT Device
    8km long range data transmission device. Supports reading sensor standards such as I2C, RS485, Analog.
    https://hackaday.io/project/192905-loralorawan-iot-device

    Reply
  9. Tomi Engdahl says:

    LoLRa is a DIY LoRa transmitter built using low-cost microcontrollers to achieve long-range communication without specialized radio chips.

    LoLRa Killed the Radio Chip
    https://www.hackster.io/news/lolra-killed-the-radio-chip-fb1e31961596?fbclid=IwAR1ZsnXP4hTqQwSrS6sS3SEx4QLyoMxtg2J_ZDrZUF18QT3cMcBQtbSmctA

    LoLRa is a DIY LoRa transmitter built using low-cost microcontrollers to achieve long-range communication without specialized radio chips.

    Reply
  10. Tomi Engdahl says:

    https://www.hackster.io/news/lolra-killed-the-radio-chip-fb1e31961596?fbclid=IwAR1ZsnXP4hTqQwSrS6sS3SEx4QLyoMxtg2J_ZDrZUF18QT3cMcBQtbSmctA

    LoRa, short for Long Range, is a low-power wide-area network technology designed for long-range communication between Internet of Things (IoT) devices. Developed by Semtech Corporation, LoRa operates on unlicensed frequency bands, allowing for easy deployment and scalability of IoT networks. It utilizes chirp spread spectrum modulation to achieve long-range communication with low power consumption.

    But, given the popularity of LoRa, much work has been done to reverse engineer the protocol and figure out how it works.

    That knowledge has opened the door to those that want to build their own LoRa transmitter. YouTuber and engineer CNLohr recently decided to take on this challenge. Recognizing that any time an electrical potential passing through a conductor changes an RF field is created, CNLohr decided to use low-cost microcontrollers to rapidly switch an output pin, connected to an antenna, on and off. Using this technique, a very capable LoRa transmitter can be created without a radio chip or any other specialized components.

    Of course this I/O pin switching must happen in a very specific way, otherwise it would just be noise. So, CNLohr developed firmware, called LoLRa, for the CH32V203 RISC-V microcontroller and the ESP32 to switch an output pin on and off in a very specific pattern at hundreds of megahertz. While these specific microcontrollers were targeted in this project, the code could be adapted to other platforms without too much trouble.

    A number of tests were conducted to determine the transmission range of the system. It proved to be surprisingly effective, with signals being received at distances of a few hundred meters all the way up to 2.5 kilometers. The longest range transmissions were achieved with an ESP32-S2 transmitting from a drone.

    As CNLohr noted, the signals produced using this technique are by no means limited to a small range of LoRa frequencies. There is plenty of spill over into other areas of the RF spectrum where transmissions are banned, so you probably do not want to build this project for yourself, as it could get you into some legal trouble.

    Adding a filter to your setup could help, but there are no guarantees. It is also notable that LoLRa can only transmit signals — reception is not possible. So for nearly all practical use cases, using a traditional radio chip is almost certainly the right choice.

    Transmit LoRa Frames Without a Radio
    https://github.com/cnlohr/lolra

    Transmit 900MHz LoRa frames surprisingly far without a radio

    While not truly bit banging, this repository shows how using either a shift register (i.e. I2S or SPI port) or an APLL, you can send LoRa packets that can be decoded by commercial off the shelf LoRa gateways and other chips.

    Note

    This repo is designed for use with ITU Region 2 (The Americas) tageting 902-928MHz. Code changes are needed for use in Region 1 (EU, Russia, Afraica) to target 863-870MHz or Region 3 (Australia, China, India) to target 920-923MHz.

    Reply
  11. Tomi Engdahl says:

    The unPhone Puts a Hackable, Educational, ESP32-S3-Powered LoRaWAN Gadget in Everyone’s Hands
    Developed by Pimoroni and the University of Sheffield, the unPhone delivers a license-free hackable platform for IoT experimentation.
    https://www.hackster.io/news/the-unphone-puts-a-hackable-educational-esp32-s3-powered-lorawan-gadget-in-everyone-s-hands-72a94602a4f8

    Reply

Leave a Comment

Your email address will not be published. Required fields are marked *

*

*