Table of contents
- Introduction
- Prerequisites
- Connection diagram
- ThingsBoard configuration
- Connect RTU-X to PC
- RTU-X configuration
- 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.
Prerequisites
Hardware
- 1x RTU-X
- 1x 12VDC supply voltage
Software
- RTU-X Configuration Interface.
- You will need to have ThingsBoard server up and running. Use either Live Demo or Installation Guide to install ThingsBoard.
Connection diagram
The following picture summarizes the connections for this simple project:
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
- Go to “Devices” section.
- Click on ”+” button and create a device with the name “RTU-X”. Set “Device type” to “default”.
- 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.
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.
- Go to “Home”.
- Click on “TCP/IP”.
- Specify the “IP” address “192.168.4.1”, “Port”: “502” (by default).
- Click on “Connect”.
-
Once you are connected you should see the following:
- Then:
- Go to “Communications”.
- Go to “Wifi, Serial, Modbus”.
- Click “Station” and register the data for the WiFi network.
- “Apply Changes”
- Finally:
- Go back to “Home”.
- Copy the “IP” address on “WiFi STA information”.
- Disconnect from the RTU-X.
- Change the “IP” address and reconnect.
RTU-X configuration
Once you have your RTU-X connected to the PC, we can proceed with its configuration.
MQTT
- Go to “Communications”.
- Click on “MQTT”.
- 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.
- Click on “Apply Changes”.
Script
- Download this 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);
}
- Go to “User Interface”
- Import the script clicking “Load”. If you want to make your own script, you can see the Nettra script user manual.
- Compile and save the script in the RTU-X by clicking “Compila & Apply”.
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.
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).
See also
Browse other samples or explore guides related to main ThingsBoard features:
- Device attributes - how to use device attributes.
- Data Visualization - how to visualize collected data.
- Data Analytics - how to collect telemetry data.
- Rule Engine - how to use rule engine to analyze data from devices.
- Using RPC capabilities - how to send commands to/from devices.