===== LoRaWAN specification. Introduction. Basic concepts and end-device classes ===== https://lora-alliance.org/ https://lora-alliance.org/resource_hub/lorawan-specification-v1-1/ https://habr.com/ru/articles/316954/ This article is an introduction to LoRaWAN wireless networks and based on the LoRaWAN 1.0.2 specification. [[https://lora-alliance.org/|{{ :03b3133c2eb7422dbcc4f29bcf7a300f.jpg?nolink&600 |}}]] ==== Introduction to LoRaWAN ==== A typical **wireless LoRaWAN** network is a collection of **gateways** forwarding messages between **terminal** and **central server (Network Server, NS)**, and is characterized by "star" topology "star-of-stars". {{ :1ee02f4cec2a4a7d930d185b5fa262f9.jpg?nolink&600 |}} Gateways are also called **concentrators** and **base stations**. The end-devices are often named as **motes**. Communication between the gateways and the central server is carried out through standard IP connections, and between the gateways and end-devices through wireless connections using **wideband modulation LoRa** or FSK. LoRa modulation was developed by Semtech and is designed for low-speed wireless data transmission over distances of up to several kilometers in license-free frequency bands (Europe - 433 and 868 MHz). Communication between gateways and end-devices is two-way, but it is assumed that the bulk of the data is transferred from end-devices to gateways. LoRa technology provides **wireless transmission speed from 0.3 to 50 kbps**. To separate channels, both a set of frequency channels and data rates are used. To optimize the system performance, an adaptive change in the transfer rate is used - **ADR (adaptive data rate)**. The network server evaluates the quality of the signal received from the end-device and can control both the transmission rate and the transmitter power of this device. The end-device can transmit data on any available channel and any bit rate, considering the following: * Each time a message is transmitted, the frequency channel is randomly selected by the end-device from the list of available channels. * Before starting the transmission, the end-device must make sure that the channel is free (Listen Before Talk, LBT). The channel is considered free if the measured instantaneous RSSI value is less than RSSI_FREE_TH. If the channel is busy, the device switches to another channel and repeats the LBT procedure. * The end-device must take into account local regulatory restrictions regarding the percentage of time a device can occupy a frequency channel. ==== The main advantages of LoRaWAN networks ==== The main advantages of LoRaWAN wireless networks are due to the use of wideband LoRa modulation and license-free frequency bands. LoRaWAN networks: * compatible with existing wireless networks/technologies; * have high noise immunity; * capable of serving tens and hundreds of thousands of devices; * provide a large coverage area and low power consumption of end-devices. ==== Variants of LoRaWAN wireless network use ==== Possible uses: * gas, water, electricity counters data reading; * Smart Grid (monitoring of new generation electrical networks); * monitoring of vehicles and cargoes in a certain territory (locating, information on the condition of vehicles and cargoes); * control of the containers condition / containers in production (petrochemical production, containers for production waste, containers with hazardous substances); * monitoring of production equipment (reducing downtime, monitoring parameters, ensuring personnel safety); * smart parking (monitoring the availability of parking spaces); * monitoring of garbage cans (optimization of waste disposal processes); * smart street and other lighting (remote control, status control); * weather monitoring; * control of the hatches status (prevention of unauthorized intrusions); * control of the harmful substances presence in the atmosphere; * collection of data on the state of the environment (pollution, noise, rain, wind, etc.); * fire, security alarm; * building automation (temperature, humidity control, gate control, blinds). ==== LoRaWAN end-device classes ==== Let's go back to the LoRaWAN specification and see what devices exists. At the end of 2016, the specification defines 3 classes of LoRaWAN end-devices: A, B and C, which differ from each other in reception modes. Devices of these classes are bidirectional. Class A is basic and must be supported by all devices. === Class А (mandatory for everyone) === Class A devices after each transmission open two short time windows for reception (denoted as RX1 and RX2). {{ :99419f542aeb4097b6c987219a66efcb.jpg?nolink&600 |}} The intervals from the end of transmission to the opening of the first and second time windows can be configured, but must be the same for all devices in the network (RECEIVE_DELAY1, RECEIVE_DELAY2). For the European 868 MHz band, the recommended value for RECEIVE_DELAY1 is 1 second. The value of RECEIVE_DELAY2 must be (RECEIVE_DELAY1 + 1) second. The frequency channels and transmission rates used for RX1 and RX2 slots may differ. Recommended values are given in a separate document - "LoRaWAN Regional Parameters", available on the website [[http://www.lora-alliance.org/For-Developers/LoRaWANDevelopers|LoRa Alliance]]. Class A devices are the lowest power devices, but to send a message from the server to the end-device, you must wait for the next outgoing message from this device. === Class B (Beacon) === In addition to the receive windows defined for Class A devices, Class B devices open additional scheduled receive windows. To synchronize the opening time of additional receive windows, the gateways emit beacons. All gateways that are part of the same network must emit beacons at the same time. The beacon contains a network ID and a timestamp (UTC). The use of class B ensures that when polling end-devices, the response delay will not exceed a certain value determined by the beacon period. === Class C (Continuous) === Class C devices are in receive mode almost all the time except when they are transmitting messages. With the exception of the RX1 time window, the end-device uses the RX2 receive parameters. {{ :2a186c7b594841c8bc1ec8ef827871aa.jpg?nolink&600 |}} Class C can be used where it is not necessary to save energy as much as possible (electricity meters) or where it is necessary to interrogate terminal devices at arbitrary times.