Modbus RTU protocol
Modbus RS485 (also commonly called Modbus RTU) is a widely used serial communication protocol in industrial settings, especially for interfacing with meters, inverters, energy counters, and other automation devices. The RS485 bus allows multiple devices (up to 32) to be connected on a single serial line, using a daisy-chain connection capable of covering long distances. It allows reading and writing variables (registers) on connected devices.
The AL300 Gateway can act as a Modbus master, querying slave devices connected to the RS485 bus.
Physical connection
AL300 has two independent RS485 ports, allowing it to behave as a Modbus master and query Modbus slave devices.

Port 1:
- A1
- B1
- GND
Port 2:
- A2
- B2
- GND
Configuration
-
Choose the data source
Generic Modbus RTU
-
Select the serial port to use (1 or 2) and the id of the Modbus slave to query. To modify the serial port parameters (Baudrate, parity, stop bits) see here. 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)
- 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.