1. Home
  2. Docs
  3. SmartConfig
  4. Sensors
  5. RS-485

RS-485

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:

FieldDescription
sensor_nameGroup name used in logs (e.g., LeadMed)
addressModbus slave ID (decimal format, e.g., 1)
registerRegister start address in decimal (e.g., 0 for 0x0000)
labelVariable name shown in output (e.g., temp, do, do_percent)
bytesNumber of bytes to read (e.g., 4 for a float32 or 2 registers)
scalingMultiplier to scale the raw value (e.g., 1.0 or 0.01)
offsetValue added after scaling (e.g., 0)
orderByte 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:

PartDescription
Raw bufferThe actual byte sequence returned by the sensor
Byte order decodingValue interpreted using various byte orders (ABCD, DCBA, BADC, CDAB) for comparison
Raw floatDefault float interpretation (usually ABCD)
Final ResultThe 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 (with 0x) or decimal
  • Use this tool to validate:
    • Correct register mapping
    • Proper byte order
    • Sensor scaling and offset
  • Always match bytes and order to your sensor datasheet.

How can we help?