XY-MD02 (SHT20 RS-485) Modbus to the cloud with an ESP32
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
| Tag | Unit | Address (hex / dec) | Function | Format | Word order | Scale |
|---|---|---|---|---|---|---|
Temperaturetemperature_ambient | °C | 0x0001 / 1 | FC04 input register | int16 | — | × 0.1 |
Relative humidityhumidity_relative | % | 0x0002 / 2 | FC04 input register | uint16 | — | × 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 rate | 9600 |
|---|---|
| Framing | 8N1 — 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
- Temperature is a SIGNED 16-bit value in tenths of a degree — below 0 °C it goes negative, so this entry uses the s16 format and needs gateway firmware that reports the modbusFormats capability. Read as u16 a freezer would show 6553.x °C.
- 9600 baud, 8N1, unit ID 1 by default. Both values are input registers (FC04); the module also mirrors them as holding registers on some batches.
- There is no single vendor for this module and no vendor datasheet: the register map is the one printed in the one-page manual shipped with it. The datasheet link is for the SHT20 sensing element it is built around.
- Not yet bench-verified on this platform. If a reading does not match, report the mismatch.
Set it up in three steps
- 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. - 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 → - 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.