Document Version: V1.0
Gateways & Firmware Requirement:
| Software | E2C Field | E2C Facility |
|---|---|---|
| Gateways supporting | LG3120e | LG5120 |
| Firmware Requirement (RobustOS Pro Version) | =2.4.111 | (TBD) |
This manual guides field technicians to quickly configure the Robustel edge computing gateway to forward collected data from LoRa devices to higher-level systems (such as SCADA, MES, or upper computer software) using the Northbound Modbus TCP Slave protocol.
This manual is written for field implementation engineers. You do not need deep theoretical knowledge of the Modbus protocol. By following these step-by-step instructions, you can easily configure the gateway as a Modbus TCP Slave, map internal data tags to Modbus registers, and verify the data using third-party tools.
Gateway Role: From Collector to Server
In a typical IIoT project, imagine the gateway as a translator between your local sensors and the upper-level system. The data flow consists of two main stages:
First Stage (Southbound): The field LoRa sensors communicate with the gateway wirelessly using radio frequencies. The gateway acts as a LoRaWAN Network Server (LNS), receiving raw data sent by the sensors and parsing/decoding it, then storing the values internally as Tags.
Second Stage (Northbound): The gateway operates as a Modbus TCP Slave on the network. It takes those internal Tags, converts them into standard Modbus register addresses, and exposes them so that a higher-level system, such as SCADA, MES, or a Modbus testing tool like Modbus Slave, can continuously read the values.
(Note: This document uses the LG3120e gateway and E2C Field software as an example. The configuration process for other supported gateway and software combinations is very similar.)
Before starting the configuration, please ensure the following preparations are met:
| Device | Requirement |
|---|---|
| Gateway | Robustel Gateway with E2C Field / E2C Facility software installed. In this document, we use LG3120e with E2C Field for an example. |
| Debugging PC | A PC used to log into the gateway's Web UI and run the Modbus testing software (Modbus Slave). |
| Southbound Device | LoRaWAN sensor(s) (e.g., temperature and humidity sensor) to provide the initial data source. |
| Ethernet Cable | Standard Ethernet cable to connect the gateway and the debugging PC. |
Before forwarding data via Modbus, the gateway must first collect data from the field devices. In this guide, we will use a LoRaWAN temperature and humidity sensor as an example to collect two tags: Temperature and Humidity.
The purpose of this step is to provide the gateway with a "translator" script to convert raw hexadecimal data sent by the sensor into readable data points (e.g., temperature, humidity, or battery level). You only need to do this once per sensor model. Please follow the path below based on your sensor's current status:
Please navigate to LNS Configuration > 【Payload Codecs】.
The system supports creating custom Codec files through either Add or Copy methods. These operations require the operator to have a technical background in Codec development. This step explains the method of importing a file, which has a lower barrier to entry and broader applicability, to complete the creation of a Payload Codec for the vast majority of standard use cases.
Purpose of this step: To define the shared network settings for a specific model of sensor. Instead of typing the frequency and join settings for 100 identical sensors, you create one Profile and apply it to all of them.
| Parameter Name | Configuration Description | Recommended / Example Value |
|---|---|---|
| Payload Codec | The translator script you verified in Step 1. | e.g., AM102_Codec |
| Name | A recognizable name for this model template. | e.g., Profile_AM102_EU868 |
| Description | (Optional) Brief details about this profile's purpose. | e.g., Milesight AM102 sensor profile |
| Region | The LoRa radio frequency band applicable to your physical location. | e.g., EU868, US915, AS923 |
| MAC Version | The LoRaWAN protocol version supported by the sensor (check the sensor datasheet). | e.g., 1.0.3 |
| Regional parameters revision | The revision of the LoRaWAN Regional Parameters specification the sensor complies with. Must be correct to avoid MAC errors. | e.g., A, B, or RP002-1.0.0 |
| ADR algorithm | The Adaptive Data Rate algorithm used by the network server to optimize data rates. Usually left as default. | e.g., Default ADR algorithm |
| Flush queue on activate | Clears any pending downlink messages when the device re-joins the network. Highly recommended for OTAA. | e.g., Checked (Yes) |
| RX1 Delay | The delay in seconds for the first receive window. Keep the default unless specified otherwise by the sensor manual. | e.g., 1 |
| Expected Uplink interval (seconds) | The expected time interval between regular sensor data reports. | e.g., 3600 (for 1 hour) |
| Activation Method | How the sensor securely connects to the gateway. OTAA is highly recommended for security. | OTAA |
| Device Class | The LoRaWAN operating class. Class A (battery-powered/sleeps) or Class C (mains-powered/always listening). | e.g., Class A |
Purpose of this step: To register the actual, physical sensor to the gateway using its unique IDs, and select which data points (Tags) you want to collect.
| Parameter Name | Configuration Description | Recommended / Example Value |
|---|---|---|
| Device Profile | Select the pre-configured template for this sensor model (created in Step 2). This automatically applies the correct network and decoding rules. | e.g., Profile_AM102_EU868 |
| Name | A custom, recognizable name for this specific physical sensor to easily identify it in the system. | e.g., MeetingRoom_Sensor_01 |
| Description | (Optional) Additional notes about the device's installation location, purpose, or physical condition. | e.g., 3rd Floor Meeting Room A |
| Device EUI (HEX) | The globally unique 16-character hexadecimal identifier of the sensor. Typically found on the device's physical label or its packaging. | e.g., 24E124128C012345 |
| Join EUI (AppEUI) | The globally unique 16-character hexadecimal identifier used to identify the Join Server during the OTAA process. Provided by the manufacturer. | e.g., 5572404C696E6B4C |
| Application Key (AppKey) | The 32-character AES-128 root key specific to this device, used to secure the OTAA activation. This is highly sensitive information provided by the vendor. | e.g., 5572404C696E6B4C6F52613230313823 |
Once added, power on or reboot your physical sensor to force it to join the gateway.
1. Verifying Uplink Data (Reading from Sensor)
2. Verifying Downlink Data (Writing to Sensor)
If your sensor supports receiving commands (like turning on a relay or changing report intervals):
This is the core step where we expose our internal tags to the Modbus network.
| Parameter | Description & Action | |
|---|---|---|
| Modbus TCP Slave Configuration | Switch for Modbus TCP slave configuration. Default: Off (disabled). When enabled, cloud service configuration becomes available. | Off (disabled), On (enabled) |
| Port Number | The TCP port number on which the Modbus TCP server listens. Required. Range: 1-65535. | 502 (standard port) |
| 16-bit Integer Byte Order | Byte order for 16-bit integers. Default: AB. Required. Options: AB (big-endian), BA (little-endian). | AB |
| 32-bit Integer Byte Order | Byte order for 32-bit integers. Default: ABCD. Required. Options: ABCD (big-endian), CDAB, BADC, DCBA (little-endian). | ABCD |
| 32-bit Float Byte Order | Byte order for 32-bit floating point values. Default: ABCD. Required. Options: ABCD (big-endian), CDAB, BADC, DCBA (little-endian). | ABCD |
| 64-bit Integer Byte Order | Byte order for 64-bit integers. Default: ABCDEFGH. Required. Options: ABCDEFGH (big-endian), GHEFCDAB (little-endian), etc., depending on system support. | ABCDEFGH |
| Maximum Connections | Maximum number of concurrent Modbus TCP client connections. Required. Range: 1-32. | 10 |
| Mapped Value Settings | Mapped value settings. Default option: Data Operation Value. When enabled, the system transforms data according to the device point configuration in Data Collection and forwards the transformed data by default. Currently only the Data Operation Value option is available. | Data Operation Value (default option) |
After completing the basic settings, you need to add a slave and map the tags created during data collection to specific register addresses under this slave.
Before you start mapping, please review the following planning principles:
| Parameter | Description | Example |
|---|---|---|
| Mapping Table Name | A unique, identifiable name for this slave. Required. | Slave_For_SCADA |
| Slave Address | The Modbus unit identifier (Slave ID / Unit ID). The upper-level system must specify this address when reading data. Required. Range: 1-247. No default; must be filled. | 1 |
After adding the slave, you need to add tag mappings for this slave. The upper-level system (e.g., Modbus Slave) does not understand internal tag names like "Temperature"; it only recognizes standard Modbus register addresses (e.g., 40001). The system supports two methods: 【Add Mapping】 (single) and 【Batch Add Mapping】 (bulk creation).
Use this method to map tags one by one.
| Parameter | Description | Example |
|---|---|---|
| Device | Select the southbound device from which the data originates. Required. Choose from the dropdown. | MeetingRoom_Sensor_01 |
| Tag | Select the specific data tag to map. Required. After selection, 【R/W Permission】 and 【Original Data Type】 are automatically displayed. R/W Permission Note: If Read & Write is displayed, the upper-level system (e.g., Modbus Slave) can read the value and also write to modify the tag value on the gateway (i.e., write-back). If Read Only is displayed, the upper-level system can only read; write operations will have no effect. | Temperature |
| Mapped Data Type | Determines the data type exposed to the upper-level system via the Modbus register. Required. Should match or be compatible with the original data type. | int16 |
| Initial Mapping Function Code | Determines which Modbus function code the upper-level system uses to access this register. Required. - 03 (Holding Register): Most common; used for reading/writing 2-byte data. - 04 (Input Register): Read-only; used for reading 2-byte data. - 01 (Coil): Used for reading/writing 1-bit (boolean) data. - 02 (Discrete Input): Read-only; used for reading 1-bit (boolean) data. | 03 |
| Initial Mapped Address | The starting Modbus logical register address (e.g., 0, 1, 100) to which you want to map this tag. Required. Range: 1-65535. No default. Note: This address is the offset relative to the function code. | 1 |
| Mapped Address (Auto-calculated) | The final Modbus address automatically calculated by the system based on the "Initial Mapping Function Code" and "Initial Mapped Address". This field is for confirmation and cannot be edited. | If function code is 03 and initial address is 1, this field shows 40001 |
Use this method to map multiple tags from the same device at once, saving significant configuration time.
| Parameter | Description | Example |
|---|---|---|
| Initial Mapping Function Code | Select the Modbus function code for all tags in this batch. Required. The system will only display tags from the selected device that support this function code. | 03 (Holding Register) |
| Initial Mapped Address | The starting logical register address for the first tag in the batch. Required. Range: 1-65535. | 1 |
| Device | Select the southbound device whose tags you want to map. Required. | MeetingRoom_Sensor_01 |
Now, let's test if our gateway is successfully working as a Modbus TCP Slave.
Debugging Workflow (Check in this order)
1. Network Layer: From your SCADA/upper computer, run ping [gateway IP address] in CMD/Terminal.
2. Service Layer: Use the Modbus Slave software to try connecting to the gateway.
3. Data Layer: Connected but reads 0 or error values?
| Issue / Phenomenon | Possible Cause | Solution |
|---|---|---|
| Modbus Slave cannot connect to the gateway | PC and gateway are not on the same network subnet. | Ping the gateway's IP address from your PC to verify network connectivity. Check if Windows Firewall is blocking the Modbus TCP port you configured. |
| Modbus Slave connects successfully, but values are 0 or frozen | Southbound LoRa device collection failed, so the tag has no data. | Go to 【Data Collection】 to verify that the LoRaWAN device is online and data is updating normally. |
| Modbus Slave reports "Timeout" | Incorrect Slave ID or register address configuration. | Check that the Slave ID in Modbus Slave matches the slave address configured in the gateway. Verify that the register address mapping is correct. |
| Modbus Slave reads data successfully for some addresses but reports errors or incorrect values for others | The Quantity (number of registers to read) in Modbus Slave cuts across non-continuous mapping ranges. For example, if your mappings occupy addresses 1-2, 3, 4-5 (three discontinuous segments), setting Quantity to 4 attempts to read across segment boundaries, causing errors. | The Quantity value must fully cover a set of continuous mapped addresses without truncation. Valid quantities in the above example: 2 (covers 1-2 only), 3 (covers 1-3), or 5 (covers 1-5). Invalid quantities: 1 (truncates 1-2) or 4 (cuts across 1-2 and 3 incorrectly). Ensure Quantity aligns exactly with the start and end of your mapping segments. |
| After writing a new value in Modbus Slave, the value does not change or reverts to the original value | The 【R/W Permission】 of this mapped point is Read Only, which does not support write-back. | Go to 【Data Forwarding】>【Modbus Mapping Table】 to check the R/W permission of this point. Only points marked Read & Write support write-back. |
| A point shows Read & Write in Data Collection, but appears as Read Only in the Mapping Table | The original data type of this point is 【RAW-DATA】, 【STRING】, or 【BCD】. According to system rules, these three data types are forced to read-only when forwarded. | This is normal system behavior, not a configuration error. The three data types mentioned above are defaulted and forced to read-only during forwarding. No action is required. |
| When configuring a mapping, the "Mapped Data Type" dropdown only shows STRING, with no other types available | The original data type of this point is 【RAW-DATA】, 【STRING】, or 【BCD】. According to system rules, these three types can only be converted to STRING when forwarded. | This is normal system behavior, not a configuration error. The system automatically restricts the available options. Simply use the default selection. |