Menu

Modbus Slave ID and Unit ID

Modbus slave ID and unit ID overview covering RTU addressing, TCP unit handling, gateway routing, and broadcast address behavior.

Categories:

What It Is

Every Modbus request needs a target device address. On serial Modbus RTU networks this is usually called the Slave ID. On Modbus TCP networks it is usually called the Unit ID.

They serve the same practical role: identify the target device or route the request through a gateway path.

The important practical distinction is that the Unit ID in Modbus TCP is often trivial on standalone Ethernet devices but becomes critical when a gateway bridges TCP requests to a downstream serial network. In those cases, the Unit ID is often the actual routing key to the target RTU device.

Address Ranges

ContextField NameTypical Valid RangeNotes
Modbus RTUSlave ID1 to 247Must be unique on the serial bus
Modbus TCPUnit ID0 to 255Often simplified for standalone TCP devices
BroadcastAddress 0Special caseDevices act, but do not respond

Why It Matters

ScenarioImpact
Duplicate RTU addressesCauses collisions or confusing responses
Wrong Unit ID through a TCP-to-RTU gatewayRequest reaches the wrong downstream device or no device at all
Broadcast used unintentionallyNo response is returned, which can look like a timeout

Common Failure Modes

Failure PatternWhat Usually HappenedPractical Result
Duplicate serial addressTwo RTU devices share one Slave IDResponses collide or appear inconsistent
Gateway routing assumption is wrongThe TCP Unit ID was treated like a cosmetic fieldRequests never reach the intended downstream device
Broadcast was used during normal validationAddress 0 was sent without understanding the behaviorThe device may act, but no response comes back
Standalone TCP device ignored Unit ID differently than expectedThe device handles Unit ID loosely or vendor-specificallyOne tool works while another appears broken

Commissioning Notes

Address validation should prove one known-good request to the actual intended device, not only a generic response from somewhere on the path. On serial links, that means confirming uniqueness on the bus. Through gateways, it means confirming the TCP Unit ID maps to the right downstream target and not just to any responding device.

[!WARNING] When a gateway bridges Modbus TCP to Modbus RTU, the Unit ID in the TCP request often maps directly to the RTU Slave ID on the serial side. A wrong Unit ID is then a routing mistake, not just a cosmetic field mismatch.