Skip to content

Client Connection

Harted edited this page Oct 31, 2025 · 4 revisions

This guide explains how to connect to Modbus devices using both TCP and RTU protocols.

Connection Panel

The connection panel is located in the top right section of the Client mode interface. It contains:

  • Protocol toggle (TCP / RTU) - left of the Unit ID input
  • Connection parameters (change based on selected protocol)
  • Unit ID input (always visible for both protocols)
  • Connect/Disconnect button
  • Connection status indicator (button turns yellow when connected)

Modbus TCP Connection

Modbus TCP is a network-based protocol that runs over Ethernet.

TCP connection panel

Configuration

  1. Select TCP using the protocol toggle (left of Unit ID input)

  2. Enter the IP Address

    • IPv4 address of the device (e.g., 192.168.1.100)
    • Use 127.0.0.1 for local testing (e.g., connecting to Modbux server simulation)
  3. Set the Port

    • Default Modbus TCP port: 502
    • Some devices use custom ports (check device documentation)
  4. Choose Unit ID

    • Also called Slave ID
    • Huawei Smart Logger example:
      • Unit ID 0 is typically the main device (SmartLogger itself)
      • Unit ID 1 and higher are connected devices (e.g., inverters, weather sensors)
  5. Click CONNECT

    • Button turns yellow when successfully connected

Modbus RTU Connection

Modbus RTU is a serial communication protocol using RS-485.

RTU connection panel

Hardware Requirements

  • USB-to-RS485 adapter (most common)
  • Proper wiring to the device (A/B or +/- terminals)

Configuration

  1. Select RTU using the protocol toggle

  2. Enter the Serial Port

  3. Set Baud Rate (dropdown)

    • Common values: 9600, 19200, 38400, 57600, 115200
    • Must match device settings
    • Check device documentation and device configuration
  4. Set Parity

    • Options: None, Even, Odd, Mark, Space
    • Most common: None
    • Must match device settings
  5. Set Data Bits

    • Options: 5, 6, 7, 8
    • Most common: 8
  6. Set Stop Bits

    • Options: 1, 2
    • Most common: 1
  7. Choose Unit ID

    • Also called Slave ID
    • Must match device configuration
    • Check device settings or documentation
  8. Click CONNECT

    • Button turns yellow when successfully connected

Finding Serial Ports

Windows

Serial ports appear as COM ports:

  1. Open Device Manager
  2. Expand Ports (COM & LPT)
  3. Find your USB adapter (e.g., USB Serial Port (COM3))
  4. Note the COM number
  5. Enter in Modbux as: COM3, COM5, etc.

Common values:

  • COM1, COM3, COM5, COM7, etc.

macOS

Serial ports appear in /dev/:

  1. Open Terminal
  2. Run: ls /dev/cu.*
  3. Look for entries like /dev/cu.usbserial-XXXX
  4. Use the cu. variant (not tty.)

Example:

ls /dev/cu.*
# Output: /dev/cu.usbserial-0001

Enter the full path: /dev/cu.usbserial-0001

Common patterns:

  • /dev/cu.usbserial-XXXX
  • /dev/cu.SLAB_USBtoUART
  • /dev/cu.usbmodem-XXXX

RTU Wiring (RS-485)

RS-485 is the standard for Modbus RTU:

  • Two terminals: A/B or +/-
  • ! Polarity matters ! - incorrect polarity = no communication
  • Use shielded cable for longer distances

Termination Resistors

For reliable communication, especially on longer cables:

  • Some devices have built-in termination (check documentation)
  • RS-485 interface cards often have jumpers or switches to enable termination
  • USB adapters (e.g., USB-COMi-M) may have internal jumpers for termination
  • Modbus RTU-to-TCP converters usually handle termination automatically
  • Only the devices at the ends of the bus need termination enabled

Common Issues

Cannot connect:

  • Verify IP address and port are correct
  • Check that port 502 is not blocked by firewall
  • Ensure device is powered on and network cable is connected
  • Use ping to verify network connectivity first (TCP)
  • Check baud rate matches device settings (RTU)
  • Verify correct Unit ID in device configuration
  • Swap A/B wiring if incorrect polarity (RTU)

Connection timeout or drops:

  • Adjust timeout via the Time Settings (clock icon in toolbar)
  • Check network latency with ping (TCP)
  • Increase the timeout value if device or network is slow
  • Verify termination resistors are properly configured (RTU)

Wrong Unit ID:

  • Try Unit ID 0 (often the main device)
  • Try Unit ID 1 (common for standalone devices)
  • Check device documentation or settings for correct Unit ID
  • Some devices respond to multiple Unit IDs

Connection Status

The connection button shows the current state:

  • CONNECT: Not connected, click to connect
  • CONNECTING...: Connection in progress
  • CONNECTED (yellow button): Active connection, click to disconnect
  • DISCONNECTING...: Disconnection in progress

Disconnecting

To disconnect from a device:

  1. Click the DISCONNECT button
  2. Wait for disconnection to complete
  3. You can now change connection parameters

Testing Your Connection

After connecting (button turns yellow):

  1. Configure a register read address and length (e.g., Holding Register at address 0, length 10)
  2. Click Read
  3. Check if data appears in the grid
  4. Status messages appear as notifications (snackbar)
  5. If you encounter issues, try different register lengths - some devices have strict requirements for data frame size and may only respond to specific read lengths

If you see rows appearing in the readout table, your connection is working.

Next Steps

Clone this wiki locally