Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Modbus Connect

This function block establishes a Modbus TCP connection to a remote device and provides a reusable Modbus Client output that other blocks can use to perform reads/writes.

📥 Inputs

This function block does not have any inputs.

📤 Outputs

Modbus Client A connected Modbus client reference that can be fed into communication blocks to read or write registers.

🕹️ Controls

IP Address Enter the Modbus TCP server IP address (for example 192.168.0.10).

TCP Port Enter the Modbus TCP port (default is commonly 502).

⚙️ Running mechanism

  • When evaluated, the block attempts to connect to the Modbus server at the address and port provided in the controls.

  • If the address or port is changed, or if the connection drops, the block will attempt to reconnect automatically and continues to provide an updated Modbus Client output for other blocks.

  • Other blocks receive the Modbus Client through the output socket and use it to perform communication tasks (reads/writes).

🎯 Features

  • Persistent connection output so multiple blocks can share a single client.

  • Automatic reconnection when address changes or the connection is lost.

  • Simple UI controls for IP and port configuration.

📝 How to use

  1. Set the IP Address and TCP Port in the controls.

  2. Let the scenario run — the block will establish the connection and provide the Modbus Client on its output.

  3. Connect the Modbus Client output to communication blocks that require it (for example read/write blocks) to perform Modbus operations.

💡 Tips and Tricks

  • To read data regularly, connect the Modbus Client output to the Modbus Read block and use a Logic Input or another trigger to control when reads happen.

  • To write commands or values, feed the Modbus Client to the Modbus Write block and use a logic trigger to perform writes only when needed.

  • Forward telemetry to remote systems by combining with MQTT Publish (connect output from a read block into MQTT Publish) for lightweight messaging.

  • Save or log values by sending read outputs into SQL-DB Operations or CSV Export for persistent storage and later analysis.

  • Use Debug Input or Scope to inspect values coming from read blocks during setup and troubleshooting.

(hint: recommended companion blocks — Modbus Read, Modbus Write, Logic Input, MQTT Publish, SQL-DB Operations, CSV Export, Debug Input, Scope)

🛠️ Troubleshooting

  • Connection refused or timeouts — check the IP Address and TCP Port are correct and that the Modbus server is reachable on the network.

  • Firewall or network rules — ensure the port used for Modbus TCP is allowed through firewalls on both ends.

  • Multiple clients — if the server limits connections, avoid creating many simultaneous connections; share the provided Modbus Client output with other blocks.

  • If connection appears unstable, verify the network quality and try a different network cable or switch port.

Last updated