Introduction

This article will describe how to connect Atomsenses Indoor LoRaWAN Gateway to ThingsBoard.

ThingsBoard is an IoT platform for data collection, processing, visualisation, and device management. The platform enables device connectivity via industry-standard IoT protocols or stream data from devices connected to existing IoT Platforms. The platform supports both cloud and on-premises deployments, combining scalability, fault tolerance, and performance so that the users’ data remains safe.

The Atomsenses indoor gateway, acting as a wireless communication base station, has the ability to simultaneously receive 8 LoRa wireless signals. It can forward wireless data to the core network through Ethernet or 4G. Additionally, it can send data from the core network to node equipment, which enables the update of node configurations and the implementation of control commands. This gateway is widely utilized in various settings such as communities and parks to provide reliable LoRa network coverage, ensuring a safe and stable LoRa network service.

After following the steps in this guide, you will have a successfully connected and configured gateway on a network server integrated with ThingsBoard. This will allow you to add devices, receive data from them, and process the data effectively.

Gateway Configuration

Connecting via Mobile Phone

  1. Open the WiFi settings on your mobile phone and search for the gateway's hotspot. The hotspot name begins with "WIFI-05" followed by 6 characters of the gateway ID, for example, "WIFI- 05_e33223". The initial password is "gateway2018better".
  2. Use your mobile phone browser to access "192.168.3.1". This will take you to the gateway's web interface. Log in with the username "root" and password "WelcomeTo2018".

Connecting via Laptop

  1. Connect the gateway's LAN port to your laptop using a cable.
  2. Set your laptop to acquire an IP address automatically.
  3. Open the Google browser and enter "192.168.3.1" to reach the gateway's web interface. Log in using the password "WelcomeTo2018".

Network Server Address Setting

Chirpstack Configuration

Login the Chirpstack configuration interface, select GatewaysAdd gateway

Copy the gateway ID in the LoRa Settings screen of the gateway's WEB configuration interface

On the Add gateway page, enter the gateway name and gateway ID and select Submit.

Configuring the Application on Chirpstack

  1. Go to the “Applications” page in the left menu and click on the “Add application” button.
  2. Fill application name and click on the “Submit” button.
  3. Go to the API keys page in the left menu and click on the “Add API key” button.
  4. Put some name for the API key and click on the “Submit” button.
  5. Copy the created API key and save it as it will be needed for integration with ThingsBoard.

Integrating Chirpstack with ThingsBoard

Adding an Integration in ThingsBoard

Configuring Chirpstack for the Integration

After above steps you should have the gateway connected to ThingsBoard via Chirpstack.

After adding devices, by sending data from the device, it will appear on the corresponding device page in ThingsBoard. You can view the data in the "Entities" -> "Devices" menu or by creating a dashboard

About how to create a dashboard, please refer to : https://thingsboard.io/docs/user-guide/dashboards/

This document outlines the primary components of a LoRa network, specifically utilizing the The Things Network (TTN) environment for illustrative examples.

The focus of this discussion will be the backend architecture of the LoRa network, emphasizing the components necessary for receiving messages, distributing Over-The-Air Activation (OTAA) identifiers, routing messages to their intended destinations, and similar functionalities.

Main Components

According to The Things Network's official website, the following components are integral to a LoRa network:

  1. Mote (IoT Device): Typically a combination of a LoRa transceiver and a sensor.
  2. LoRaWAN Gateways: Multiple gateways can be within range to receive messages from devices, forwarding these messages over UDP to a router/broker service.
  3. The Things Network Router: This black-box service receives UDP messages from gateways and subsequently forwards them to user-subscribed applications. This process involves at least two steps:
    • Receiving and decoding UDP messages from gateways and publishing them to an MQTT broker.
    • Application Handlers.
      TTN employs a complex architecture consisting of brokers, routers, and handlers; however, not all modules are available for private use at this time.

LoRa Devices

The design of LoRa devices (motes) is detailed in the hardware guide, and technical aspects of their construction are beyond the scope of this document. Comprehensive technical details regarding LoRa can be found in the LoRa Specification (V 1.0.1, Oct 2015).

For the architecture of the LoRa network, it is essential to understand that devices can be integrated into the network through two activation methods:

Devices must be activated on the network before the network can process the data they transmit. While gateways will forward upstream messages, subsequent components in the network will not act on data from unrecognized devices. Activation can occur through either a fixed identity (ABP) or dynamic addressing, similar to Wi-Fi, where the network router assigns a unique address.

OTAA
OTAA is the preferred method for activating devices on the TTN. This process is analogous to connecting to a Wi-Fi network; however, it differs significantly because LoRa devices, typically simple sensor nodes, cannot be manually configured in the field. Instead, each device receives a unique ID to request a temporary unique address.

During the OTAA process, the device undergoes a join procedure and must store the following information prior to this process:

The device generates a JOIN request using its DEVEUI and APPEUI. The network must be made aware of the devices wishing to join via the application code; this is facilitated through the TTN network's ttnctl tool and web interface.

Upon acceptance of the JOIN request, the network sends a downlink message containing the DevAddr (Device address) for the device's use.

ABP
To ensure security in ABP, the network prevents unauthorized devices from assuming the identity of a node by requiring the device to maintain a frame counter. This counter confirms that both parties recognize each other as legitimate communicators.

Unlike OTAA, ABP does not involve a join procedure. Instead, the LoRa device is programmed with a unique code (DevAddr) for communication, along with the AppSKey and DevSKey, which must also be stored prior to any data transmission.

LoRa Gateway

Most gateways receive messages from LoRa devices and can forward them to multiple routers, referred to as uplink messages. Gateways typically utilize a UDP connection to relay these messages to the backend router/broker, commonly through port 1700.

Gateways can also facilitate downlink messages, enabling the backend to send commands back to devices. After transmitting an uplink message, the LoRa device will check for downlink messages.

It is important to note that while LoRa gateways are sophisticated devices, they lack intelligence beyond receiving and transmitting LoRa messages across various channels and speeds to designated router servers.

Single Channel Gateways
Single Channel Gateways operate on only one channel and speed, limiting their ability to receive a complete range of LoRa messages (approximately 10% of total transmitted messages). They may be useful in low-traffic areas or for private networks serving a limited set of known devices.

These gateways do not support downlink functions and cannot forward JOIN accept messages, making them suitable only for ABP addressing. While they are more cost-effective than full-fledged LoRa gateways, their use may disrupt OTAA functions in areas where both types of gateways coexist.

Future iterations of the TTN environment are expected to accept messages from single channel gateways in a staging environment for testing purposes but will not route downlink traffic to these gateways. The potential for single channel gateways in the production environment remains uncertain, as TTN aims to prioritize full gateways.

Router, Broker, and Handler

In general, the Router, Broker, and Handler functions are combined into a single program:

Router: Receives UDP messages from gateways and forwards them to brokers. The broker monitors associated gateways to ensure compliance with TTN's fair use policy.

Broker: Acts as an intermediary between the router and application handler, identifying the appropriate handler for each device based on registered information.

Handler: Delivers MQTT messages to subscribed applications, requiring knowledge of device registrations.

About Us

Atomsenses is a specialist IoT solution provider focusing on LoRaWAN sensors for indoor air quality monitoring, our vision is to transform how we manage and maintain healthy indoor environments.

By leveraging advanced technologies and innovative solutions, we can create healthier indoor spaces that enhance well-being and productivity.
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram