subscribe to our Youtube


14455 questions

17168 answers


0 members

We are migrating to our new platform at Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
1,066 views 2 comments
by anonymous

Dear All,

I have a TRB145. I wish to send modbus write register commands to the device through MQTT to the device's Modbus Serial Master and Not Modbus TCP Master.
From local support I was told that in newer versions of firmware that should be possible, but I couldn't find specific guide.

I am currently on TRB1_R_00.02.05.1 Firmware.

Could anyone guide me further on this?


1 Answer

0 votes
by anonymous


The Modbus gateway Serial type allows redirecting TCP data coming to a specified port to RTU specified by the Slave ID. The Slave ID can be specified by the user or be obtained directly from the Modbus header In short them we provide internet access to the Modbus device for end client so he could get the data from the Modbus device.

I'd like to share configuration example:

Step1: Enable RS interface and set Modbus gateway type (Services > RS232/RS485). Listening IP - router's LAN IP address.

Step 2:  Enable Modbus TCP Master (Services > Modbus). IP address - router's LAN IP address.

Step 3: Enable MQTT gateway (Services > MQTT gateway). For example, we used MQTT broker:

Step 4: Use to send requests and get responses. Function format is:

• Cookie (number from 0 to 2^64-1

• IP type

o 0 means IPv4

o 1 means IPv6

o 2 means hostname

• Port

• Timeout (how long will be waiting for response). In seconds. from 1 to 999.

• Slave ID – indicates to which slave request is sent. From 1 to 255.

• Function.

o 3 means read registers

o 6 means write single register

o 16 means write multiple registers 6

• Number of first register - from 1 to 65536, from which will information will be read or written

• If function is 3

o Registry number (from 1 to 123, but number of first register. + number can’t go out of range)

• If function is 6

o Registry value (from 0 to 65535)

• If function is 16

o Registry number (from 0 to 123, but number of first register. + number can’t go out of range)

o Registry values separated by commas without spaces. Example.: 1,2,3,654,21,789. There has to be as many values, as specified number of registers, and each value must be between 0 and 65535.

▪ If number of registries is 0, there should be no registry values

For example, to read register 1 to 5 use this command:

0 65432 0 502 5 1 3 1 5

To set register 4 to value 1010 use this command format:

0 65432 0 502 5 1 6 4 1010

Kind regards.

Does the Modbus TCP Master exist on the TRB145 even though it has no LAN connection? Here, in the example, you use the IP Port 502 to reach Slave ID 1 in the MQTT request.

Is it necessary to consider that the IP Gateway is in a TRB145 ?
by anonymous

All TRB14X by default has a LAN IP address - You can check it on the Web UI page Network > Interfaces:

But of course you can use local host IP address instead of Then, when configuring according to my example, you need to change the ubiquitous to