Call Phone +8618073152920 Hotline: +8618073152920
Call Phone +8618073152920
English
CONTACT US/ CONTACT US
Consumer hotline +8618073152920
Changsha Zoko Link Technology Co., Ltd.

Email:Arvin@niubol.com

WhatsApp:+8615367865107

Address:Room 102, District D, Houhu Industrial Park, Yuelu District, Changsha City, Hunan Province, China

Position:Home >> Blogs >> Product knowledge

Product knowledge

RS485 Modbus RTU Sensor Guide: Addresses, Registers and CRC

Time:2026-09-07 16:27:28 Popularity:529

Connecting an RS485 sensor to a PLC or data logger involves more than matching the A and B terminals. The receiving device must also understand the Modbus RTU protocol, device address, register definitions and numerical representation of each measurement.

Many communication problems occur because the electrical connection is correct but the controller uses an incorrect register address, data type or scaling factor.

This guide explains RS485 Modbus RTU communication using practical hexadecimal frames, CRC16 calculations and a NiuBoL soil moisture and temperature sensor example.

NiuBoL data collector used as a host for compatible sensor channels

RS485 and Modbus RTU: What Is the Difference?

RS485 defines the electrical characteristics of a differential serial communication interface. Modbus RTU defines the message structure and communication rules used by compatible devices over a serial connection.

RS485 is the physical communication interface, while Modbus RTU is the communication protocol.

TermFunctionExample
RS485Electrical communication interfaceDifferential A/B communication pair
Modbus RTUSerial message protocolRequest and response frames
Device addressIdentifies the addressed sensorSlave ID 01
Function codeIdentifies the requested operation03: Read holding registers
Register addressIdentifies data within the sensor0x0000
Scaling factorConverts raw register values into engineering values272 ÷ 10 = 27.2%
CRC16Checks frame integrityC4 0B

A device with an RS485 interface does not necessarily support Modbus RTU. Similarly, two Modbus-compatible sensors may use completely different register maps.

1. Connect the Sensor and Configure the Serial Interface

A typical two-wire RS485 sensor requires a compatible power supply and a differential communication pair.

Before connecting the sensor, check its wiring diagram and electrical specifications. Do not identify power or communication conductors solely by their insulation colors, because wiring conventions may differ between models.

PLC / Data Logger / USB-RS485 Converter

RS485 Communication Pair

↓

Sensor 1 — Address 01

↓ Shared RS485 Bus

Sensor 2 — Address 02

↓

Sensor 3 — Address 03

This diagram illustrates logical bus connectivity. The actual power distribution, grounding, termination and cable arrangement must follow the electrical requirements of the installation.

For initial commissioning, connect only one sensor to one compatible Modbus master. This makes it easier to identify wiring problems and communication-setting mismatches.

Common Serial Communication Settings

SettingCommon Example
InterfaceRS485
ProtocolModbus RTU
Baud rate9600 bps
Data bits8
ParityNone
Stop bits1, where specified by the device
Device address01

The combination of eight data bits, no parity and one stop bit is commonly described as 8N1.

Many industrial sensors use this configuration, but it is not a universal Modbus RTU default. Some instruments use even parity or two stop bits. Always match the actual sensor documentation.

2. Understand Modbus Device Addresses

Each independently addressed sensor on a shared Modbus RTU bus requires a unique device address.

Standard Modbus serial addressing uses addresses 1–247 for individual server devices. Address 0 is reserved for broadcast operations, while addresses 248–255 are reserved by the standard.

Some manufacturers provide additional model-specific addressing or configuration conventions. These should not automatically be treated as interoperable standard Modbus addresses.

For example, a monitoring station may use the following device assignments:

The address identifies the sensor, not the measurement parameter. One sensor may provide several measurements through consecutive registers while using only one device address.

When several new sensors have the same factory-configured address, connect and configure them individually before installing them on a shared bus.

Otherwise, two devices may respond to the same request simultaneously, causing corrupted responses, CRC errors or communication failures.

Weather-station radiation shield illustrating a separate environmental measurement point

3. Understand Modbus Function Codes

The function code identifies the operation requested by the Modbus master.

Common function codes relevant to environmental and industrial sensors include:

Function CodeOperationTypical Use
03 (0x03)Read holding registersRead supported measurement or configuration registers
04 (0x04)Read input registersRead measurements assigned to the input register area
06 (0x06)Write single registerChange one supported writable configuration register
16 (0x10)Write multiple registersUpdate supported consecutive configuration registers

Not every Modbus sensor supports every function code. In particular, functions 03 and 04 should not be assumed interchangeable.

Begin commissioning with documented read-only operations. Use configuration-writing commands only after confirming the exact register purpose, accepted values and required procedure.

4. Decode a Complete Modbus RTU Request Frame

Consider the following hexadecimal request:

01 03 00 00 00 02 C4 0B

This is a valid Modbus RTU request to read two holding registers starting at protocol address zero from device address 1.

Hexadecimal FieldMeaningInterpretation
01Device addressSensor address 1
03Function codeRead holding registers
00 00Starting registerProtocol address 0
00 02Register quantityTwo consecutive 16-bit registers
C4 0BCRC16Low byte first, high byte second

The complete request contains eight bytes.

Function 03 permits a standard request quantity of 1–125 holding registers, although a particular sensor may support fewer registers or restrict the available starting addresses.

A correctly calculated frame does not guarantee that the selected device supports the requested register range.

5. Avoid the 40001 Register Addressing Error

One of the most common Modbus integration problems is confusing the register reference displayed in documentation with the actual address transmitted in the protocol frame.

Holding registers are frequently described using references beginning with 40001. However, the starting address transmitted in a standard Modbus request is zero-based.

Conventional Holding Register ReferenceZero-Based Decimal AddressProtocol Hexadecimal Address
4000100x0000
4000210x0001
4000320x0002
40011100x000A

This table illustrates the conventional 40001-based holding-register notation. PLC programming software and Modbus test applications may use different address-entry conventions.

Some applications expect the displayed register reference, while others expect the zero-based protocol address.

Check the software's addressing convention before entering a register number. A one-register offset can cause every subsequent measurement channel to be interpreted incorrectly.

6. Practical Example: Reading the NBL-S-THR Soil Sensor

The NiuBoL NBL-S-THR TDR soil moisture and temperature sensor is a practical example of an RS485 instrument providing two measurements through consecutive Modbus registers.

       NBL-S-THR TDR soil moisture and temperature sensor with RS485 Modbus RTU output option    

NBL-S-THR soil sensor used as the register-mapping example in this communication guide.

The RS485 version requires a compatible DC power supply and Modbus master. Its published register definitions include soil temperature at address 0x0000 and soil moisture at address 0x0001.

NBL-S-THR Integration Reference

ParameterSpecification
ModelNBL-S-THR
Measured parametersSoil temperature and soil moisture
Power supply12–24 VDC
Power consumptionApproximately 0.3 W
Digital interfaceRS485 Modbus RTU
Default baud rate9600 bps
Recommended communication intervalMore than 1000 ms

Measurement Register Map

RegisterMeasurementConversionUnit
0x0000Soil temperatureRaw value ÷ 10°C
0x0001Soil moistureRaw value ÷ 10% VWC

Assuming the sensor is configured at device address 01 and supports function 03 for these registers, the corresponding request is:

TX: 01 03 00 00 00 02 C4 0B

For illustration, suppose the returned temperature is 24.5 °C and the soil moisture is 27.2%.

A simulated, CRC-valid response containing those values is:

RX: 01 03 04 00 F5 01 10 EA 5D

The simulated response can be interpreted as follows:

Response FieldInterpretation
01Responding device address
03Read holding registers response
04Four measurement data bytes
00 F5Hexadecimal 0x00F5 = decimal 245
01 10Hexadecimal 0x0110 = decimal 272
EA 5DCalculated response CRC16

The engineering values are therefore:

Soil temperature = 245 ÷ 10 = 24.5 °C

Soil moisture = 272 ÷ 10 = 27.2% VWC

This response frame has been constructed and CRC-checked for teaching and decoder testing. It is not a recorded response captured from a physical sensor.

Confirm the supplied sensor's function codes, serial settings and register definitions before using the request in an actual installation.

7. Calculate Modbus RTU CRC16 Correctly

Modbus RTU uses a 16-bit cyclic redundancy check to detect transmission errors within a serial message.

The standard CRC calculation uses an initial value of 0xFFFF and the reflected polynomial 0xA001.

The calculation covers the device address, function code and message data before the CRC field is appended.

The resulting CRC is transmitted with its low-order byte first, followed by its high-order byte.

Why Changing the Device Address Changes the CRC

Consider two requests that read the same registers from different sensors:

Sensor address 01:
01 03 00 00 00 02 C4 0B

Sensor address 02:
02 03 00 00 00 02 C4 38

Although only the device address changes in the request body, the calculated CRC is different.

Sending the second request with the first request's CRC would produce an invalid frame.

Recalculate the CRC whenever the device address, function code, starting register, register quantity or other message data changes.

Python CRC16 Calculation Example

The following Python code calculates the CRC16 value and appends the correct transmission-order bytes to a Modbus RTU message.

def modbus_crc16(data):
    crc = 0xFFFF

    for byte in data:
        crc ^= byte

        for _ in range(8):
            if crc & 0x0001:
                crc = (crc >> 1) ^ 0xA001
            else:
                crc >>= 1

    return crc & 0xFFFF


def append_crc(data):
    crc = modbus_crc16(data)
    return data + crc.to_bytes(2, "little")


request = bytes.fromhex("01 03 00 00 00 02")
frame = append_crc(request)

print(frame.hex(" ").upper())

Expected output:

01 03 00 00 00 02 C4 0B

The Python example generates the frame locally. It does not require a physical sensor or serial communication connection.

Where a PLC function block or Modbus communication library generates CRC automatically, do not append a second CRC manually.

8. Validate and Decode a Modbus Response in Python

A receiving application should verify more than the presence of returned bytes.

It should check the CRC, responding device address, function code, data length and any exception status before decoding measurement values.

The following example uses the simulated NBL-S-THR response from the previous section. It assumes that the CRC calculation function defined above is available.

response = bytes.fromhex(
    "01 03 04 00 F5 01 10 EA 5D"
)

if len(response) < 5:
    raise ValueError("Incomplete Modbus frame")

received_crc = int.from_bytes(
    response[-2:], "little"
)

calculated_crc = modbus_crc16(
    response[:-2]
)

if received_crc != calculated_crc:
    raise ValueError("CRC mismatch")

if response[0] != 0x01:
    raise ValueError("Unexpected device address")

if response[1] == 0x83:
    raise ValueError(
        f"Modbus exception: {response[2]:02X}"
    )

if response[1] != 0x03:
    raise ValueError("Unexpected function code")

if response[2] != 4 or len(response) != 9:
    raise ValueError("Unexpected response length")

temperature_raw = int.from_bytes(
    response[3:5], "big"
)

moisture_raw = int.from_bytes(
    response[5:7], "big"
)

temperature = temperature_raw / 10
moisture = moisture_raw / 10

print(f"Soil temperature: {temperature:.1f} C")
print(f"Soil moisture: {moisture:.1f} %")

Expected output:

Soil temperature: 24.5 C
Soil moisture: 27.2 %

This example decodes the positive measurement values in the simulated frame. Confirm the sensor's actual negative-temperature representation before extending it to below-zero observations.

A production communication application also requires suitable serial frame collection, timeout handling and recovery behavior.

9. Signed Integers, Scaling and 32-Bit Data

Modbus registers contain 16-bit data words. The measurement meaning depends on the sensor manufacturer's register definition.

Scaled Integer Measurements

Suppose a sensor returns the raw hexadecimal value 0x09E6.

This represents decimal 2534.

If the documented divisor is 100, the engineering value is:

2534 ÷ 100 = 25.34

If the divisor is 10, the same raw value represents 253.4 instead.

The correct result depends on the actual register definition, not the number of decimal places displayed by the receiving software.

Negative Values and Signed 16-Bit Data

Where a sensor specifies signed 16-bit two's-complement representation, the hexadecimal value 0xFF9C represents −100.

Interpreting the same word as an unsigned integer would produce 65436.

If the documented temperature divisor is 10, the correct signed measurement is −10.0 °C.

The following Python example demonstrates signed decoding:

raw = bytes.fromhex("FF 9C")

value = int.from_bytes(
    raw,
    byteorder="big",
    signed=True
)

print(value / 10)

Expected result: −10.0

Use this interpretation only when signed two's-complement representation is specified for the actual sensor.

32-Bit Integers and Floating-Point Values

Some sensors report measurements using two consecutive 16-bit registers.

These registers may represent a signed or unsigned 32-bit integer, an IEEE 754 floating-point value or another manufacturer-defined format.

For example, the IEEE 754 single-precision representation of 25.0 is 0x41C80000.

One possible register arrangement is:

First register:  41 C8
Second register: 00 00

A device using reversed word order could instead return the two register words in the opposite sequence.

Modbus does not establish a universal multi-register floating-point layout for every sensor. Confirm the device's data type and word order before decoding.

Also distinguish the data-byte order within a register from the low-byte-first transmission order of the CRC field.

10. Understand Modbus Exception Responses

A valid exception response indicates that the addressed device received a request but could not complete the requested operation under the relevant conditions.

For example, the following is a CRC-valid simulated exception frame:

01 83 02 C0 F1

Its fields represent:

  • 01: Responding device address.

  • 83: Exception response associated with function 03.

  • 02: Illegal data address exception.

  • C0 F1: CRC16 transmitted low byte first.

Exception CodeMeaningInvestigation
01Illegal functionCheck whether the device supports the requested operation
02Illegal data addressCheck the starting address, quantity and available register range
03Illegal data valueCheck whether the request contains an unacceptable field value
04Server device failureInvestigate the device condition and applicable operating procedure

A Modbus exception is different from receiving no response. An exception provides information about a request that reached a responding device.

11. RS485 Bus Wiring and Communication Timing

After confirming communication with one sensor, additional devices can be connected to a suitably designed shared RS485 bus.

Use an appropriate linear bus arrangement, keep branch connections short and follow the installation requirements for cable impedance, termination and reference connections.

For conventional 120-ohm RS485 cabling, termination is commonly installed at the two physical ends of the bus. Do not automatically install a terminating resistor at every intermediate sensor.

Biasing requirements depend on the communication equipment and bus design. Some controllers already include termination or fail-safe biasing components.

RS485 communication distance and supported device count are influenced by cable characteristics, baud rate, transceiver loading, installation topology and electrical noise. Do not treat a single maximum distance or device-count figure as a guarantee for every installation.

RTU Frame Timing vs Sensor Polling Interval

Modbus RTU uses silent intervals to distinguish separate serial frames. A frame boundary normally requires a silent interval of at least 3.5 character times under the applicable serial-line timing rules.

For illustration, at 9600 bps with an 11-bit serial character, one character occupies approximately:

11 ÷ 9600 × 1000 = 1.146 ms

The corresponding 3.5-character interval is approximately:

1.146 × 3.5 = 4.01 ms

This protocol-level timing is different from the sensor manufacturer's recommended measurement communication interval.

For example, the NBL-S-THR product documentation recommends a communication interval greater than 1000 ms.

Sending requests every few milliseconds simply because the RTU frame timing permits it does not establish that the sensor can reliably provide measurements at that rate.

Respect the selected sensor's response time, minimum communication interval and any required measurement stabilization period.

NiuBoL salinity probe requiring its own Modbus register definition

12. Troubleshoot RS485 Modbus Sensors in the Correct Order

Changing register addresses repeatedly will not resolve a disconnected power supply. Similarly, replacing a sensor will not correct a PLC that interprets signed data as unsigned.

Use the observed communication behavior to narrow the investigation.

Observed ProblemPossible CauseRecommended Check
No response from the sensorPower, wiring, device address, serial settings or invalid requestTest one powered sensor with the documented communication settings
CRC errorsIncorrect CRC, electrical interference, frame handling or response collisionInspect raw bytes and verify calculated CRC and electrical conditions
Valid exception responseUnsupported function, address or request dataDecode the exception and consult the model-specific register map
One sensor works, several sensors failDuplicate device addresses, wiring topology or bus loadingVerify individual addresses, termination and electrical layout
Reading is ten or one hundred times too largeIncorrect decimal scalingCompare raw register data with the documented conversion formula
Negative temperature appears as a very large positive numberIncorrect interpretation of signed dataConfirm and apply the specified negative-value encoding
Unreasonable floating-point valuesIncorrect register quantity, data type or word orderInspect both raw register words and the manufacturer's data definition
Local measurement is correct but the remote platform is wrongGateway mapping, repeated scaling or incorrect engineering unitsCompare the sensor response, gateway value and final platform channel

Where the sensor does not respond, measure the actual supply voltage at the sensor under operating conditions. A nominal 12 V or 24 V cabinet supply does not guarantee that the same voltage reaches a distant field device.

Power down equipment before changing electrical connections. Follow the actual A/B terminal definitions rather than relying on a universal polarity-label convention.

Integrating Modbus RTU Sensors with an IoT Gateway

Modbus RTU describes the local serial communication between the sensor and its compatible master.

HTTP, HTTPS and MQTT are different communication arrangements that may be used between a gateway and a remote server.

For an agricultural or environmental IoT installation, the complete data path may be:

RS485 Modbus RTU Sensors

↓

Compatible Modbus Master / RTU / Data Logger

Register Acquisition and Engineering Value Conversion

↓

4G / Wi-Fi / Ethernet

↓

HTTP or MQTT Receiving Server

↓

Monitoring Application

Compatible NiuBoL RTU and data acquisition equipment can acquire supported RS485 sensor measurements and transfer them through selected communication interfaces.

Where a customer uses its own server, confirm the required upstream protocol, authentication, data format and channel mapping before ordering.

A transparent communication device and an active Modbus acquisition gateway do not necessarily provide the same functions. Confirm whether the selected equipment independently polls and decodes the sensor or only forwards serial data.

The standard NiuBoL cloud platform supports viewing monitoring data. SMS and email alarm functions are not included. Separately specify these functions where the project requires them.

When a sensor becomes unavailable, the receiving application should distinguish a missing measurement from a genuine measured zero. A previously acquired value should not be presented indefinitely as a current measurement.

Frequently Asked Modbus Integration Questions

Q1. Can two RS485 sensors use the same device address?

A1. Not when they are independently polled on the same Modbus RTU bus. Duplicate addresses can cause simultaneous responses and communication errors.

Q2. Why does a valid CRC not guarantee a correct measurement?

A2. CRC verifies message integrity. The controller may still be reading the wrong register, applying incorrect scaling or interpreting an unsuitable data type. Sensor calibration and measurement conditions must also be verified independently.

Q3. Can I use the same register map for every NiuBoL sensor?

A3. No. Soil, weather, water quality and hydrological sensors may use different register definitions and numerical formats. Use the communication protocol supplied for the exact model and version.

Q4. Is Modbus RTU the same as Modbus TCP?

A4. No. Modbus RTU is a serial protocol format using an RTU CRC field. Modbus TCP uses a different message framing arrangement over TCP/IP. A compatible gateway or conversion arrangement may be required between them.

Protocol References and Sensor Integration Support

For general Modbus function definitions, serial framing and CRC behavior, refer to the protocol specifications provided by the Modbus Organization.

The general protocol defines communication behavior, but the individual sensor manual defines its measurements, register addresses, scaling factors and supported configuration operations.

When requesting technical integration support, provide the sensor model, communication settings, receiving controller model, intended measurement channels and the actual hexadecimal request and response captured during testing.

These details allow a communication issue to be investigated more efficiently than a general report that the sensor is not working.

For RS485 soil sensors, weather stations, water quality instruments and industrial data acquisition projects, Contact NiuBoL for model-specific sensor communication protocols and compatible equipment selection.

Related recommendations

Sensors & Weather Stations Catalog

Agriculture Sensors and Weather Stations Catalog-NiuBoL.pdf

Weather Stations Catalog-NiuBoL.pdf

Agriculture Sensors Catalog-NiuBoL.pdf

Water Quality Sensor Catalog-NiuBoL.pdf

Related products

Tell us your requirements, Let's discuss more about your project.we can do more.

Name*

Tel*

Email*

Company*

Country*

Message


online
Contacts
Email
Top
XRS485 Modbus RTU Sensor Guide: Addresses, Registers and CRC-Product knowledge-Automatic Weather Stations_Industrial, Agricultural, Water & Environmental IoT Monitoring Solutions—NiuBoL

Screenshot, WhatsApp to identify the QR code

WhatsApp number:+8615367865107

(Click on WhatsApp to copy and add friends)

Open WhatsApp

The WhatsApp ID has been copied, please open WhatsApp to add consultation details!
WhatsApp