RUT145: Modbus TCP Client and MQTT Modbus Gateway both through Modbus TCP over Serial Gateway on one RS485 port – Question
We are setting up a RUT145 on RutOS 7.24.x as the bridge between a PLC and a cloud MQTT broker. The PLC is a Modbus RTU slave, ID 1, at 57600 8N1, on the RS485 port. We need to poll it every 5 seconds and also write single registers and coils on demand from MQTT.
We understand that only one service can use the RS485 port at a time, so we cannot run the Modbus Serial Client and the serial gateway of the MQTT Modbus Gateway together. Our plan uses Modbus TCP inside the router instead:
1. Modbus TCP over Serial Gateway on RS485, listening on 127.0.0.1 port 502. It is the only service on the serial port.
2. Modbus TCP Client polling 127.0.0.1 port 502 every 5 seconds with three requests: 100 holding registers, 50 holding registers and 256 coils. Data to Server publishes the results to the router’s own MQTT broker.
3. MQTT Modbus Gateway, ASCII format, sending writes through the same gateway with Modbus TCP requests such as: 0 2 0 127.0.0.1 502 5 1 6 63 24
4. The local broker bridged to the cloud broker over TLS.
Questions:
1. Is this combination supported on the RUT145? Can the Modbus TCP Client and the MQTT Modbus Gateway both use the router’s own Modbus TCP over Serial Gateway at the same time?
2. Can the serial gateway listen on 127.0.0.1, or must it listen on the LAN address?
3. If a write request arrives while a poll is in progress, does the gateway queue it, or can two requests collide on the serial line?
4. In the ASCII format, is this the correct request to set one coil with function 15 (count 1, then value 1): 0 3 0 127.0.0.1 502 5 1 15 4297 1 1
5. Is function 5 also supported in the ASCII format?
6. We will later add a second slave, ID 2, on the same RS485 line. With Server ID configuration type set to Obtained from TCP and permitted IDs 1-2, will both services reach both slaves?
7. Is there a size limit on one Data to Server MQTT message? Our largest holds 100 register values.
This is a lot of questions. I appreciate any answers, Thanks!
Read more here: Source link
