What is a Modbus unit ID or slave ID?
Updated 10 November 2026
A unit ID — also called a slave ID, station address, or device address — is a number from 1 to 247 that says which device you mean when several share one connection. On an RS-485 chain with a dozen meters on it, the unit ID is the only thing distinguishing them. Native Ethernet equipment often ignores it entirely and answers on any ID. If you don't know it, try 1 first; it is by far the most common. The wrong unit ID produces either silence or a “gateway target device failed to respond” error, both of which look like equipment that is switched off.
When it matters and when it does not
- Behind a gateway: it matters completely. One IP address fronts a chain of devices, and the unit ID selects which one. Getting it wrong means talking to nothing, or worse, talking to the wrong meter.
- Native Ethernet equipment: usually it does not. A device with its own IP address and no serial segment behind it often answers on any unit ID, because there is nothing for the field to distinguish. Many manufacturers still document a specific value; use it when they do.
Where to find it
- The device's own display or settings menu. Usually under Communications, Modbus, or Network. This is the authoritative answer.
- DIP switches. Older equipment sets the address with a bank of small switches, read as binary — switches 1 and 3 on means address 5. The legend is normally printed next to them.
- The commissioning paperwork. Whoever set the chain up had to assign them, and they are usually written down.
- Sweep for it. Ask each ID in turn and see which ones answer. Slow, because every miss costs a timeout, but reliable.
Why a sweep is slow
There is no way to ask “which unit IDs are out there?” — Modbus has no discovery of any kind. So finding the occupied IDs means trying each one and waiting for the timeout on every empty one. Sweeping 1 to 32 at a one-second timeout is half a minute of mostly waiting, and a full sweep of 1 to 247 is several minutes. Start with 1 to 32, because installers rarely go higher than they need to.
Most Modbus masters ask one unit ID at a time, so a sweep is a loop: note every ID that replies — an exception reply counts, because it still proves something is there — and only widen the range if you need to.
Special values
- 0 is a broadcast address in the specification: every device acts on the command and none replies. Some gateways also use 0 to mean “whatever is there”. Not something to rely on.
- 255 is used by some Modbus TCP devices and other tools to mean “this device, no serial side involved”. If your tool only accepts 0–247 and 1 gets nothing, try 0.
- 248–254 are reserved and should not be used.
Two devices with the same unit ID
On a serial chain this produces symptoms that are easy to misdiagnose: both devices answer at once, the replies collide, and what comes back is garbage or nothing. Values appear intermittently or look like they are from the wrong device. If a chain worked until new equipment was added, a duplicated unit ID is the first thing to check.