Easily Visualize LoRaWAN® Sensor Data On Your Mobile Phone

Implementation Steps

Step 1 - Create the MQTT Backend Connection on TPX

ThingPark X -in short TPX- is the module of the ThingPark platform in charge of dataflow processing. TPX can perform decoding of binary uplink payload to JSON, encoding of REST commands to binary commands, normalization and transformation of data, and it also manages the connections with other services (such as MQTT servers) and platforms (e.g. Microsoft Azure IoT Hub). In this step we will use the mosquitto.org MQTT broker, so we will simply create a new MQTT connection instance.

In the Hello LoRaWAN® and Thingpark cookbook, an HTTP connection was used to send collected data to a webhook for monitoring. In this activity, we are going to create instead a connection to the “mosquitto.org” MQTT Broker as shown in the figure. The type of connection will be set to “MQTT”.

If the configuration is correct , you will see OPENED icon at the right top of the screen: the TPX engine successfully connected to the target MQTT broker at mosquitto.org. If it shows “FAILED” instead, then check your configuration and the status of the MQTT broker.

Step 2 - Update the Sensor Definitions on TPE

The TPX engine of ThingPark Community already has a comprehensive library of CoDecs, and they regularly get updated by the development team as well as the community. You can also write your own custom CoDec, or contribute it on the GIT repository. These CoDecs are very handy to process the collected sensor data with no coding effort. In this cookbook, we are using the Tinovi LoRaWAN® IO Module, which already has a CoDeC available in the TPX CoDec library.

Previously, in the Hello LoRaWAN® and Thingpark cookbook, the device had been created on ThingPark Community with generic parameters (“Generic”  as Manufacturer and “LoRaWAN® 1.0.2 revC – Class A” as Model), because we didn’t need any device specific parsing.

Now let’s change it to the correct Manufacturer (Tinovi) and Model (LoRaWAN® Soil Moisture…) in the Devices console as shown in the figure. This information allows the TPX dataflow to automatically select the appropriate CoDec.

Step 3 - Verify the TPX Definitions and Connection

Let’s ensure that the MQTT connection instance is active and successfully connected to the MQTT broker, and that the sensor uplinks are routed to the correct backend connection. We will use the TPX console health status and logger.

Step 4 - Install the MQTT Dashboard Application

In this activity, you will install an Android application called IoT MQTT Panel on your phone.

Step 5 - Customize the Mobile Phone Application

Customization of the mobile phone application involves two steps:

The first setting you need to configure in the application is to define broker connection settings. In this step, we will set up the MQTT Broker Service. The critical definition required is the MQTT Broker’s address and port number.

The application still requires more customization to display the data. Data is shown in panels, so you need to create a panel to display it.

Another critical point to remember is the “topic name” that the TPX connection is going to publish to the MQTT broker:

You may not have noticed that topic name when creating the TPX connection because we used the default topic name. But now that information will be used.

The device we use sends the data in the following format:

Which is decoded into JSON format by TPX, as shown below:

In order to show the humidity value, create a clone of the temperature panel.

Now, update the cloned temperature panel to show the humidity readings.

If you wish, you can use other types of panels to create views that suit your preferences.