XY-MD02 (SHT20 RS-485) Modbus to the cloud with an ESP32

Generic (XY-MD02)·Environment sensors·Modbus RTU (RS-485)Datasheet-derived

A low-cost boxed RS-485 temperature and humidity transmitter built around a Sensirion SHT20, sold under many brands as the XY-MD02. It reports both values as tenths over Modbus RTU.

The Synacl ESP32 gateway reads the XY-MD02 (SHT20 RS-485) over Modbus RTU (RS-485). This catalog entry carries the register map, scaling and connection defaults below, so adding it in the app is a pick from a list rather than a form filled in from the datasheet — and it is the same data an AI agent gets from the list_catalog MCP tool.

Needs a recent gateway firmware — 16-bit signed and 32-bit (int32 / float32) Modbus registers. The app warns when the selected gateway is older; update it from the gateway page first.

Registers · 2 tags

TagUnitAddress (hex / dec)FunctionFormatWord orderScale
Temperature
temperature_ambient
°C0x0001 / 1FC04 input registerint16× 0.1
Relative humidity
humidity_relative
%0x0002 / 2FC04 input registeruint16× 0.1

Addresses are 0-based wire addresses — what goes in the request frame — shown as hex and decimal. A datasheet that numbers registers from 30001 / 40001 is one higher. 32-bit values occupy two consecutive registers. Engineering value = raw × scale + offset; the gateway sends the raw reading and Synacl scales it.

Connection defaults

Baud rate9600
Framing8N1 — 8 data bits, no parity, 1 stop bit
Unit ID (slave address)1

Wiring

Four wires: V+ (5–30 V DC) and GND for power, then A(+) to the gateway's A and B(−) to B. Share a GND with the gateway when the power supplies differ. The gateway's transceiver sits on GPIO16 (RX) / GPIO17 (TX).

Notes

Set it up in three steps

  1. Flash the gateway from the browser
    Plug an ESP32 dev board into USB, open the free web flasher in Chrome or Edge and write the Synacl gateway firmware. It asks for Wi-Fi and pairs the gateway with your account — nothing to install, about two minutes.
  2. Add the XY-MD02 (SHT20 RS-485) from the catalog
    In the app open Devices → Add device and choose “Start from a catalog device”, then pick XY-MD02 (SHT20 RS-485). The Modbus RTU (RS-485) settings and every tag in the table above are filled in; choose the gateway it is wired to, change the unit ID or baud rate if yours differs, and save. How the catalog picker works →
  3. Watch the live data arrive
    The gateway receives the new configuration over MQTT within seconds and starts polling. Readings show on the device page and in any dashboard widget you bind to them; add a rule for alerts, keep history for reports, or let an AI agent read it over MCP.

How this entry was verified

Datasheet-derived — derived from the vendor datasheet and not yet confirmed on hardware — please report a mismatch.

Bench-verified means Synacl ran this entry on real hardware. Datasheet-derived means the map was transcribed from the vendor's documentation, so a register may be off by one or in the other word order on your unit — a two-line email fixes it for everyone.

Report a register mismatch · Vendor datasheet ↗ · All catalog devices

Try it on your own hardware

Synacl is free for five devices — no card, no sales call. Flash a gateway from the browser, add the XY-MD02 (SHT20 RS-485) from the catalog, and see live data in a few minutes.