RUT955 Modbus

From Wiki Knowledge Base | Teltonika
This is the approved revision of this page, as well as being the most recent.
Main Page > Network products > RUT955 > RUT955 Manual > RUT955 WebUI > RUT955 Modbus

Summary[edit | edit source]

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 RUT955 devices.

Modbus TCP[edit | edit source]

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:

Networking rut9xx manual modbus modbus tcp v1.png

Field Value Description
Enable yes | no; Default: none Turns Modbus TCP on or off.
Port integer [0..65535]; default: 502 TCP port used for Modbus communications.
Device ID integer [0..255]; default: 1 The device's Modbus slave ID. When set to 0, it will respond to requests addressed to any ID.
Allow Remote Access yes | no; default: no Allows remote Modbus connections by adding an exception to the device's firewall on the port specified in the field above.
Enable custom register block yes | no; default: no Allow custom register block

Get Parameters[edit | edit source]


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 value register address number of registers representation
System uptime 1 2 32 bit unsigned integer
Mobile signal strength (RSSI in dBm) 3 2 32 bit integer
System temperature (in 0.1 °C) 5 2 32 bit integer
System hostname 7 16 Text
GSM operator name 23 16 Text
Router serial number 39 16 Text
LAN MAC address 55 16 Text
Router name 71 16 Text
Currently active SIM card slot 87 16 Text
Network registration info 103 16 Text
Network type 119 16 Text
Digital input (DIN1) state 135 2 32 bit integer
Digital galvanically isolated input (DIN2) state 137 2 32 bit integer
Current WAN IP address 139 2 32 bit unsigned integer
Analog input value 141 2 32 bit integer
GPS latitude coordinate 143 2 32 bit float
GPS longitude coordinate 145 2 32 bit float
GPS fix time 147 16 Text (Unix timestamp×1000)
GPS date and time 163 16 Text (DDMMYYhhmmss)
GPS speed 179 2 32 bit integer
GPS satellite count 181 2 32 bit integer
GPS accuracy 183 2 32 bit float

Set Parameters[edit | edit source]


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 set register address register value description
Digital output 1 (DOUT1) (ON/OFF*) 201 1 | 0 Changes the state of the open collector (OC) output
Digital output 2 (DOUT2) (ON/OFF*) 202 1 | 0 Changes the state of the relay output
Switch WiFi (ON/OFF*) 203 1 | 0 Turns WiFi ON or OFF
Switch mobile data connection (ON/OFF*) 204 1 | 0 Turns mobile data connection ON or OFF
Switch SIM card 205 1 | 2 | 0 Changes the active SIM card slot
  • 1 - switch to SIM1
  • 2 - switch to SIM2
  • 0 - switch from the the SIM card opposite of the one currently in use (SIM1 → SIM2 or SIM2 → SIM1
Reboot 206 1 Reboots the router
Change APN 207 APN code Changes 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 denotes the number of the SIM card for which to set the APN. This byte should be set to:
  • 1 - to set APN for SIM1
  • 2 - to set APN for SIM2

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

  • 1 - ON
  • 0 - OFF

Modbus TCP Master[edit | edit source]

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: Networking device manual modbus modbus tcp master new slave device v1.png

Button Description
Edit Redirects you to the slave's configuration page (more information in section 3.1)
Delete Deletes the slave configuration
Alarms Redirects you to the slave's alarm configuration page (more information in section 3.3)
Clone Creates an identical slave configuration

You can create a maximum of 10 slave configurations.

Slave device configuration[edit | edit source]


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

Field Value Description
Enabled yes | no; default: no Turns communication with the slave device on or off.
Name string; default: none Slave device's name, used for easier management purposes.
Slave ID integer [0..255]; default: none Slave 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 address ip; default: none Slave device's IP address.
Port integer [0..65535]; default: none Slave device's Modbus TCP port.
Period integer [1..6400]; default: none Interval at which requests are sent to the slave device.
Timeout integer [1..30]; default: none Maximum response wait time.

Requests configuration[edit | edit source]


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

Field Value Description
Name string; default: Unnamed Parameter Request name. Used for easier management purposes.
Data type 8bit 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 first How read data will be stored.
Function 1 | 2 | 3 | 4 | 5 | 6 | 15 | 16; default: 3 A function code specifies the type of register being addressed by a Modbus request. The codes represent these functions:
  • 1 - read Coil Status
  • 2 - read Input Status
  • 3 - read Holding Registers
  • 4 - read Input Registers
  • 5 - force Single Coil
  • 6 - preset Single Register
  • 15 - force Multiple Coils
  • 16 - force Multiple Registers
First Register integer [0..65535]; default: 1 First Modbus register from which data will be read.
Number of Registers integer [1..2000]; default: none Number of Modbus registers that will be read during the request.
Enabled yes | no; default: no Turns 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.

Alarm configuration[edit | edit source]


Alarms are a way of setting up automated actions when some Modbus values meet user specified conditions. The figure below is an example of the Alarm configuration page and the table below provides information on fields that it contains:

Networking device manual modbus modbus tcp master alarm configuration v1.png

Field Value Description
Enabled yes | no; default: no Turns the alarm on or off
Function code Read Coil Status (1) | Read Input Status (2) | Read Holding Registers (3) | Read Input Registers (4); default: Read Coil Status (1) Modbus function used in Modbus request.
Register integer [0..65535]; default: none Number of the Modbus coil/input/holding register/input register that will be read.
Condition More than | Less than | Equal to | Not Equal to; default: Equal to When a value is obtained it will be compared against the value specified in the following field. The comparison will be made in accordance with the condition specified in this field.
Value various; default: none The value against which the read data will be compared.
Action SMS | Trigger output | Modbus Request; default: SMS Action that will be taken if the condition is met. Possible actions:
  • SMS - sends and SMS message to a specified recipient(s).
  • Trigger output - changes the state of a specified output(s).
  • Modbus Request - sends a Modbus request to a specified slave.
SMS: Message string; default: none SMS message text.
SMS: Phone number phone number; default: none Recipient's phone number.
Trigger output: Output Open collector output | Relay output | Both; default: Open collector output Which output(s) will be triggered.
Trigger output: I/O Action Turn On | Turn Off | Invert; default: Turn On Action that will taken on the specified output.
Modbus Request: IP address ip | host; default: none Modbus slave's IP address.
Modbus Request: Port integer [0..65535]; default: none Modbus slave's port.
Modbus Request: Timeout integer [1..30]; default: 5 Maximum time to wait for a response.
Modbus Request: ID integer [1..255]; default: none Modbus slave ID.
Modbus Request: Modbus function Read Coil Status (1) | Read Input Status (2) | Read Holding Registers (3) | Read Input Registers (4) | Force Single Coil (5) | Preset Single Register (6) | Force Multiple Coils (15) | Force Multiple Registers (16); default: Force Single Coil (5) A function code specifies the type of register being addressed by a Modbus request.
Modbus Request: First register integer [0..65535]; default: none Begins reading from the register specified in this field.
Modbus Request: Number of registers integer [0..65535]; default: none The number of registers that will be read from the first register.

Modbus Serial Master[edit | edit source]

The Modbus Serial Master page is used to configure the router as a Modbus RTU master. Modbus RTU (remote terminal unit) is a serial communication protocol mainly used in communication via RS232 or RS485 serial interfaces.

RS232[edit | edit source]


This section is used to configure the Modbus RTU master's RS232 serial interface settings. Refer to the figure and table below for information on RS232 configuration.

Networking rutxxx manual modbus modbus serial master rs232 configuration v1.png

Field Value Description
Enabled yes | no; default: no Turns Modbus RTU via RS232 on or off.
Baud rate 300 | 1200 | 2400 | 4800 | 9600 | 19200 | 38400 | 57600 | 115200; default: 19200 Serial data transmission rate (in bits per second).
Data bits 5 | 6 | 7 | 8; default: 8 Number of data bits for each character.
Parity None | Even | Odd; default: Even In serial transmission, parity is a method of detecting errors. An extra data bit is sent with each data character, arranged so that the number of 1 bits in each character, including the parity bit, is always odd or always even. If a byte is received with the wrong number of 1s, then it must have been corrupted. However, an even number of errors can pass the parity check.
  • None (N) - no parity method is used.
  • Odd (O) - the parity bit is set so that the number of "logical ones (1s)" has to be odd.
  • Even (E) - the parity bit is set so that the number of "logical ones (1s)" has to be even.
Stop bits 1 | 2; default: 1 Stop bits sent at the end of every character allow the receiving signal hardware to detect the end of a character and to resynchronise with the character stream. Electronic devices usually use one stop bit. Two stop bits are required if slow electromechanical devices are used.
Flow control None | RTS/CTS | Xon/Xoff; default: None In many circumstances a transmitter might be able to send data faster than the receiver is able to process it. To cope with this, serial lines often incorporate a "handshaking" method, usually distinguished between hardware and software handshaking.
  • RTS/CTS - hardware handshaking. RTS and CTS are turned OFF and ON from alternate ends to control data flow, for instance when a buffer is almost full.
  • Xon/Xoff - software handshaking. The Xon and Xoff characters are sent by the receiver to the sender to control when the sender will send data, i.e., these characters go in the opposite direction to the data being sent. The circuit starts in the "sending allowed" state. When the receiver's buffers approach capacity, the receiver sends the Xoff character to tell the sender to stop sending data. Later, after the receiver has emptied its buffers, it sends an Xon character to tell the sender to resume transmission.

RS485[edit | edit source]


This section is used to configure the Modbus RTU master's RS485 serial interface settings. Refer to the figure and table below for information on RS485 configuration.

Networking rutxxx manual modbus modbus serial master rs485 configuration v1.png

Field Value Description
Enabled yes | no; default: no Turns Modbus RTU via RS485 on or off.
Baud rate 300 | 1200 | 2400 | 4800 | 9600 | 19200 | 38400 | 57600 | 115200; default: 19200 Serial data transmission rate (in bits per second).
Data bits 5 | 6 | 7 | 8; default: 8 Number of data bits for each character.
Parity None | Even | Odd; default: Even In serial transmission, parity is a method of detecting errors. An extra data bit is sent with each data character, arranged so that the number of 1 bits in each character, including the parity bit, is always odd or always even. If a byte is received with the wrong number of 1s, then it must have been corrupted. However, an even number of errors can pass the parity check.
  • None (N) - no parity method is used.
  • Odd (O) - the parity bit is set so that the number of "logical ones (1s)" has to be odd.
  • Even (E) - the parity bit is set so that the number of "logical ones (1s)" has to be even.
Stop bits 1 | 2; default: 1 Stop bits sent at the end of every character allow the receiving signal hardware to detect the end of a character and to resynchronise with the character stream. Electronic devices usually use one stop bit. Two stop bits are required if slow electromechanical devices are used.
Flow control None | RTS/CTS | Xon/Xoff; default: None In many circumstances a transmitter might be able to send data faster than the receiver is able to process it. To cope with this, serial lines often incorporate a "handshaking" method, usually distinguished between hardware and software handshaking.
  • RTS/CTS - hardware handshaking. RTS and CTS are turned OFF and ON from alternate ends to control data flow, for instance when a buffer is almost full.
  • Xon/Xoff - software handshaking. The Xon and Xoff characters are sent by the receiver to the sender to control when the sender will send data, i.e., these characters go in the opposite direction to the data being sent. The circuit starts in the "sending allowed" state. When the receiver's buffers approach capacity, the receiver sends the Xoff character to tell the sender to stop sending data. Later, after the receiver has emptied its buffers, it sends an Xon character to tell the sender to resume transmission.

Slaves[edit | edit source]


The Slaves section is used to configure new Modbus slave devices. A Modbus slave is an entity that can be called upon by a Modbus master in order to obtain some type of information from it.

To create a new Modbus slave, enter a custom name for it and click the 'Add' button. Then click the 'Edit' button next to the slave in order to enter its configuration window.

Slave settings[edit | edit source]


The Settings section is used to configure the main parameters of the Modbus slave. Refer to the figure and table below for additional information.

Networking rutxxx manual modbus modbus serial master slave settings v1.png

Field Value Description
Enabled yes | no; default: no Turns the slave on or off.
Slave ID integer [1..255]; default: 1 Slave 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.
Period integer [1..9999]; default: 10 Interval (in minutes) at which requests are sent to the slave device.

Slave requests[edit | edit source]


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.

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 rutxxx manual modbus modbus serial master slave request configuration v1.png

Field Value Description
Enabled yes | no; default: no Turns the request on or off.
Function Read Coil | Read Discrete Input | Read Holding Registers | Read Input Registers; default: Read Holding Registers Modbus function used in Modbus request.
First Register integer [1..65536]; default: 1 First Modbus register from which data will be read.
Number of Registers integer [1..2000]; default: none Number of Modbus registers that will be read during the request/

Slave alarms[edit | edit source]


Alarms are a way of setting up automated actions when some Modbus values meet user specified conditions. The figure below is an example of the Alarm configuration page and the table below provides information on fields that it contains:

Networking rutxxx manual modbus modbus serial master slave alarm configuration v1.png

Field Value Description
Enabled yes | no; default: no Turns the alarm on or off.
Function Read Coil | Read Discrete Input | Read Holding Registers | Read Input Registers; default: Read Holding Registers Modbus function used in Modbus request.
Register integer [1..65536]; default: 1 Number of the Modbus coil/input/holding register/input register that will be read.
Condition More than | Less than | Equal to | Not equal to; default: More than When a value is obtained it will be compared against the value specified in the following field. The comparison will be made in accordance with the condition specified in this field.
Value integer [0..65535]; default: 0 The value against which the read data will be compared.
Action SMS | Trigger output | Modbus request; default: SMS Action that will be taken if the condition is met. Possible actions:
  • SMS - sends and SMS message to a specified recipient(s).
  • Trigger output - changes the state of a specified output(s).
  • Modbus Request - sends a Modbus request to a specified slave.

Modbus Data to Server[edit | edit source]

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[edit | edit source]


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

Enabled yes | no; Default: no Turns the data sender ON or OFF
Name string; Default: none Data sender's name. used for easier management purposes
Protocol HTTP(S); Default: HTTP(S) Data sending protocol
JSON format json string; Default: {"ID":"%i", "TS":"%t","ST":"%s","VR":"%a"} Provides the possibility to fully customize the JSON segment
Segment count 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10; Default: 1 Max segment count in one JSON string sent to server
URL host | ip; Default: none Address of the server to which the data will be sent. .
Important note: when using HTTPS, remember to add the https:// prefix before the URL
Period integer [1..6400]; Default: none Data sending frequency (in seconds)
Data filtering All data | By slave ID | By slave IP; Default: All data Which data this sender will transfer to the server
Retry on fail yes | no; Default: no Specifies whether the data sender should retry failed attempts
Custom header string; Default: no Adds a custom header(s) to HTTP requests

See also[edit | edit source]