I am having trouble establishing a healthy communications link with a Node-Red Modbus Slave.
Context:
I have created a Node-Red Modbus Slave on Laptop A, with the intent that it can be polled by a separate Modbus Master running on Laptop B (or other Modbus Master device connected on the same network).
I have created what I think should work (using the Modbus Server node) - see JSON flow code further below.
To test this I am attempting to use Modbus Poll (on Laptop B) to request the Modbus Registers from the Node-Red Modbus Slave (running on Laptop A). However, I cannot establish a healthy TCP connection.
Network Troubleshooting Notes:
- Laptop A IP Address: 192.168.1.101
- Laptop B IP Address: 192.168.1.7
- Laptop B can successfully ping Laptop A
- Subnet Mask and Default Gateway aligned between laptops
Node-Red Modbus Server configuration (Laptop A):
- Hostname: 192.168.1.101
- Port: 502
Modbus Poll configuration (Laptop B):
- Connection: Modbus TCP/IP
- Remote Modbus Server: 192.168.1.101
- Server Port: 502
Note that in the Node-Red Flow I am initialising the Modbus Holding Registers with some values so that the Modbus Master (on Laptop B) has non-zero values to retrieve. This is why the Flow contains "Modbus Flex Write" and the associated "Modbus-Client node".
Node-Red Modbus-Client configuration (Laptop A):
- Host: 192.168.1.101
- Port: 502
Node-Red Troubleshooting Notes:
- I have changed the Modbus Server "Hostname" between 0.0.0.0, 127.0.0.1, and 192.168.1.101 (with no success)
- Node-Red version: 3.1.5
- Node.js version: v20.11.1
- Palette: node-red-contrib-modbus (5.30.0)
Any advice for troubleshooting this TCP connectivity (between Laptop B and Laptop A) would be greatly appreciated.
Some questions I have:
- The "Port" field for the Modbus Server Node suggests the available range is "2000 to 65536" (this is the grey text within the field when nothing is yet entered into the field). The default setting is 10502, but I have this set to 502, which is outside the "grey-text" range - is this an issue?
- Are there specific Firewall rules that need to be enabled/disabled to allow Node-Red to communicate through?