LoRaWAN Application

Collection of articles for working with Multitech devices in LoRaWAN networks.

LoRaWAN Application

Default mPower™ LoRaWAN® application and server API implementation for a distributed LoRaWAN network. The application will communicate with the embedded LoRaWAN network server on a MultiTech Conduit® and forward messages to the configured HTTP(S) or MQTT(S) servers. Configuration for a single server can be provided via the mPower WebUI or for multiple servers using the MultiTech Lens® cloud service.

The default application feature allows last mile bi-directional connectivity from the gateway to a cloud application without needing to deploy custom code on each gateway. An existing API can add compatible end-points allowing LoRaWAN uplinks and downlinks to be consumed and produced by the cloud application.

It also provides a starting point for those wanting to bring intelligence to the edge by customizing the default application.

Architecture

The diagram below show the components for a distributed LoRaWAN network using MultiTech hardware and cloud services with a 3rd Party API. The Conduit can be one of server models such as MTCAP, MTCDT or MTCDTIP running the mPower firmware version 5.3.0 or later.

Components

Network Messages

The diagram below shows the messages passed between a LoRaWAN end-device (Dot), LoRaWAN Network Server (Conduit), LoRaWAN Join Server and Application/Network Management Server (Lens) and a 3rd Party API.

Ladder Diagram

In the diagram the Class A Rx1 Offset has been increased to five seconds to allow the HTTPS request to be returned in time for a possible Class A downlink to be scheduled to the end-device. The HTTPS connection adds latency that can extend beyond the default one second Rx1 Delay.

  1. The Dot sends join reqeust over-the-air
  2. The Conduit received the join request and forwards the request to the Lens Join Server
  3. The Lens Join Server authenticates the request and issues a Join Accept message
  4. The Conduit receives the Join Accept message, AppEUI and Session Keys from the Lens Join Server
  5. The Conduit send the Join Accept message over-the-air
  6. The Conduit reqeusts additional App Info from Lens if it is not cached
  7. If is a new app the Init Msg is sent to the 3rd Party API
  8. The 3rd Party API returns configuration data in the Init Msg response
  9. A device joined message is sent to the 3rd Party API
  10. When an uplink is received by the Conduit it is forwarded to the 3rd Party API
  11. The 3rd Party API can response to the Uplink message with a list of downlinks
  12. The Conduit will periodically request downlink packets from the 3rd Party API
  13. The Conduit will schedule received downlinks for transmission to a Dot

Installation

The example API projected should be installed and run on a PC with node.js support installed.

$ npm install

Running the HTTP/HTTPS server

$ node app.js

Application Location

The application source is located in the mPower file system at /opt/lora/app-connect.py. A custom application can be created and deployed via DeviceHQ to install and run the python script.

HTTP(S) Applications

A default application can be configured using mPower 5.3.x firmware.

mPower Network Configuration

Application Configuration

url: server URL
eui: application identifier
options:
  server_cert: server certificate
  clent_cert: client certicate
  apikey: client private key
  check_hostname: boolean to verifiy the server hostname

HTTPS API Protocol

Paths

TLS Certificates

Linux Certificate Doc

MQTT Applications

Application configuration

url: mqtts://test.mosquitto.org:8883
options:
  server_cert: server certificate
  clent_cert: client certicate
  apikey: client private key
  username: MQTT username
  password: MQTT password

MQTT Protocol

Test brokers