Resolving Modbus Device ID Conflicts

What is Modbus ID

A modbus network relies on IDs of individual devices. Messages could be sent all over the network however the data is tagged from 1 to 247 (Modbus Basics restricts to addressing only 247 devices to a master). For example in a Modbus serial network utilizing RS-485 multidrop they can daisy chain up to 31 devices in total. However each of those devices must have its own unique ID number.

Since the Modbus master is the only device to send requests to the slaves they are not assigned any ID. The communication does not exist between the slaves.

What is Modbus TCP Gateway

The Modbus TCP Gateway is the device that will bridge the gap between the Modbus TCP protocols to the traditional Modbus Serial protocols. The gateway works like a relay device where it takes the requests from the TCP (Ethernet) side and then passes it off onto the Gateway’s serial side. Please note with this device the existing limitations such as Modbus Slaves daisy chained remains at 31 devices.

Benefits of using Modbus Gateway

Since the ID number is an important part of the Modbus protocol each individual device must be unique to the Master. However, in many legacy devices these IDs cannot be changed and are fixed. This creates a problem when you want to add additional products that have matching slave IDs. As our introduction above states, all IDs within the network must be unique as this will allow the information be transmitted to the correct slave device.

To overcome these legacy device limitations the use of Modbus TCP gateway will allow you to address individual slaves even with the same ID. The Modbus TCP gateway keeps track of the actual devices and assign it “virtual IDs”. This method is called ID shift and is illustrated below.

ID shift:

If the Modbus serial slaves have the same un-configurable ID, the way to communicate to these slaves is to shift their IDs to be different from each other when talking to the master. To do this, the following formula can be used for shifting the ID on the gateway configuration.

The Real Slave ID = Virtual Slave + Offset

You’ll see with the two examples below where two devices with the same ID can still be addressed by one master only by using a Modbus Gateway. In our 2nd case you can connect two separate networks to a single master by utilizing a modbus gateway. By using the ID shift on one network you can continue to communicate to multiple devices that are daisy chained.

Case 1: Multiple slave devices with same ID number, one slave device per serial port.

TCP master sends request to an ID 4 and 7 based on the existing software settings, and two slave devices with fixed ID 7 connect to port 1 and 2. A virtual ID can be assigned on one of them by the “offset” function.

When the request sends to ID 7 from master, the request will be sent to port one which has no “offset” value. The request will be passed through the gateway directly. When the request sends to ID 4, the gateway will process the request and add the offset value on the request to make it ID 7 and then send to the slave device.

In this case, no setting or configuration needs to be changed on the TCP Master. The “offset” value can be a positive or negative number.

Case 2: More than one RS-485 daisy-chain networks with duplicate IDs connect to the same Modbus master such as following.

With the virtual ID enable and set the “offset” to -10, these two networks can be placed in different ID segments.


The benefits of using these gateways can increase the usefulness of legacy sensors, I/O, PLC and other devices. By utilizing these Modbus gateways we can address multiple slave devices even with the same ID. This saves both on the cost of deployment and reduces the need of rewiring or purchasing new equipment.

Using the ID shift we can assign these “virtual IDs” that can be differentiated and the appropriate data can be received by the correct device.

The benefits of using the virtual slave ID are: 1.) assign a new ID to the slave devices with the same ID number, to save the cost of new Modbus slave devices; 2.) all the settings on the master software will remain the same. No additional configurations or settings are needed. We hope this has helped with any Modbus ID conflict.

Here are the Modbus TCP Gateway with above feature, and the software/utility which support it.

Related Articles