(Smart Irrigation RS485-Modbus-RTU)

This document details the Modbus-RTU and 4G-MQTT communication protocols for solar-powered smart motorized UPVC ball valves used in modern agricultural and commercial irrigation systems. The system operates in a Master-Slave polling architecture, where the Master acts as the main irrigation controller or cloud platform, and the Slave corresponds to individual valve actuators.

1. Physical Layer Specifications

2. Protocol Layer (Modbus-RTU)

Frame Structure:

Slave Address (1 Byte) + Function Code (1 Byte) + Data Field (N Bytes) + CRC16 Low Byte + CRC16 High Byte

Supported Function Codes

Function CodeDescription
0x03Read Holding Registers (reads valve status, operating voltage, fault codes)
0x06Write Single Register (sends open, close, or stop execution commands)
0x08Diagnostic Commands

3. Register Mapping (Holding Registers)

Note: Register addresses are listed in standard 4x decimal notation.

Register AddressRegister NameRead/WriteDescription & Scale
40001Control CommandWrite1 = Open Valve; 2 = Close Valve; 3 = Stop Movement
40002Actual Valve StatusRead0 = Unknown; 1 = Fully Open; 2 = Fully Closed; 3 = Opening; 4 = Closing; 5 = Fault
40003Supply VoltageReadScale: 0.1V (e.g., 240 corresponds to 24.0V DC)
40004Fault CodeRead0 = Normal; 1 = Overcurrent; 2 = Timeout/Jammed; 3 = Motor Fault; 4 = Communication Error
40005Slave AddressRead/WriteRange: 1–247. Address updates take effect immediately.
40006Baud Rate SettingRead/Write1 = 9600 bps; 2 = 19200 bps; 3 = 38400 bps

4. Communication Command Examples (Slave Address = 01)

1) Send Open Valve Command (Write Register 40001 = 1)

2) Send Close Valve Command (Write Register 40001 = 2)

3) Read System Parameters (Read 4 Registers: 40001–40004)

Data Frame Parsing:

5. 4G-MQTT Cloud Protocol Extension (Wireless Variant)

Downlink Command Structure:

{“devId”:”V001″,”cmd”:1}(cmd parameter definitions: 1 = Open, 2 = Close, 3 = Stop)

Uplink Telemetry Structure:

{“devId”:”V001″,”valveState”:1,”voltage”:24.0,”errCode”:0}

6. Fault Handling and Timeout Policy

  1. Host Request Timeout: If the Master sends a request and receives no response within 500ms, the request is flagged as timed out. The Master may retry up to 2 times before marking the node offline.
  2. Action Timeout: The normal travel time for full valve opening or closing is 15 seconds max. If target limit switches are not engaged within 15 seconds, a “Jammed/Mechanical Fault” code is raised.
  3. Malformed Frames: Any invalid or corrupted frames detected on the RS485 bus are silently dropped by the slave without generating a response.

7. Deployment Guidelines and Responsibilities

  1. Hardware Vendor: Ensure strict compliance with the defined register map, deliver standard RS485 differential signals, and supply devices with factory default settings (Address 1, Baud Rate 9600).
  2. System Integrator: Implement compliant Modbus-RTU Master software logic, including proper handling of system timeouts, retry counts, and status error code parsing.
  3. Field Installation: Ensure polarity alignment on lines A and B. Shielded Twisted Pair (STP) cabling must be used for long-distance outdoor deployments to protect against industrial noise and ground loops.

Leave a Reply

Your email address will not be published. Required fields are marked *