In the communications window, in the tab "Wifi, Serial and Modbus" you can configure the parameters related to the wifi interface.
Here you can select the operating mode from the following options:
The RTU-X allows the possibility of being in Access Point and Station mode at the same time.
In the communications window, in the tab "Wifi, Serial and Modbus" you can configure the parameters related to the RS-485 serial interfaces.
The RS-485 serial interfaces are optional expansion modules. For each interface, speed and parity can be configured.
In the communications window, in the tab "Wifi, Serial and Modbus" you can configure the parameters related to Modbus.
The parameters are:
In the communications window, in the tab "Modem, Bluetooth, NTP" you can configure the parameters related to the modem. The modem is an optional module.
The parameters that can be configured are:
By default the RTU-X has BLE 4.2 connectivity that can be used to connect to the device from the configuration software and also to act as a master of other BLE devices, such as temperature and humidity sensors.
In the communications window, in the tab "Modem, Bluetooth, NTP" you can configure the parameters related to Bluetooth.
You must select the name of the device (it will be the name advertised by the RTU-X) and the security pin, which will be requested when connecting.
In the communications window, in the tab "Modem, Bluetooth, NTP" you can configure the configuration of an NTP server for time synchronization.
You must select:
The MQTT protocol is a communications protocol over TCP/IP that has been adopted as one of the most widely used standards for IoT devices.
The RTU-X uses MQTT to send the log records to a server in the cloud, but it is also used to perform other more complex functions when the RTU-X is connected to Thingsboard; such as updating all settings, synchronizing shared variables, or sending RPC commands.
The parameters to configure for the MQTT connection are the following:
For the Thingsboard format option, you only need to configure the URI, user (token) that uniquely identifies the device on the platform and certificate (in case of using mqtts). All other parameters are set automatically.
When using the Telemetry + instance of Nettra, you must select the Thingsboard format and fill in only the user (token) that will be provided by Nettra. The URI and certificate are the values that are loaded by default when selecting Thingsboard.
To send variables through MQTT you can use the log and report functions from the script. Both functions can be used with variables of type telemetry or attribute.
When Thingsboard is selected as the format for the MQTT connection, the RTU-X implements additional functionalities in addition to sending the log by MQTT.
These functionalities are described below.
When a variable in the script is defined with the prefix shared, the value of the variable is synchronized with the value of the shared attribute in Thingsboard with the same name if it exists.
This is achieved without the user having to do anything special because when establishing the MQTT connection, the RTU-X automatically subscribes to the topics.
The RTU-X automatically publishes a list of useful internal variables to the server.
The following variables are published every time the connection is established with the MQTT server:
Variable | Detalle |
model | RTU-X model (DIN or IP68) and hardware version |
mac_wifi | MAC address of the Wi-Fi module. |
ext1 | Information of the module connected in the extension socket 1. |
ext2 | Information of the module connected in the extension socket 2. |
modem_imei | Modem IMEI (if a modem is present in the communication socket). |
modem_imsi | IMSI of the SIM (if a modem is present in the communication socket). |
The following variables are published periodically every 10 minutes:
Variable | Detalle |
battery | Battery percentage. |
battery_status | Working status of the RTU-X related to battery. It can be Charged, Charging or No power. |
internal_temperature | Internal temperature of the RTU-X |
modem_signal | Modem signal level in dBm. |
wifi_signal | Wi-Fi signal level in dBm. |
The following table describes the JSON format used to publish telemetry via MQTT for each possible format.
Format | Telemetry type variable |
JSON and Thingsboard |
where XXX is the timestamp in UTC in unix format in milliseconds of the records |
Ultralight 2.0 |
where TTT is the timestamp in UTC in ISO8601 format |
Predix |
|
All log records created with the same date / time are sent in the same MQTT package.
If the connection is lost, all records are stored in the log and sent when the connection is re-established.
Format | Variable attribute |
JSON y Thingsboard |
|
Ultralight 2.0 |
|
Predix |
|
RPC stands for “Remote Procedure Call” and is used to send commands and queries from the Thingsboard server to the RTU-X. In the following, the available RPC commands are described.
Function | Description | Command | Response |
set | Modify a telemetry, attribute or shared variable |
where NAME is the name of the variable and VALUE the value |
|
get | Query a telemetry, attribute or shared variable |
where NAME is the name of the variable |
|
resend_log | Resends the last N log registers |
where N is the number of log registers to resend |
OK |
unixtime | Sets the RTU-X time in GMT-0. T represents the current timestamp in Unix format. |
|
|
localtime | Sets the local time of the RTU-X using the year, month, day, hour, minute, and second of the current moment. |
|
|
timezone | Sets the timezone of the RTU-X |
where t is the new time zone |
OK |
reset | Resets de RTU-X |
|
None |
calendarEvents |
Defines calendar events that assign values to the calendar variables declared in the script. When |
|
None |
Function | Description | Command | Response |
set | Modifies a variable of type telemetry, attribute, or shared, where NAME is the variable name and VALUE is its value. |
|
|
get | Queries a telemetry, attribute, or shared variable, where NAME is the variable name. |
|
|
resend_log | Requests the retransmission of the last N records stored in the event log. |
|
|
unixtime | Sets the RTU-X time in GMT-0. T represents the current timestamp in Unix format. |
|
|
localtime | Sets the local time of the RTU-X using the year, month, day, hour, minute, and second of the current moment. |
|
|
timezone | Sets the timezone of the RTU-X, where N is the new time zone. |
|
|
reset | Resets the RTU-X |
|
None |
Function | Description | Command | Response |
set | Modifies a variable of type telemetry, attribute, or shared, where NAME is the variable name and VALUE is its value |
|
|
get | Queries a telemetry, attribute, or shared variable, where NAME is the variable name. |
|
|
resend_log | Requests the retransmission of the last N records stored in the event log. |
|
|
unixtime | Sets the RTU-X time in GMT-0. T represents the current timestamp in Unix format. |
|
|
localtime | Sets the local time of the RTU-X using the year, month, day, hour, minute, and second of the current moment. |
|
|
timezone | Sets the timezone of the RTU-X, where N is the new time zone. |
|
|
reset | Resets the RTU-X |
|
None |
The RTU-X can connect to a LoRaWAN network. To do this, a RAK3172 module must be installed in the WAN socket, to which an external antenna can be connected.
This is the normal operating mode when the RTU-X is always on and connected to a stable power source.
If this option is disabled, it is possible to control the module’s power on/off state from the script using the modem_on variable.
It is possible to select between US915 and AU915 bands.
Sub-bands enable groups of eight consecutive channels.
That is, sub-band 1 enables channels 0–7, sub-band 2 enables channels 8–15, and so on.
It is possible to select between OTAA and ABP.
Depending on the power-consumption constraints of the solution, you can select between Class A and Class C.
Allows you to select the data rate to use according to the chosen band.
Enables or disables this feature.
Enables or disables the sending of messages that request confirmation.
The keys and addresses required to establish a connection with a LoRaWAN network (AppEUI, AppKey in OTAA mode, and DevAddr, NwksKey, AppsKey in ABP) must be defined by the user.
The DevEUI of the device is the one defined by the module manufacturer and can be obtained on the main tab when the module is enabled.
As with MQTT, when using LoRaWAN there are mechanisms for exchanging data with an IoT platform.
To differentiate between data types and commands, several ports are used, as shown in the following table.
Puerto | Descripción |
100 | It is used for publishing data stored in the event log when the log and report functions are executed in the script. |
101 | It is used to publish client attributes, that is, the variables declared as attribute in the script. |
102 | It is used to receive shared attribute values. |
103 | It is used to request the update of shared attributes. |
104 | It is used for the implementation of RPC commands and their corresponding responses. |
Since the names of the variables being transmitted are user-defined in the RTU-X script (variables of type telemetry), it is necessary to include both the variable names and their values in the transmission. Therefore, to send and receive data while minimizing overhead, a variant of the Ultralight format is used.
In all data packets containing more than one element, those elements are separated by the “|” character.
For example, attributes are reported as name|value.
When the log or report statement is executed in the script using variables of type telemetry, the values are stored in the RTU-X event log.
If a connection with a gateway is established, the data is transmitted immediately using a payload with the following format:
ts|key1|value1|key2|value2|...|keyN|valueN
Here, ts is the Unix timestamp corresponding to the moment when the log statement was executed.
keyN and valueN represent the name and value of each reported variable, respectively.
If the log statement is used with attribute variables, the same format is applied but without a timestamp.
key1|value1|key2|value2|...|keyN|valueN
It is possible to execute RPC commands via LoRaWAN. The following table shows the implemented commands.
Function | Description | Command | Response |
set | Modifies a variable of type telemetry, attribute, or shared, where NAME is the variable name and VALUE is its value |
|
|
get | Queries a telemetry, attribute, or shared variable, where NAME is the variable name. |
|
|
resend_log | Requests the retransmission of the last N records stored in the event log. |
|
|
unixtime | Sets the RTU-X time in GMT-0. T represents the current timestamp in Unix format. This is only applicable if the device is configured as Class C. |
|
|
localtime | Define la hora local del RTU-X a partir de año, mes, día, horas, minutos y segundos del instante actual. This is only applicable if the device is configured as Class C. |
|
|
timezone | Sets the local time of the RTU-X using the year, month, day, hour, minute, and second of the current moment. |
|
|
reset | Resets the RTU-X. |
|
Sin respuesta |
(*) solo tiene sentido su utilización si se configura operación en clase C.
Below is a Node-Red flow used to test data transmission and reception.
In this setup, an HTTP node is used to execute a POST method that places data into the sending queue for the device connected via LoRaWAN.
For the flow to work correctly, it is necessary to configure the RTU-X DevEUI. The RTU-X must also be registered on the gateway so that incoming data is routed into the flow. Additionally, you must configure the gateway’s IP address and the correct credentials to obtain the JWT token required for the HTTP POST request to function properly.