You can use the SmartServer to integrate and manage LoRaWAN (Long Range Wide Area Network) devices. LoRaWAN is a low power, wide area (LPWA) networking protocol designed to wirelessly connect battery (class A) and line-powered (class C) devices to a network providing bi-directional communication, end-to-end security, mobility, and localization services. The SmartServer LoRaWAN driver sends and receives data to and from LoRaWAN devices via a LoRa Network Server (LNS), which in the case of SmartServer 4.0 and higher is ChirpStack 4.2. ChirpStack is not included with the factory SmartServer image and is added during the SmartServer LoRaWAN setup.
To set up and use LoRaWAN with the SmartServer, follow these steps:
Once your system is set up for LoRaWAN, you can start adding your devices into ChirpStack and then provisioning them in the CMS once they are discovered. See the Adding LoRaWAN Devices in ChirpStack section in Discovering, Defining, or Importing Devices.
For the beta release, once you have configured your SmartServer with the LoRaWAN image, do not upgrade or re-image the SmartServer as this operation breaks the LoRaWAN configuration.
For the beta release, do not change the static IP address of the SmartServer as this operation may break ChirpStack.
Enabling / Disabling the LoRaWAN Driver
By default, support for the LoRaWAN driver is disabled. However, once the beta configuration has been set up, the LoRaWAN driver will be running. The information that follows regarding enabling/disabling the LoRaWAN driver is for your reference only.
Enabling the LoRaWAN Driver
To enable the LoRaWAN driver, first enter the following command:
To disable the LoRaWAN driver, you first need to stop the driver. Issuing only the disable service command does not stop the service from running. The service will continue to run and will only be stopped after a reboot or by issuing the stop command as well. To stop and disable the LoRaWAN driver, enter the following commands:
Importing and Creating LoRaWAN Device Interface (XIF) and Device Type Definitions
You can import and optionally modify LoRaWAN device interface (XIF) and device type definitions. You can also manually create custom LoRaWAN XIF and device type definitions. To import and modify LoRaWAN device interface (XIF) and device type definitions, follow these steps:
To import LoRaWAN XIF definitions, download the LoRaWAN device type package (.dtp) files from the SmartServer GitHub Repository You can optionally modify the LoRaWAN XIF files to hide selected datapoints.
Import the LoRaWAN device interface (XIF) and device type definitions using the Import / Export button () on the SmartServer app bar.
Receiving Uplink Data from Edge Devices
LoRaWAN devices will send unconfirmed uplink data regularly, along with alarm data as necessary. Regular uplink data may consist of one or more packets, separated by a few seconds. The regular update interval is configurable either using an NFC app or via downlink data and determines battery life for class A devices. Devices send an encrypted base64-encoded hex string over the air that represents all the sensor data, the LNS decrypts the data, converts from base64-encoded to a hex string and the relevant device profile codec converts the hex string to JSON which is passed to IAP using MQTT. The entire hex string prior to JSON encoding is available in IAP.
Sending Downlink Data to Edge Devices
The LoRaWAN driver sends downlink data to the LNS using MQTT. The LNS forwards the data to edge devices. The LoRaWAN driver uses an LNS-specific MQTT topic, base64-encoded data, and the fport number configured in the XIF for the device type and the datapoint in question. The data is sent to the LoRaWAN device using a confirmed message. Downlink data may relate to a specific datapoint, or may be a hex string that can be used to configure the regular uplink period, alarm thresholds or form part of a request response mechanism in conjunction with the subsequent uplink data.
Defining the IAP Device UNID
The LoRaWAN device DevEUI is used as the IAP unid. It is either acquired when using automatic discovery for LoRaWAN (the preferred mechanism) or added when manually creating devices.
Using Redundant LoRaWAN Gateways
ChirpStack supports redundant gateways, either for enhanced coverage or for true redundancy.
Configuring the LoRaWAN Gateway
ChirpStack requires an external LoRaWAN gateway that must be configured for Semtech Packet Forwarding on UDP port 1700 (Up and Down) and the LNS IPV4 address set to that of the SmartServer.
An example RAK gateway configuration is shown below. Make a note of the Gateway EUI for subsequent use.