
Generic XY-MD02 RS485 Temperature and Humidity Sensor
RS485 sensor that measures temperature and relative humidity.
The XY-MD02 is an RS485 sensor that measures temperature and relative humidity in rooms, control cabinets and storage spaces. This Modbus RTU template reads both values and lets you set the device address, the baud rate and a correction for each reading from ModbusCloud.
- Protocol
- Modbus RTU
- Connection
- RS485, 9600 baud
- Registers
- 6, read and write
- Brand
- Generic
- Key readings
- Temperature · Relative humidity · Temperature and humidity correction
- Available commands
- Device address · Baud rate · Temperature correction · Humidity correction
- Compatible models
- XY-MD02
- Last updated
Registers (6)
6 read, 4 write
| Name | Unit | Access | Address (Hidden until you enter your email) | Function (hidden) | Type (hidden) |
|---|---|---|---|---|---|
| Temperature | °C | Read | 1 | FC04 | int16 |
| Humidity | %RH | Read | 2 | FC04 | uint16 |
| Device Address | Read and write | 257 | FC03 / FC06 | uint16 | |
| Baud Rate | Read and write | 258 | FC03 / FC06 | uint16 | |
| Temperature Correction | °C | Read and write | 259 | FC03 / FC06 | int16 |
| Humidity Correction | %RH | Read and write |
Loading registers…

Send your device list
If a device is not in the library yet, we build the template for free as soon as we have the register data.
Use cases
- Show temperature and humidity of a server room, cold store or warehouse on a dashboard, with 365 days of history.
- Get an email when the humidity in a greenhouse, archive or crawl space rises above your limit.
- Watch for frost in an outdoor cabinet or freezer room; temperatures below zero are read correctly.
- Align a sensor with a reference instrument by setting its temperature or humidity correction remotely.
- Check the address and baud rate of each sensor before you add more sensors to the same RS485 line.
Installation
Connect A+ and B- to RS485 A and B on the ModbusCloud Gateway and power the sensor with 5 to 30 V DC. Terminate a long line with 120 ohm.
Give each sensor its own address before you connect several to one bus. The factory address is 1.
In ModbusCloud, add a Modbus device (RTU) with address 1, 9600 baud, 8 data bits, no parity and 1 stop bit, and import this template.
Check that temperature and humidity match the room.
Things to watch for
The sensor does not answer. What should I check?
Check that A+ goes to A and B- to B; swapped wires are the most common cause. Out of the box the sensor uses address 1, 9600 baud, 8 data bits, no parity and 1 stop bit.
Below freezing the temperature shows over 6500 °C.
The temperature is a signed value. A copy of the template that reads it as unsigned turns -20.5 °C into 6533.1. Keep the data type from this template.
How do I change the address or the baud rate?
Write the new value to Device Address or Baud Rate, then change the device settings in ModbusCloud to match. Read Baud Rate first: if it shows 0, the sensor uses codes (0 = 9600, 1 = 14400, 2 = 19200); if it shows 9600, write the baud rate itself.
How do I correct a reading that is off?
Write a correction to Temperature Correction or Humidity Correction, from -10.0 to 10.0 °C or %RH. Compare the result with a reference instrument and adjust in small steps.
Readings drop out with several sensors on one cable.
Give each sensor its own address; two sensors on address 1 disturb each other. Terminate both ends of a long line with 120 ohm and keep the power supply close to the sensors.
Want to see how it works?












