Connect an RS485 / Modbus RTU device
RS485 (Modbus RTU) devices are read by a gateway on the same bus.
Protocol: rs485 · Requires: a gateway
Connection fields:
| Field | Meaning |
|---|---|
modbusId |
The slave/unit ID on the bus (1–247) |
baudRate |
Bus speed (e.g. 9600, 19200) — must match the device |
dataBits |
Usually 8 |
stopBits |
1 or 2 |
parity |
None, Even, or Odd — must match the device (many meters use Even) |
tickDuration |
Publish interval in ms — how often readings are sent to Synacl (minimum 10000) |
readIntervalMs |
Optional. How often the gateway reads the device; drives gateway-side alerts and macros |
Steps
- Wire the sensor's A/B lines to the gateway's RS485 port; match baud rate, parity, and unit ID.
- Add a device with protocol rs485, select the gateway, and enter the fields above.
- Define a tag per register you want to read (with scaling/units as needed).
Seeing modbus/timeout events? Check wiring, modbusId, baud rate, and parity. See fault events.
Known meter? Pick it from the device catalog when adding the device and the connection settings and every register below are filled in for you.
Modbus data formats
A Modbus register is 16 bits, but many meters store a value across two registers, or as a signed number. Each tag has a Format that tells the gateway how to decode what it reads:
| Format | Registers read | Meaning | Typical use |
|---|---|---|---|
u16 (default) |
1 | unsigned 0–65535 | most simple sensors, scaled integers |
s16 |
1 | signed −32768…32767 | temperatures that go below zero |
u32 |
2 | unsigned 32-bit | energy counters, PZEM-004T current/power |
s32 |
2 | signed 32-bit | bidirectional power |
f32 |
2 | IEEE-754 float | Eastron SDM series, most modern meters |
For the two-register formats, Word order says which register holds the high half: big (the default, "ABCD" — high word at the lower address) fits most meters; little (low word first) is what the PZEM-004T and a few others use. If a float reads as a wildly wrong number rather than a slightly wrong one, the word order is the first thing to flip.
The gateway publishes the decoded value raw; the tag's scale factor and offset still apply afterwards, exactly as for a u16 register. Writes from the app (coil / holding) stay single-register and are unaffected.
Any format other than u16 needs gateway firmware that reports the modbusFormats capability. On an older gateway the form warns you and saving is refused with Gateway firmware doesn't support 16-bit signed / 32-bit Modbus formats — update the gateway firmware — update it from the gateway's page first.
Test it from your browser first
Before you wire the sensor to the gateway, you can prove it answers. Plug a USB-RS485 adapter into your laptop instead of the gateway, wire the sensor's A/B lines to it, and open the Modbus RTU tester in Chrome or Edge — it talks to the bus over Web Serial, needs no account, and nothing you read leaves the browser.
- Enter the baud rate, data bits, stop bits and parity, then connect and pick the adapter's port. If you don't know the serial settings, let the auto-baud probe try the common combinations for you.
- If you don't know the unit ID, run the slave scan — anything that answers, even with an exception, is listed.
- Choose the function code and start address and read the register. The reply is decoded register by register, with the address shown 0-based, 1-based and as
4xxxx. - When the numbers look right, copy the settings card into the Add device form — or use Add this device in Synacl, which opens that form with the connection fields and the registers you ticked already filled in.
Then move the adapter back to the gateway and add the device for real.
No meter on the desk yet? Test the gateway against a simulated one
The other way round works too. The free Modbus slave simulator turns Chrome and the same USB-RS485 adapter into a known-good slave, so you can check the gateway's wiring and your device settings before the real meter arrives.
- Wire the gateway's RS485 module to the adapter: A to A, B to B, and GND to GND if both have one.
- Open the simulator, set the same baud rate, parity and unit ID as the device you added in Synacl, and connect. It starts with a sample energy-meter register map you can edit.
- Give the device in Synacl tags on those registers. The simulator's traffic log shows every request the gateway sends, and your tags fill in on the next poll.
Nothing appearing in the log at all usually means the ESP32's TX and RX wires to the RS485 module are crossed. Garbled bytes point at A/B or the baud rate. You can also make the simulator misbehave on purpose (no reply, bad CRC, an exception) to see how the device reports each fault.