Modbus TCP Data Collection Guide

Modbus TCP Data Collection Guide

1. Protocol Overview

  • Protocol Description: Modbus TCP is a common industrial automation protocol based on TCP/IP network transmission.
  • Application Scenarios: This protocol is widely used for data acquisition and control of devices such as PLCs, sensors, and meters.
  • E2C Trinity Support: E2C Trinity acts as a Client to connect and read data from devices via the Modbus TCP protocol.

2. Prerequisites

Before starting the configuration, please ensure the following:

  • Hardware Connection:
    • Ensure the E2C Trinity gateway and the target device (Modbus TCP-supported PLC, meter, sensor, etc.) are connected to the same Local Area Network (LAN) and can communicate.
    • The debugging PC must be connected to the gateway via Ethernet to log into the E2C Trinity web interface.
  • Network Parameters:
    • Obtain the IP Address of the target device.
    • Confirm the TCP Port Number (Default Modbus TCP port is 502).
    • Ensure the gateway, target device, and PC are on the same subnet with no IP conflicts. For Robustel EG series gateways, refer to the RobustOS Pro Software Manual for IP configuration.
  • Device Parameters:
    • Prepare the PLC project file or the Modbus Register Map.
    • Identify key parameters:
      • Slave Address (Slave ID): Usually 1 by default.
      • Function Code: Determines the register type and R/W mode (01/02/03/04, etc.).
      • Register Address: (Decimal, e.g., 40001 for the first Holding Register).
      • Data Type: e.g., Bool, Int, Float, etc.

3. Configuration Steps

Follow these steps within the E2C Trinity Web interface.

Step 1: Create Device

  1. Log into the gateway management page. Navigate to [Data Acquisition] to enter the E2C Trinity configuration page.


  1. Click the "Create Device"button and fill in the connection information in the pop-up window.

Parameter Description Example
Name Unique identifier for the source device. Packaging-Machine-03
Driver Communication protocol; select "Modbus TCP". Modbus TCP
IP Address The IP address of the target PLC/Device. 192.168.0.3
Port Number TCP communication port; Default is 502. 502
Slave Address The Modbus Slave ID of the device. 1
Polling Cycle Frequency of data requests (Seconds). 10
Description Additional info for user reference. Machine 03 in Workshop A.
Enable High-speed Collection Mode Supports millisecond-level data acquisition. Once published, the system automatically generates high-speed collection groups. Note: High-speed tags and their information cannot be modified after generation; only regular tags can be maintained. To change high-speed settings, create a new device. Enabled
High-speed Polling Cycle Must be selected when high-speed mode is enabled. Supported intervals: 50ms, 100ms, 200ms, 500ms. 100ms
Package Count Must be selected when high-speed mode is enabled. Defines how many polling cycles occur before data is reported as a batch. Supported values: 10, 20, 30. 30
Connection Timeout Limit for establishing a TCP connection (ms). 10000
Collection Timeout Limit for the device to respond to requests (ms). 1000
Communication Interval Minimum time between two requests (ms). 10
Enable Batch Collection Enabled by default for efficiency. Enabled
Max Batch Count Max data points per batch request (Default 64). 64
Byte Order Settings Sequence of data bytes (Default ABCD). ABCD
  1. Click "Save" to complete the device creation.

Step 2: Configure Tag (Point Table)

  1. Select the newly created device from the device list on the left.
  2. Click "Add" to create a single data acquisition Tag. Fill in the tag information.

Parameter Description Example
Name The tag name used in data reports and MQTT payloads. Temperature
Collection Type If High-speed Collection Mode is enabled for the device, you can choose between High-performance or Normal. Otherwise, it defaults to Normal. Normal
Tag Type Device Tag: Data from the PLC.

Virtual Tag: Intermediate gateway-side variable.
Device Tag
Function Code Select the appropriate Modbus Function Code (01-04). 03 Holding Register
Address Enter the Modbus address (Decimal). Ensure it falls within the range of the selected register type (e.g., 40001 for the first holding register). For High-speed Collection, it is recommended to use consecutive addresses to optimize acquisition performance. 1
Data Type Must match the PLC's data format (e.g., short, float). short (int16)
Read/Write Permission Read Only: Gateway only reads.

Read/Write: Gateway can also modify values.
Read Only
Decimals Number of decimal places (for Float/Double). 2
Unit Engineering units (e.g., °C, KWh, pcs). pcs
Associated Group Assign the tag to a specific data group. -
Description Brief explanation of the tag's purpose. Total production count.
Data Operation Mathematical processing (Scaling, Offset, etc.). None
  1. Repeat for all tags. Once finished, click "Publish" in the top right corner to apply the configuration.

4. Verification & Troubleshooting

Verification

  1. Check the device list to ensure the status is Online and tags are successfully collected.A green icon indicates success, and a red icon indicates failure.

  1. View the Latest Value column to verify data accuracy.

  1. Test Writing: Click the edit icon in the "Latest Value" column, modify the value, and verify if the PLC accepts the change.

Common Troubleshooting

  • Issue: Device remains offline.
    • Verify physical cable connections and link lights.
    • Use the Ping tool in [System -> Tools] to check network reachability.
    • Check if the IP, Port (502), and Slave ID match the device settings.
  • Issue: Connected, but values are null or incorrect.
    • Verify Function Code, Register Address, and Data Type against the device manual.
    • Check Byte Order (Endianness). Try switching from ABCD to CDAB if data looks garbled.
  • Issue: Write Failure.
    • Ensure the Function Code supports writing.
    • Check if the register is hardware-locked or "Read Only" on the device side.
  • Where to find logs?
    • Check the Debug Logs or System Logs in the management interface for specific error codes.

5. Appendix

Data Type Mapping

When configuring tags in E2C Trinity, use the following mapping:


E2C Trinity Type Length / Sign PLC Equivalent Example Address Notes
bool 1 bit BOOL 00001 / 10001 Coil (R/W), Discrete Input (RO)
byte 8 bit (Unsigned) BYTE / USINT - -
ushort (uint16) 16 bit (Unsigned) WORD / UInt 40001 / 30001 16-bit aligned, range 0–65535
short (int16) 16 bit (Signed) INT 40002 / 30002 Range -32768 to 32767
uint (uint32) 32 bit (Unsigned) DWORD / UDInt 40003~40004 2 registers; 0–4,294,967,295
int (int32) 32 bit (Signed) DINT 40005~40006 2 registers
float (float32) 32 bit (IEEE) REAL 40014~40015 May require Byte Order adjustment
string 1...n Bytes STRING[n] 40020... Check character encoding (ASCII/UTF8)
    • Related Articles

    • Inovance Serial over TCP Data Collection Guide

      1. Protocol Overview Protocol Description: "Serial over TCP" is a communication method that transmits serial data (such as Modbus RTU) over a TCP/IP network. It allows devices that typically use serial communication (RS232/RS485) to communicate with ...
    • OPC UA Data Collection Guide

      1. Protocol Overview Protocol Description: Modbus TCP is a common industrial automation protocol based on TCP/IP network transmission. Application Scenarios: This protocol is widely used for data acquisition and control of devices such as PLCs, ...
    • Omron CipNet Data Collection Guide

      1. Protocol Overview Protocol Description: CipNet is the term used by Omron for its EtherNet/IP network solution. EtherNet/IP is a widely adopted industrial Ethernet communication protocol that encapsulates the Common Industrial Protocol (CIP) within ...
    • Edge2Cloud(E2C) Factory Quick Start Guide

      Quick Start To give users a more intuitive and clear understanding, we use a practical example of "Data Collection and Reverse Control Based on a Modbus TCP Simulated Device" to guide users step-by-step, facilitating quick comprehension of the ...
    • Inovance TCP Data Collection Guide

      1. Protocol Overview Protocol Description: The Inovance TCP protocol is a communication method that allows direct TCP/IP network connection to Inovance PLCs (such as H3U, AM/AC series). It supports efficient data exchange by reading tags or register ...