Visualizing TTN Device Data with WolkAbout IoT Platform

Visualizing TTN Device Data with WolkAbout IoT Platform © Apache-2.0

Display device data with style by integrating The Things Network and WolkAbout IoT Platform.

  • 1,311 views
  • 6 comments
  • 13 respects

Components and supplies

Necessary tools and machines

09507 01
Soldering iron (generic)

Apps and online services

About this project

The LoRaWAN protocol continues to grow through The Things Network, creating an expanding community network worldwide. WolkAbout has created a way to integrate its WolkAbout IoT Platform with The Things Network, providing a way to visualize device data and generate real-time analytics.

We used some hardware we had handy and made an example that publishes temperature readings to TTN. Check out the source code and instructions on this GitHub repository. Use whatever hardware available, the important part is that you can access the Device EUI of your device.

Log into your TTN account and open the console to add a new application. Enter an Application ID and a Description for the application and click Add application.

Go to https://demo.wolkabout.com/#/get-started and register or log in with your existing account. Next, select Settings from the navigational menu and select LORA TTN Integration tab.

Here you will need to enter some information about your TTN application. Enter the Application ID, Application EUI and Access key. Click Generate token, copy the value and click Save.

Switch over to your TTN application and navigate to Integrations tab to add an HTTP Integration.

Enter a Process ID and select an Access Key, and for URL use:

https://api-demo.wolkabout.com/api/incomingLora/readings

Enter the value you got when you clicked on Generate token into the Authorization field and click Add integration.

Now that TTN and WolkAbout IoT Platform have a way to communicate, let's register a device on TTN through WolkAbout IoT Platform. Select Devices from the navigational menu and change to the Device template tab. Click the + button and select the option to create a template From scratch.

Enter a Device template name and optionally a Description. Leave Device type on Standard and for Connectivity Type select LoRa TTN. For Protocol select JsonMultiReferenceProtocol.

Our example has a single temperature sensor so we will define it in the template like so

Now we can Save our template and click Create device. Here enter a Device name and insert your Device key (Device EUI). Select Create semantic group for this device checkbox and click Save.

You will get a message about a successful device creation and if you switch over to TTN, you should see a newly registered device with the Device ID you chose. At the bottom of the device page there is a section Example Code that contains credentials used to register your device on TTN.

Copy them into your sketch and upload to your device. The device should now be sending data, but we need to interpret it first by setting up Payload Formats. Go to the Payload Formats tab on your TTN application and enter the following snippet as the decoder:

function Decoder(bytes, port) {
 // Decode an uplink message from a buffer
 // (array) of bytes to an object of fields.
 var decoded = {};
 var type = bytes[0];
 switch (type) {
   case 1:
     decoded.T = bytes[1] + bytes[2]/100;
     break;
   default:
     decoded.T = bytes[0];
 }
 return decoded;
} 

The first byte determines our self-defined device type to distinguish different devices. The second byte contains the whole number of the temperature reading and the third byte contains the decimal part of the temperature value.

Test the payload by entering for example 01112B. The output will be

{
 "T": 17.43
}

And that is exactly the format WolkAbout IoT Platform is expecting to receive. Save these changes and switch over to WolkAbout IoT Platform so we can create a way to meaningfully display this data. Choose Dashboards from the navigational menu and click + to add a new dashboard.

Enter a Dashboard name and click Save. Now click + and add a new card widget like so

And you are now displaying the formatted data being sent from your device through TTN.

Let's take it a step further and make a report for our device data, choose Reports from the navigational menu and add a new report. Enter the name of the report and choose Temperature for type and click Next step.

Here select the Temperature sensor from your device and click Save.

You are now able to monitor how your device data changed over time.

We will also create a rule using WolkAbout IoT Platform's Rule engine to notify us by email if the value of the temperature reading goes below a certain threshold.

Select Rules from the navigational menu and add a new rule.

Enter a Rule name and Description and change Rule status to ON.

Add a semantic group of your device and select the Temperature feed and click Save.

Let's say we want to check if Value is lower than or equal to a Static value of 15.

Click plus button within Then and for Action type select Send e-mail, then select your email from the user list. Enter a Subject and Body of the e-mail.

Finally, click Save and we can test the rule switching over to the device on TTN and simulating uplink with a value like 010C11 that should trigger our rule and send us an e-mail.

This is a simple tutorial how to easily connect your LoRa device to the cloud using The Things Network and WolkAbout IoT Platform. Feel free to explore additional WolkAbout IoT Platform features such as alarms, configurations and so on. You can mix and match WolkAbout IoT Platform features that best suit your use case. To find our more about WolkAbout IoT Platform and its features visit our website.

Code

Arduino Uno LoRa Temperature sensor example

Comments

Similar projects you might like

Arduino IoT with SAP HANA Cloud Platform

by derapados

  • 5,756 views
  • 11 comments
  • 8 respects

Android App-Based Home Automation System Using IOT

Project tutorial by Team Autoshack

  • 24,825 views
  • 17 comments
  • 75 respects

Solar Tracker with Live Data Feed - Windows IoT

Project tutorial by Jed Hodson

  • 10,088 views
  • 1 comment
  • 18 respects

IoT Blink - Getting started with IoT

Project showcase by AppShed Support

  • 2,028 views
  • 0 comments
  • 11 respects
Add projectSign up / Login