How do Gateways for LoRaWAN® work?
A large portion of the IoT network technology (LoRaWAN in particular) focuses on a centralized model, where there are end nodes and gateways. These gateways are an essential part of the network as they route user traffic. A brief explanation of what a LoRaWAN gateway is presented in a previous article. This article will explain in greater detail how LoRaWAN gateways work and the mechanics and protocols they are built upon.
LoRa® and LoRaWAN® are not the same things. There is plenty of information about it and even we have covered the topic thoroughly here. Still, the LoRa Alliance® is the place to go for the most reliable information. Nevertheless, we will say a few words as well.
LoRa stands for Long Range. It is part of the low-power long-range networks family. It is based on the spread-spectrum modulation technique derived from chirp spread spectrum (CSS) technology. LoRa is a patented technology by Semtech. On the other hand, LoRaWAN (Long Range Wide Area Network) is the media access control (MAC) layer protocol built on top of LoRa. So in general, LoRa is the hardware, and LoRaWAN defines how this hardware should be used. This defines a worldwide standard for interoperability and compliance between all LoRaWAN networks worldwide and is managed by the LoRa Alliance.
The LoRaWAN gateway
Wikipedia says that a gateway is a piece of networking hardware or software used in telecommunications for telecommunication networks that allows data to flow from one discrete network to another. Gateways are distinct from routers or switches. They communicate using more than one protocol to connect multiple networks and can operate at any of the seven layers of the open systems interconnection model (OSI).
The LoRaWAN gateway transmits the data received from the end devices/nodes to the internet or your local server, bridging the end-user to the network. But how exactly?
The guts of a gateway
Even though a gateway consists of quite a few components, depending on the additional functionality that is desired, two things are a must: the LoRa concentrator and the host MCU.
The LoRa concentrator is the part that allows the gateway to receive and transmit LoRa messages. It consists of a LoRa baseband processor and two front-end chips. The concentrator may have additional chips that allow features like Listen Before Talk (LBT), interface conversion, GPS, time stamping, etc. Additionally, a concentrator comes in a variety of form factors: mPCIe card (RAK2247, RAK2287, RAK5146), 40 PIN Raspberry Pi standard (RAK2245), etc.
You can see the Radio Frequency (RF) part with the LoRa antenna connector, filters (SAW) to limit the unwanted frequencies, an amplifier of the signal (FEM), dual front-end chips (SX1250), and the SX1303 baseband chip. Also, we have the STM32 chip, which runs code to make the concentrator USB compatible and communicate with the additional SX1262 to enable functions like LBT and spectral scan. A GPS module and GPS antenna connector are also available (optional) for this concentrator for some of the LoRaWAN functions like Class B.
The two front-end chips are divided into Radio A and Radio B. Radio A can work in both TX and RX mode. It can have up to five channels assigned. Radio B works solely in RX mode. It can also have up to five channels assigned. This gives us a total of eight MultiSF channels, one LoRaSTD, and one FSK.
On the other hand, there is the host. It can be a universal single-board computer like the Raspberry Pi (Asus Tinker Board, etc.) or a custom-developed system board. Of course, you need software that communicates with the LoRa concentrator to receive RF messages and transmit them to the LoRaWAN Server.
All of the mentioned above components are some pretty dainty and fragile pieces of hardware that need to be protected from the variables of the surrounding environment. The casing’s purpose is to nest all the small components inside, to protect them, and to ensure a long life for your device.
Depending on the intended environment to be used in, the gateway can be an indoor or outdoor one. The casing features change depending on that.
Indoor gateways usually come in compact casings, often made from plastic, as indoor environmental conditions are not as harsh. As for the devices designed for outdoor use, things change drastically. The casings become more extensive, more durable and watertight, to protect against environmental changes.
When we speak of devices that receive and transmit wireless signals, we also have to mention antennas. The whole process will be impossible without them, and we have dedicated an in-depth and detailed article just to that. We will just mention that indoor gateways have smaller, less intrusive antennas that result in a smaller coverage range, whereas outdoor units are larger and provide substantially more coverage.
The software stack
LoRa Packet Forwarder
The LoRa Packet Forwarder is a program running on the host of a LoRaWAN gateway. It forwards RF packets received by the concentrator (uplinks) to a LoRaWAN Network Server (LNS) through a secure IP link. It also transmits RF packets sent by the LNS (downlinks) through the same secure IP link to one or multiple devices. Additionally, it may transmit beacon signals used for time coordinating devices within the network.
The classic Packet Forwarder is already considered legacy as Semtech released the LoRa Basics™ Station. It is an implementation of a LoRa Packet Forwarder. Still, it provides a more secure connection to the preferred LNS and also a way to remotely configure the settings of the packet forwarder and the gateway over the CUPS protocol.
Most LoRaWAN gateways support both the Legacy Packet Forwarder and the LoRa Basics™ Station.
The LoRaWAN Server
The LoRaWAN Server is a mandatory component of any LoRaWAN Network. It can reside in the Cloud or be Built-into the gateway itself (all RAK gateways have one). It serves the purpose of device authentication, packet deduplication, message decryption, management and monitoring of end-nodes and gateways, hosting end-user applications, etc. It ensures the security, reliability, and scalability of data routing throughout the network.
Additional features/software components
Different gateways provide some additional features besides the main one to receive/transmit RF signals between end-devices and the Network Server. For example, RAK WisGate Edge gateways support the Legacy Packet Forwarder, the Basics Station and also provide a Built-in Network Server. They have MQTT support that allows you to use existing MQTT brokers and also HTTP integrations that allow sending the data directly to the web.
As the gateway needs to connect to the Cloud where the Network Server or at the very least the end-user application resides, it requires stable Internet access.
Gateways usually have one or more of the following: Ethernet, Wi-Fi, Cellular, which they use as back-haul connectivity. More advanced gateways (RAK WisGate Edge series) have all of the aforementioned, with the option of interface failover in case one of the interfaces fails, to provide a stable connection.
Let us reiterate the whole communication chain to give the reader a complete picture of the LoRaWAN Network and where the gateways fit in.
The gateway gathers LoRa Frames from end-nodes, it re-transmits this data to the LoRaWAN Network Server, which takes care of authentication, de-duplication of data frames, etc. The reverse is also possible, where the Network Server sends downlink instruction sets through the Gateway to the end-nodes. In a way, the gateway is a bridge/protocol converted between the end-nodes and LoRaWAN Server.
As we have observed, the LoRaWAN gateway is easier to be explained than anticipated. However, as simple as it is, it is still a vital part of any LoRaWAN based solution, which is impossible without it. Understanding the details of the network will give you a better understanding of the network itself, enabling you to make informed decisions and perfecting any use case scenario that comes to mind.
Keep learning, keep creating!