Modbus TCP protocol
Modbus TCP is a variant of the Modbus protocol that uses the TCP/IP network (usually ethernet) for communication between devices. It is widely used in industrial settings for interfacing with meters, inverters, energy counters with RJ45 port. It allows reading and writing variables (registers) on connected devices.
The AL300 Gateway can act as a Modbus TCP master, querying slave devices connected to the Ethernet network.
Configuration
-
Choose the data source
Generic Modbus TCP
-
Enter the IP address of the modbus slave. You can test the network connection by pinging the device (using the
Pingbutton) and verify that the modbus slave is up and running (TCP port open) using theTCP connectbutton. To proceed, you need to have the documentation (register table) provided by the Modbus slave manufacturer.
-
Choose whether to use register (1-based) or address (0-based) numbering and set the byte order and, if necessary, word order (in the documentation they are indicated as
big endian/little endianorLSB (least significant byte)/MSB (most significant byte)).
-
Click on
Add variable. To import or modify the table massively, see bulk configuration. For each variable of interest, you can set:- Name and metadata (see here for more details)
- Topic. It can be:
- Info: connection information (device disconnected variable and read error variable)
- Holding registers: modbus functions 3 (read) and 6/16 (write)
- Input registers: modbus function 4 (read)
- Coils: modbus functions 1 (read) and 5/15 (write)
- Discrete inputs: modbus function 2 (read)
- Slave ID: identifier of the modbus slave to query. It is often ignored by TCP slaves, but in some cases (e.g. modbus TCP/Rs485 converters) it must be set correctly.
- Address/Register: It can be expressed in decimal or hexadecimal and can be indicated as address (0-based) or register (1-based) depending on the
Addressingsetting above the table. For each register, you need to set the correct encoding (data type). The available data types are:8bit_uint: unsigned integer of 8 bits16bit_uint: unsigned integer of 16 bits32bit_uint: unsigned integer of 32 bits64bit_uint: unsigned integer of 64 bits8bit_int: signed integer of 8 bits16bit_int: signed integer of 16 bits32bit_int: signed integer of 32 bits64bit_int: signed integer of 64 bits8bit_bsint: signed integer of 8 bits, most significant bit indicates the sign (0=positive, 1=negative)16bit_bsint: signed integer of 16 bits, most significant bit indicates the sign (0=positive, 1=negative)32bit_bsint: signed integer of 32 bits, most significant bit indicates the sign (0=positive, 1=negative)64bit_bsint: signed integer of 64 bits, most significant bit indicates the sign (0=positive, 1=negative)16bit_float: floating point number of 16 bits (half-precision)32bit_float: floating point number of 32 bits (single-precision)64bit_float: floating point number of 64 bits (double-precision)string: string of ASCII characters (you need to specify the length in characters)bits: array of bits (you need to specify the index from 0 to 15 of the bit within the register)
- Scale (see here for more details)
- Save to (see here for more details)

-
Perform a read test of the variable just created by clicking on the
Readbutton in the action column. If the reading is successful, the value read will be shown in the column.
-
Repeat steps 4 and 5 for all variables of interest, then click on
Nextto go to theMetadatatab. -
Here you can give a name and an optional description to the data source. You can also indicate where to insert the data source within the device hierarchy. In this way, you can organize devices into logical groups (e.g. departments, production lines, buildings, etc).

-
Click on
Save. Once the window is closed:- if you are using the local web interface, the changes have been successfully applied
- if you are operating through the cloud, the configuration has been saved and placed in a sending queue. Until the configuration is applied, a
yellow triangle will be shown at the top of the AL300 configuration page.
- if the AL300 is online, it is sent immediately to the AL300.
- if the AL300 is offline, it will be sent when the connection is re-established.