Select Page

RUT240 Modbus

Summary #

Modbus is a serial communications protocol. Simple and robust, it has become a de facto standard communication protocol and is now a commonly available means of connecting industrial electronic devices. This chapter is an overview of the Modbus TCP functionality for RUT240 devices.

The information in this page is updated in accordance with the RUT2XX_R_00.01.12 firmware version.

Modbus TCP #

Modbus TCP provides users with the possibility to set or get system parameters. The Modbus daemon acts as slave device. That means it accepts connections from a master (client) and sends out a response or sets some system related parameter in accordance with the given query.

The figure below is an example of the Modbus TCP window section and the table below provides information on the fields contained in that window:

Rut2xx webui services modbus modbus tcp v1.png
FieldValueDescription
Enableyes | no; default: noneTurns Modbus TCP on or off.
Portinteger [0..65535]; default: noneTCP port used for Modbus communications.
Allow Remote Accessyes | no; default: noAllows remote Modbus connections by adding an exception to the device’s firewall on the port specified in the field above.
Mobile Traffic Usage Loggingyes | no; default: noEnables Mobile Traffic Usage Logging (can also be enabled from Status → Mobile Traffic → Configuration).
This is required in order to read mobile data usage information from Modbus registers.

Get Parameters #

Modbus parameters are held within registers. Each register contains 2 bytes of information. For simplification, the number of registers for storing numbers is 2 (4 bytes), while the number of registers for storing text information is 16 (32 bytes). The register numbers and corresponding system values are described in the table below:

Required ValueRegister NumberNumber Of RegistersRepresentation
System uptime1232 bit unsigned integer
Mobile signal strength (RSSI in dBm)3232 bit integer
System temperature (in 0.1 °C)5232 bit integer
System hostname716Text
GSM operator name2316Text
Router serial number3916Text
LAN MAC address5516Text
Router name7116Text
Currently active SIM card slot8716Text
Network registration info10316Text
Network type11916Text
Current WAN IP address1391632 bit unsigned integer
Data Usage Values*
Mobile data received today135232 bit integer
Mobile data sent today137232 bit integer
Mobile data received this week141232 bit integer
Mobile data sent this week143232 bit integer
Mobile data received this month145232 bit integer
Mobile data sent this month147232 bit integer
Mobile data received in the last 24 hours149232 bit integer
Mobile data sent in the last 24 hours151232 bit integer
Mobile data received in the last 7 days153232 bit integer
Mobile data sent in the last 7 days155232 bit integer
Mobile data received in the last 30 days157232 bit integer
Mobile data sent in the last 30 days159232 bit integer

* All received/sent data usage values are returned in kibibytes (KiB), which is an ISQ standard accepted by most major standard organizations.
1 kibibyte (KiB) = 210 bytes = 1024 bytes
1 mebibyte (MiB) = 210 kibibytes (KiB) = 220 bytes = 1 048 576 bytes

Set Parameters #

The Modbus daemon can also set some device parameters. These parameters and explanations on how to use them are described in the table below:

Value To SetRegister NumberRegister ValueDescription
Switch WiFi (ON/OFF*)2031 | 0Turns WiFi ON or OFF
Switch mobile data connection (ON/OFF*)2041 | 0Turns mobile data connection ON or OFF
Change APN207APN codeChanges APN.
The number of input registers may vary depending on the length of the APN, but the very first byte of the set APN command has to be specified as 1
Reboot2061Reboots the router

* All ON/OFF commands only accept 0 and 1 values, which represent the following:

  • 1 – ON
  • 0 – OFF

Modbus TCP Master #

A Modbus master device can request data from Modbus slaves. The Modbus TCP Master section is used to configure Modbus TCP slaves. To add a new slave, enter a custom name, slave’s ID, IP address and port and click the “Add” button: 

ButtonDescription
EditRedirects you to the slave’s configuration page (more information in section 3.1)
DeleteDeletes the slave configuration
AlarmsRedirects you to the slave’s alarm configuration page (more information in section 3.3)
CloneCreates an identical slave configuration

You can create a maximum of 10 slave configurations.

Slave device configuration #

The figure below is an example of the Slave device configuration and the table below provides information on the fields contained in that section:

Networking device manual modbus modbus tcp master slave device configuration v1.png
FieldValueDescription
Enabledyes | no; default: noTurns communication with the slave device on or off.
Namestring; default: noneSlave device’s name, used for easier management purposes.
Slave IDinteger [0..255]; default: noneSlave ID. Each slave in a network is assigned a unique identifier ranging from 1 to 255. When the master requests data from a slave, the first byte it sends is the Slave ID. When set to 0, the slave will respond to requests addressed to any ID.
IP addressip; default: noneSlave device’s IP address.
Portinteger [0..65535]; default: noneSlave device’s Modbus TCP port.
Periodinteger [1..6400]; default: noneInterval at which requests are sent to the slave device.
Timeoutinteger [1..30]; default: noneMaximum response wait time.

Requests configuration #

A Modbus request is a way of obtaining data from Modbus slaves. The master sends a request to a slave specifying the function code to be performed. The slave then sends the requested data back to the Modbus master. You can create a maximum of 64 request configurations for each slave device.

The figure below is an example of the Requests configuration section and the table below provides information contained in the fields of that section:

Networking device manual modbus modbus tcp master request configuration v1.png
FieldValueDescription
Namestring; default: Unnamed ParameterRequest name. Used for easier management purposes.
Data type8bit INT | 8bit UINT | 16bit INT, high byte first | 16bit INT, low byte first | 16bit UINT, high byte first | 16bit UINT, low byte first | 32bit float, Byte order 1,2,3,4 | 32bit float, Byte order 4,3,2,1 | 32bit float, Byte order 2,1,4,3 | 32bit float, Byte order 3,4,1,2; default: 16bit INT, high byte firstHow read data will be stored.
Function1 | 2 | 3 | 4 | 5 | 6 | 15 | 16; default: 3A function code specifies the type of register being addressed by a Modbus request. The codes represent these functions:
1 – read Coil Status2 – read Input Status3 – read Holding Registers4 – read Input Registers5 – force Single Coil6 – preset Single Register15 – force Multiple Coils16 – force Multiple Registers
First Registerinteger [0..65535]; default: 1First Modbus register from which data will be read.
Number of Registersinteger [1..2000]; default: noneNumber of Modbus registers that will be read during the request.
Enabledyes | no; default: noTurns the request on or off.
Test– (interactive button)Generates a Modbus request according to given parameters in order to test the request configuration. You must first save the configuration before you can use the Test button.
Delete– (interactive button)Deletes the request.
Add– (interactive button)Adds a new request configuration.

Modbus Data to Server #

The Modbus Data to Server function provides you with the possibility to set up senders that transfer data collected from Modbus slaves to remote servers. To add a new data sender, enter the server’s address, specify the data sending period and click the “Add” button:

Networking device manual modbus modbus data to server new modbus data sender v1.png

Data sender configuration #

When you add a new data sender, you will be redirected to its configuration window. The figure below is an example of that window and the table below provides information on the fields that it contains:

Networking device manual modbus modbus data to server data sender configuration v1.png
EnabledYes | No; Default: NoTurns The Data Sender ON Or OFF
Namestring; Default: noneData sender’s name. used for easier management purposes
ProtocolHTTP(S); Default: HTTP(S)Data sending protocol
JSON formatjson string; Default: {“ID”:”%i”, “TS”:”%t”,”ST”:”%s”,”VR”:”%a”}Provides the possibility to fully customize the JSON segment
Segment count1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10; Default: 1Max segment count in one JSON string sent to server
URLhost | ip; Default: noneAddress of the server to which the data will be sent. .
Important note: when using HTTPS, remember to add the https:// prefix before the URL
Periodinteger [1..6400]; Default: noneData sending frequency (in seconds)
Data filteringAll data | By slave ID | By slave IP; Default: All dataWhich data this sender will transfer to the server
Retry on failyes | no; Default: noSpecifies whether the data sender should retry failed attempts
Custom headerstring; Default: noAdds a custom header(s) to HTTP requests

Submit a Comment

Your email address will not be published. Required fields are marked *