March 1, 2019
What is LoRaWAN?
With progress in miniaturization, we have powerful and low power consuming small computers. We can equip them with a battery as supply power, place them in inaccessible places and use them for monitoring or controlling devices. To connect them with headquarters we need wireless communication technology, such as LoRa.
LoRaWAN is the network which operates on top of LoRa wireless modulation technology. It defines the communication protocol and system architecture for the network, while the LoRa physical layer enables the long-range communication link.
The LoRaWAN protocol architecture is designed in a star-of-stars topology. The gateways relay messages between end-devices and a central network server. Communication to the network server is based on standard IP connections and act as a transparent bridge. In other words, they are simply converting radio packets to IP packets and vice versa. All modes are capable of bi-directional communication. What is more, there is support for multicast addressing groups to make efficient use of spectrum.
In addition to frequency hopping, all communication packets between end-devices and gateways include a variable data rate (DR) setting. The selection of the data rate allows a dynamic trade-off between communication range and message duration. Also, due to the spread spectrum technology, you can communicate with different data rates and those messages won’t interfere with each other. In fact, the LoRaWAN network server manages the data rate setting and radio frequency output power for each end-device individually by means of an Adaptive Data Rate (ADR) scheme. This results in maximizing both the battery life of the end-devices and overall network capacit.
LoRaWAN baud rates range from 0.3 kbps to 50 kbps (link to source). In most cases, that’s fair enough.
Classes A, B & C
LoRaWAN distinct 3 classes of devices which work simultaneously: A, B, and C. Each class has different data rates and communication capabilities due to their use cases.
Class A, like Asynchronous
Class A is asynchronous, which means that nodes don’t wait before sending messages to the gateway. In other words, they just send a message and take care of themselves no matter if a message was received or not. The device then opens two receive windows at specified times after an uplink transmission. If the server does not respond in either of these receive windows, the next opportunity will be after the next uplink transmission. Node opens receive window in specified time slots also.
You can use battery-powered node in deep sleep, wake up the device only for reading sensor data and sending it to the gateway. This approach is similar to an ALOHA system.
Class B, like Beacon
Next, class B schedules receive windows for downlink messages from the server. It’s transmitted in an interval of 128 seconds. Long story short, the nodes periodically open receive windows.
Class C, like Continuous
Devices powered from the grid are main aim of the last class C. In this mode end-devices are constantly listening for a message sent at any time.
Security is a primary concern for any mass IoT deployment and the LoRaWAN specification defines two layers of cryptography:
- A unique 128-bit Network Session Key (NwkSKey) shared between the end-device and network server
- A unique 128-bit Application Session Key (AppSKey) shared end-to-end at the application level
LoRaWAN uses AES algorithms to provide authentication and integrity of packets to the network server and end-to-end encryption to the application server. By providing these two levels, it becomes possible to implement the full encryption of transmitted data.
All LoRaWAN traffic is secure. Each payload is encrypted by AES-CTR and carries a frame counter to avoid packet replication. Message Integrity Code (MIC) is also computed with AES-CMAC to avoid packet tampering.
ABP and OTAA
The keys can be Activated By Personalisation (ABP) on the production line or during commissioning, or can be Over-The-Air Activated (OTAA) in the field.
ABP procedure directly ties an end-device to a specific network. Activating an end-device by personalization means that node already has the DevAddr and the four session keys NwkSKey, SNwkSIntKey, NwkSEncKeyand AppSKey. There is no need to derived them during join procedure. In other words, node has embedded with every information required for participating in LoRa network.
For the other hand, during Over-The-Air Activation end-device perform join procedure with LoRaWAN gateway. A device receives DevAddr and dynamically changing values which are used to calculate other keys. Those values are based on a number of join procedures performed by gateway and DevEUI. In contrast to ABP, OTAA allows devices to generate new pair of keys if necessary.
Devices and applications have a 64 bit unique identifier (DevEUI and AppEUI). In Over-The-Air Activation, after joining the network, a device receives a dynamic (non-unique) 32-bit address (DevAddr). This address consist of first 7 bits fixed for the network and 25 bits that identifies each device in network.
During Activation By Personalization device already has it’s DevAddr and other keys necessary for operating in network embedded in memory.
Characteristics of the Internet of Things
Applications of the Internet of Things are very specific. Most of the connected devices is transmitting messages not larger than 2kB. These are mostly sensors, which sends results of measurements in cycles with configurable time intervals. Nodes are energy efficent and wake up from sleep mode only to transmit data. To enable them sending data in a short period of time we have to fast connect to the network as soon as possible.
The LoRa technology covers the requirements of the Internet of Things networks. Low power consumption, long range and fast connection to the network after wake up are crucial for these type of applications. What is more, the LoRa in many countries has a public infrastructure, for example The Things Network or Senet. You can build your sensor network without the hassle of building and configuring infrastructure. In fact, you can simply connect your gateways to existing infrastructure.
In LPN Plant we connect consulting, technical expertise and financial effectiveness to design and implement low power wireless solutions for industry. If you looking for LoRaWAN product developers or just need support in a small piece of your system feel free to set up call with us using calendly. If you enjoying this type of content feel free to sing up to our newsletter and share content on social media.