Skip to main content

Modbus Rules

Modbus Rules refers to a Modbus Command that Elastel gateway act as a Modbus Master to acquire data from southbound Modbus slave devices. One rule including assigned which interface for slave device, the slave device ID, the Modbus function code, (Read Holding Register) Start address, quantity count, data type…and other parameters.

Go to Data Collect >> South Devices>> Modbus Rules to view and configure Modbus commands list for slave devices. Modbus Rules setting

  1. The order of Modbus rules
  2. Specify the Device Name when add a Modbus rule
  3. Configure the belonged interface that the rule applied
  4. Configure the Tag Name of the specified register value, Multiple Tags can be configured by separated semicolon when reading continuous registers.
  5. Preview the current value that collected from southbound device under this rule communication
  6. Configure the slave device ID
  7. Configure the Modbus command function code. eg: 3-read holding register
  8. Configure the read starting address
  9. Configure the count of read quantity
  10. Configure the data type of the register
  11. Specify the reporting center that the collected data be reported to. The number is associated to North App>>Reporting Center>>Server <1~5>
  12. Enable/disable the rule be applied
  13. Edit the added rule
  14. Delete the added rule
  15. Add a new rule
  16. Export and import the rules configuration in csv template file. This is useful for rules configuration backup and batch operation

Add a Modbus Rule

Take an example to explain and add a Modbus rule, in this example, we will read a temperature & humidity sensor which following Modbus RTU protocol with RS485 interface.

Following the sensor’s datasheet to read temperature and humidity instruction example:
Read the temperature and humidity values of device address 0x01 Inquiry frame (hexadecimal):

Address codeFunction codeStarting addressData lengthCheck code lowCheck code high
0x010x030x00 0x000x00 0x020xC40x0B

Response frame (hexadecimal): (for example, the temperature is -9.7°C and the humidity is 48.6%RH)

Address codeFunction codeReturn valid Number of bytesHumidity valueTemperature valueCheck code LowCheck code High
0x010x030x040x01 0xE60x1 0x310xDA0x7C

Temperature calculation: Temperature: 131 H ( hexadecimal ) = 305 => Actual Temperature = 305/10= 30.5℃ Humidity calculation: Humidity: 1E6 H ( hexadecimal ) = 486 => Actual Humidity = 486/10= 48.6 %RH

Briefly the reading temperature and humidity Modbus Command would be, 01 03 00 00 00 02 C4 0B

The response data would be, 01 03 04 01 E6 01 31 DA 7C

And the actual value should be divide 10, so the Modbus Rule on Elastel gateway configuration would be, add modbus rule

  1. Set the rule order
  2. Specify the Device Name
  3. Configure the belonged Interface, in this example, the temperature and humidity sensor connect on COM1-RS485 port
  4. Configure the Tag Name of the registers’ value. Multiple Tags can be configured by separated semicolon when reading continuous registers
  5. Configure the sensor Device ID
  6. Configure the Modbus command function code. In this example the function code is 3-read holding register
  7. Configure the read starting address
  8. Configure the count of read quantity
  9. Configure the data type of the register, check the information from sensor datasheet
  10. Specify the reporting center that the collected data be reported to. The number is associated to North App>>Reporting Center>>Server <1~5>
  11. Configure the operator function, options: “None”, “+”, “-”, “*”, “/”, and “Expression”
  12. Configure the operand
  13. Configure the accuracy of calculated value
  1. Enable/disable SMS&Email Reporting. It will send report to specified phone number and Email address when value changed or value out of certain range.

    sms email alarm

  1. Enable/disable the rule be applied