Community Edition
ThingsBoard Documentation
Cloud Professional Edition Community Edition Edge PE Edge IoT Gateway License Server Trendz Analytics Mobile Application PE Mobile Application
Try it now Pricing
Temperature upload over MQTT using Nettra RTU
Getting Started Documentation Guides Installation Architecture API FAQ

Temperature upload over MQTT using Nettra RTU

Table of contents

  1. Introduction
  2. Prerequisites
  3. Connection diagram
  4. ThingsBoard configuration
  5. Connect RTU-X to PC
  6. RTU-X configuration
  7. Data visualization

Introduction

This guide contains step-by-step instructions on how to connect your Nettra RTU device to ThingsBoard Community Edition through TCP/IP via wifi, using as sample, one of the many applications that the Nettra RTU has. At the end of this guide, you will be able to monitor data using Thingsboard web UI to display it.

Nettra RTU

Nettra RTU called “RTU-X” is a powerful IoT electronic device that has digital and analog inputs and outputs, as well as several integrated communication interfaces as modem, ethernet, bluetooth, 802.15.4, RS485, RS232 and GPS. It is an ideal product to implement monitoring, data acquisition and control applications over a distributed data network.

The RTU-X is easly configurable via a RTU-X Configuration Interface. To adapt the RTU-X to each application, it runs a fully customizable script, accessible and editable from the Configuration Interface. In this guide we will provide one as an example quite simple and easy to understand.

Once you complete this sample/tutorial, you will see your sensor data on a dashboard like the following on the right.

rtu_x dash2

Prerequisites

Hardware

  • 1x RTU-X
  • 1x 12VDC supply voltage

Software

Connection diagram

The following picture summarizes the connections for this simple project:

copy_941957077

ThingsBoard configuration

This step contains instructions that are necessary to connect your device to ThingsBoard.

Sign up ThingsBoard Web UI as live-demo. See Live Demo page for more details how to get your account.

Device

  1. Go to “Devices” section.
  2. Click on ”+” button and create a device with the name “RTU-X”. Set “Device type” to “default”.

    add_opt (1)

  3. Once the device is created, open its details and click “Copy access token”. Please save this device token. It will be referred to later as $RTU_DEMO_TOKEN.

    access_opt (3)

Dashboard

Download the dashboard file (.json) using this link. Use import/export instructions to import the dashboard to your ThingsBoard instance.

Connect RTU-X to PC

  • Download and install the latest version of RTU-X Configuration Interface.

  • Turn on the RTU-X.

  • Check your wifi network and connect to “RTU-X-**”.

  • Open the RTU-X Configuration Interface.

    1. Go to “Home”.
    2. Click on “TCP/IP”.
    3. Specify the “IP” address “192.168.4.1”, “Port”: “502” (by default).
    4. Click on “Connect”.

    rtu1_step1

  • Once you are connected you should see the following:

    rtu2_step

  • Then:
    1. Go to “Communications”.
    2. Go to “Wifi, Serial, Modbus”.
    3. Click “Station” and register the data for the WiFi network.
    4. “Apply Changes”

    rtu3_step3

  • Finally:
    1. Go back to “Home”.
    2. Copy the “IP” address on “WiFi STA information”.
    3. Disconnect from the RTU-X.
    4. Change the “IP” address and reconnect.

    rtu4_step4

RTU-X configuration

Once you have your RTU-X connected to the PC, we can proceed with its configuration.

MQTT

  1. Go to “Communications”.
  2. Click on “MQTT”.
  3. On “Interface” select “Modem”. On “Format” select “Thingsboard”. On “URI” paste “mqtt://demo.thingsboard.io:1883”. On “Password” paste the Device Acces Token from “Device” step.
  4. Click on “Apply Changes”.

rtu5_step5

Script

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
 * DESCRIPTION :
 *	- Sending a variable to a Thingsboard Dashboard
*/
// VARIABLES DEFINITION ------------------------------------------
// Attributes
shared uint tLog = 10;

// Loggable
telemetry float variable;

// SCRIPT -----------------------------------------------------------
while (1)
{
    variable = 15;
	
    delay_loop(tLog*1000); // 10 seconds
    log(variable);
}
  1. Go to “User Interface”
  2. Import the script clicking “Load”. If you want to make your own script, you can see the Nettra script user manual.
  3. Compile and save the script in the RTU-X by clicking “Compila & Apply”.

rtu6_step6

Data visualization

Finally, open ThingsBoard Web UI in the Live Demo server with same user and password as ThingsBoard configuration section.

Go to “Devices” section and locate “RTU-X Device”, open device details and switch to “Latest telemetry” tab. If all is configured correctly you should be able to see latest values of “variable” in the table.

dev

After, open “Dashboards” section then locate and open “RTU-X” dashboard. As a result, you will see an analog gauge (similar to dashboard image in the introduction).

dash

See also

Browse other samples or explore guides related to main ThingsBoard features: