
The SmartSampler supports integration of Modbus RTU-compatible sensors via the RS-485 interface. Configuration is done using the built-in GUI and flexible parsing rules to extract values from custom responses.
๐งฉ Overview
- Protocol: Modbus RTU
- Supported Functions: Manual polling via Function Code 0x03 (Read Holding Registers)
- Transport: RS-485, half-duplex
- Live Reading Toggle: ON/OFF toggle for periodic polling
- Multi-register support: Handles multi-variable sensors
- Custom Parsing: Extract and decode values using flexible configuration strings
๐ RS-485 Sensor Configuration
The configuration text box allows you to define multiple Modbus sensors using a structured comma-separated string.
Format:
sensor_name,address,register,label,bytes,scaling,offset,order
Parameters:
Field | Description |
---|---|
sensor_name | Group name used in logs (e.g., LeadMed ) |
address | Modbus slave ID (decimal format, e.g., 1 ) |
register | Register start address in decimal (e.g., 0 for 0x0000 ) |
label | Variable name shown in output (e.g., temp , do , do_percent ) |
bytes | Number of bytes to read (e.g., 4 for a float32 or 2 registers) |
scaling | Multiplier to scale the raw value (e.g., 1.0 or 0.01 ) |
offset | Value added after scaling (e.g., 0 ) |
order | Byte order pattern using letters A , B , C , D |
Example Entries:
LeadMed,1,0,temp,4,1.0,0,ABCD
LeadMed,1,290,do,4,1.0,0,ABCD
LeadMed,1,292,do_percent,4,1.0,0,ABCD
Live Reading
- When Live Reading is toggled ON, the SmartSampler continuously polls configured sensors.
- Each Modbus message is built using the configured Device ID and Register Address.
- Responses are decoded using the selected DataType and mapped to AโD placeholders.
- New values appear in the Live Reading box as timestamped entries.
๐ถ Baud Rate
- Supported:
9600
,19200
,38400
, etc. (Selectable via dropdown) - Saving applies the rate and restarts the Modbus bus
๐พ Save & Load
- Press Save to store current configuration.
- Press Load to retrieve previously saved settings.
๐งฐ Notes for Developers
- Message format follows:
[0xAA][LEN_H][LEN_L][CMD][SUB][DATA...][CHK][0x55]
- All values are checked with XOR checksum
- Modbus Function Code is fixed to
0x03
currently - Byte order control enables compatibility with big-endian/little-endian devices
๐งช RS-485 Test Area
The Test Area tab is designed for diagnostics and manual communication with Modbus devices. It allows you to send one-off read requests and inspect raw and interpreted results in detail.
๐ฅ Single Request
Enter a one-line configuration string in the same format used in the main configuration panel:
sensor_name,address,register,label,bytes,scaling,offset,order
Example:
LeadMed,1,0x0100,temp,4,1.0,0,ABCD
Sends Modbus Function 0x03 to slave ID 1
Reads 2 registers (4 bytes)
Applies byte order, scaling, and offset
Shows multiple interpretations
๐ค Response Breakdown
The response panel shows:
Part | Description |
---|---|
Raw buffer | The actual byte sequence returned by the sensor |
Byte order decoding | Value interpreted using various byte orders (ABCD, DCBA, BADC, CDAB) for comparison |
Raw float | Default float interpretation (usually ABCD) |
Final Result | The label + scaled value shown using selected order, scaling, and offset |
Request to addr 1, register 0x100, bytes: 4
Raw buffer: 85 12 cd 41
order: ABCD = 25.634043
order: DCBA = -0.000000
order: BADC = -202920224.000000
order: CDAB = 0.000000
Raw float: 25.634043
Final Result: temp:25.63
๐ Debug Passthrough
- Pressing Passthrough activates a transparent debug mode.
- All Modbus communication is sent through as-is without decoding.
- Useful for sniffing, manual commands, or external testing tools.
๐ Notes
register
can be entered in either hex (with0x
) or decimal- Use this tool to validate:
- Correct register mapping
- Proper byte order
- Sensor scaling and offset
- Always match
bytes
andorder
to your sensor datasheet.