LoRa Basics™ Modems: Walk-through

Application Server: Node-RED

The application server handles application data and device management frames. There is no background connection between the LoRaWAN® Network Server and the Device & Application Services. Rather, all uplinks related to modem traffic must be forwarded by the application server to the Device & Application Services server.

This demonstration uses Node-RED as the application server. Node-RED is a browser-based visual programming tool that allows for fast prototyping. Built on Node.js, Node-RED can be used to wire together flows using a wide array of nodes. These nodes can then be deployed to its runtime with a single click.

Setup

Installation

To set up Node-RED, follow the official installation guide. You can find the guide here: https://nodered.org/docs/getting-started/
You can use a local computer, a Raspberry Pi, or any remote computer/server.

Access to the Node-RED Editor

By default, Node-RED starts on port 1880. If you have installed Node-RED locally, browse to http://127.0.0.1:1880; otherwise navigate to http://IP_OF_INSTALLATION:1880.

Once Node-RED is set up correctly the following page should display:

Node-RED editor

Figure 1: Node-RED editor

The user interface has three key areas:

  • Palette: This is where you can select nodes; these are functional blocks that can be dragged-and-dropped, and then can be linked together to create a flow.

  • Flow: This is the source code of the program. In this pane, you can link nodes together to create an application.

  • Sidebar: The Sidebar displays the Help or debug information available for the selected node.

Installing Additional Nodes

To set up the demonstration, three additional libraries must be installed in Node-RED:

  1. node-red-contrib-loracloud-utils: Handles calls to LoRa Cloud™ servers

  2. node-red-dashboard: Provides tools to create dashboards such as a temperature graph

  3. node-red-contrib-web-worldmap: Creates a map for geolocation features

The setup can be completed from the Node-RED editor menu, as shown in the following video:

Video: Installing Additional Nodes
  1. Click the hamburger menu in the top right corner of the screen.

  2. Select Manage palette.

  3. Select Install.

  4. Search for node-red-contrib-loracloud-utils.

  5. Click the Install button for the @semtech-wsp-apps/node-red-contrib-loracloud-utils package.

  6. Click Install in the pop-up window.

  7. Wait for the installation to complete. This might take several minutes.

  8. Repeat these steps to install the node-red-dashboard and the node-red-contrib-web-worldmap libraries.

Import the LoRa Basics™ for End Nodes Demo Flow

The node-red-contrib-loracloud-utils package includes useful samples to walk you through this example project. Watch this video to learn how to import them:

Video: Import Samples for Demo

  1. Click the hamburger menu in the top right corner of the screen

    1. Click Import

    2. Click Examples

    3. Select node-red-contrib-loracloud-utils and then modem

    4. Select New flow then click Import

  2. Place the nodes and then left-click to save their positions

  3. Deploy the flow by pressing the Deploy button on the device

  4. Dismiss the error by clicking Confirm deploy

Note

The Deploy step reports an error because the MQTT nodes are not yet configured.

Configure the Flow

The example flow must be configured with the device information and the selected LoRaWAN® Network Server.

Configuring the LoRaWAN Network Server (MQTT)

All network server connectors are activated by default; however, the MQTT connection must be set up separately.

First, get the required data:

  • MQTT server address

  • MQTT port

  • MQTT username

  • MQTT password

This data can be obtained when setting up the network server. For more information, see Network Server Setup.

Next, set up the desired network server:

  1. Delete the MQTT connectors to any unused LoRaWAN network servers

  2. Edit an MQTT node by double-clicking it

  3. Click the pencil icon to edit the MQTT broker configuration

  4. Enter values in the Server, Port, and TLS fields, if required

  5. On the Security tab, fill in the Username and Password fields

  6. Click Add and then click Done

  7. Click on Add new mqtt-broker in the other nodes to select the server

  8. Click Deploy

Note

Several LoRaWAN network servers can be used at a time.

LoRa Cloud™ Configuration

To configure the server, the DAS URL and DAS TOKEN from Device & Application Services setup, are required, as is the device’s DevEUI.

  1. Edit the DAS server token node by double-clicking it

  2. Enter the token and then click Done

  3. Edit the DAS URL node

  4. Enter the URL and then click Done

  5. Edit the DevEUIs URL node

  6. Enter in the DevEUIs and then click Done

  7. Click Deploy

Note

  • Several DevEUIs can be configured at once

  • The characters for each DevEUI should be separated into groups of two with a dash between each pair: XX-XX-XX-XX-XX-XX-XX-XX

Configuring Node-RED User Interface Elements

Node-RED user interface (UI) elements must be associated with a UI group. The following steps will create an association with the default Node-RED UI group.

Video: Associating Node-RED UI elements with a UI Group

  1. Select Temperature widget

    1. Click the edit (pencil) button

    2. Click Update

    3. Click Done

  2. Repeat these steps for the Upload text widget and the Image widget.

Import the LoRa Basics™ Modem-E Flow Add-on

Once the LoRa Basics for end nodes flow has been set up, you will need to import an add-on to see the geolocation features of the LR1110 in action.

Video: Importing LR1110 geolocation example

  1. Click the hamburger menu in the top right corner of the screen.

    1. Click Import

    2. Click Examples

    3. Select node-red-contrib-loracloud-utils then modem-E

    4. Select New flow then click Import

  2. Place the nodes and then left-click to save their positions

  3. Double-click the blue node, Assistance coordinates for GNSS autonomous scans, to edit it

  4. Set the assistance coordinates [latitude, longitude] and then click Done

  5. Double-click the grey input link to edit it

  6. Check the Stream from DAS box and then click Done; this flow will be connected to all streams from the Device & Application Services

  7. Double-click the grey output link to edit it

  8. Check the To DAS parser box and then click Done; the Device & Application Services output will be connected to the DAS parser block

  9. Deploy the flow by pressing the Deploy button on the device

Note

Rough assistance coordinates are mainly required by the solver in case of an autonomous GNSS scan, and must have an accuracy of ± 150 km. Please see the reference manual for a complete description.

Usage

Temperature

Temperature is sent automatically from the Murata modem in Demo mode.

Note

If using a Nucleo board, you will have to press the blue button on the board itself to send the temperature data.

Add /ui to the URL in your web browser to display the dashboard. (For example, if Node-RED is installed locally, use the URL http://127.0.0.1:1880/ui.)

The temperature graph will be displayed:

Application server temperature graph

Figure 2: Temperature Graph Available via the Application Server

Uploading a File

LoRa Basics™ Modem sends images through the File Upload service. The images are then reconstructed by the LoRa Cloud™ Device & Application Services. Once it has been fully received, the image will be displayed in the Node-RED user interface, as shown here:

Image in the application server temperature graph

Figure 3: Image in the Temperature Graph

Note

The LoRa Basics™ Modem serial output will display INFO : File upload is complete, program a new alarm when a file transfer is complete.

Data Returned by the LoRa Cloud Device & Application Services

The Node-RED sidebar shows all data returned by the Device & Applications Services server. To view this data, click the Debug button (represented with an insect icon):

Node-RED debug button

Figure 4: Node-RED Debug Button

The data will be displayed like this:

Data from Device & Application Services displayed in the debug sidebar

Figure 5: Data from Device & Application Services displayed in the debug sidebar

Warning

If some of the fragments of a stream are lost due to network issues, the following streams will be kept in the Device & Application Services’ memory. These streams will be delivered to the application server only when the first stream is reconstructed or has timed-out.

Sending a Request to the End Node Through the Device & Application Services

The LoRa Cloud™ Device & Application Services server provides an easy way to send requests to the end node to get information or update configuration data. This can be tested by clicking the buttons of the blue nodes in the Direct API calls section of the Node-RED example.

To send a request to the Device & Application Services, click the blue button to the left of the associated box, as shown in Figure 6:

Request to DAS buttons

Figure 6: Request to Device & Application Services Buttons

Note

The full request list can be found here.

Geolocation (Modem-E)

Geolocation results are displayed in a map and in Node-RED’s debug tab.

To display the map add /worldmap to the URL in your web browser. For example, if Node-RED is installed locally, use the URL http://127.0.0.1:1880/worldmap).

Geolocation map

Figure 7: Geolocation map

Note

Worldmap has no history, all points are lost when the page is closed.