Skip to content

Modbus RTU Configuration & Guide ​

For FastBee IoT Platform — ESP32 Firmware
Default adapted: Generic Chinese Modbus RTU relay module (flash-on type)


Current Version Notes ​

  • Modbus RTU master support is in the unified release baseline. Enable modbus in Feature Config and verify an RS485 transceiver, UART pins and runtime memory state.
  • Modbus sub-device editing, mapping and deletion are all done in the Web page.
  • Modbus RTU configuration, sub-devices and mappings are saved in /config/protocol.json.
  • After importing protocol.json, it's recommended to restart the device.

Modbus debugging is mainly done in the "Communication Protocol / Modbus RTU" configuration page; when linkage is involved, go to the "Peripheral Execution" page to create polling or control rules.

Quick Reference ​

For the complete guide including REST API, sub-device configuration (relay/PWM/PID/motor), register mapping, polling task features, configuration examples, and troubleshooting, refer to the Chinese version.

Serial Configuration ​

Config ItemDescriptionDefault
Serial PortUART1/UART2UART1
TX PinTransmit pinGPIO16
RX PinReceive pinGPIO17
Baud RateCommunication speed9600
Data BitsNumber of data bits8
Stop BitsNumber of stop bits1
ParityParity methodNone (0)

Supported Function Codes ​

Function CodeDescriptionOperation
0x01Read CoilsRead switch values
0x02Read Discrete InputsRead input status
0x03Read Holding RegistersRead data (commonly used)
0x04Read Input RegistersRead read-only data
0x05Write Single CoilControl single switch
0x06Write Single RegisterWrite single value
0x10Write Multiple RegistersBatch write

Troubleshooting ​

IssuePossible CauseSolution
Communication TimeoutWiring error / baud rate mismatchCheck TX-RX cross wiring and baud rate
CRC ErrorElectrical interference / line too longShorten line or add termination resistor (120Ω)
Slave No ResponseWrong addressConfirm slave address (use scan function)
Data AbnormalWrong data type / byte orderCheck INT16/FLOAT32 and big/little endian settings
Can Read but Not WriteWrong function codeUse 03/04 for read, 05/06/10 for write

Sensor Status & Sub-device Management ​

Once Modbus RTU is enabled and sub-devices are configured, the page displays real-time sensor status and a sub-device management list for monitoring data collection and managing devices.

Modbus RTU Configuration Page

Sensor Status Cards ​

The top of the page shows real-time data cards for all mapped sensors:

ItemDescription
Sensor Namee.g. temperature, humidity, pm25
Current ValueLatest collected value (after mapping and scaling)
Status BadgeNormal (green): data updating normally; Waiting (gray): no data collected yet
Update TimeTime since last data update (e.g. 2m means 2 minutes ago)

Tip: Sensor status cards only display collection points with configured register mappings. Unmapped sensors show -- with "Waiting" status and auto-refresh once polling succeeds.

Sub-device List ​

The sub-device list manages all collection and control devices in one unified table, with "+ Add Device" and "Refresh" buttons.

List Columns ​

ColumnDescription
NameSub-device name, e.g. "Temperature", "PM25-10", "Weather Station"
TypeCollection (polling task) or Control (sub-device)
Slave AddressModbus slave address (1-247)
Device InfoFunction code + start address + register count + mapping count, e.g. FC04 @0 x2 [2 mappings]
EnabledWhether the sub-device is enabled (toggle switch)
OperationsEdit / Mapping / Delete (collection) or Edit / Control / Delete (control)

Device Info Format ​

The Device Info column displays key parameters in a compact format:

FC04 @0 x2 [2 mappings]     → FC04, start address 0, 2 registers, 2 mappings
FC03 @500 x8 [6 mappings]   → FC03, start address 500, 8 registers, 6 mappings

Operations ​

  • Edit: Open the device edit dialog to modify name, slave address, function code, start address, register count, etc.
  • Mapping: Open the register mapping dialog to configure sensor name, data type, scale factor, etc. for each register
  • Control: Open the device control dialog (control devices only) for relay switching, PWM adjustment, etc.
  • Delete: Remove the sub-device and its associated configuration
  • + Add Device: Add a new collection or control device
  • Refresh: Manually refresh the sub-device list and sensor status

FastBee | fastbee.cn