Knowledge/Interfaces explained/Modbus TCP

Interfaces explainedModbus TCP

What is Modbus TCP? Modbus over the network explained

Modbus TCP carries the proven Modbus protocol over Ethernet instead of a serial line. Registers and function codes stay the same, but every device has an IP address, and several systems can access it at the same time.

Key facts

  • Modbus TCP uses TCP/IP and port 502 by default.
  • A client asks, the server answers. In the Modbus RTU world they were called master and slave.
  • Instead of the CRC checksum, every telegram carries an MBAP header with transaction number and unit ID.
  • Registers and function codes are the same as with Modbus RTU.
  • Modbus TCP has no built-in authentication: metering devices belong in a network segment of their own.

On this page

How does Modbus TCP work?

The client sets up a TCP connection to the device, usually on port 502, and sends its request. The device answers over the same connection. Unlike Modbus RTU, nobody has to wait for the bus to be free: several clients can be connected at the same time, for example the building management system and an energy management system.

The checksum of the serial variant is dropped because TCP itself secures the transmission. Instead, every telegram is preceded by the MBAP header (Modbus Application Protocol Header):

FieldLengthContent
Transaction number2 bytesmatches the response to the request
Protocol identifier2 bytesalways 0 for Modbus
Length2 bytesnumber of following bytes
Unit ID1 byteaddress of the device behind a gateway; always 1 on the EMU Professional II

What is the difference between Modbus TCP and Modbus RTU?

FeatureModbus RTUModbus TCP
TransmissionRS485, two wiresEthernet
AddressingSlave address 1–247IP address, plus the unit ID
ProtectionCRC16 checksumTCP, MBAP header
Pollingone masterseveral clients at the same time
TopologyLine with terminating resistorsNetwork with switches
Speedtypically 9600 to 19200 baud10 or 100 Mbit/s

Both variants are compared in detail in the article Modbus TCP or Modbus RTU?.

How do Modbus RTU devices get onto the network?

With a gateway. A simple gateway accepts Modbus TCP requests and passes them on to the RS485 bus; the unit ID in the MBAP header determines which device on the bus is meant.

A data logger such as the EMU M-Center goes further: it reads the devices itself, stores the values and makes them available as a Modbus TCP server in a register table of its own. The control system then does not poll each meter over the bus, but the M-Center on the network.

What does IT need for Modbus TCP?

  • a fixed IP address or a DHCP reservation per device
  • a VLAN or network segment of its own for the metering devices
  • a firewall rule that allows only the polling system to access port 502
  • the register list with data types and word order from the manual

Modbus TCP itself knows neither password nor encryption. Anyone who can reach the device on the network can read its registers. The extension Modbus/TCP Security with TLS on port 802 only works with devices that explicitly support it.

Modbus TCP with EMU devices

The EMU Professional II power meter with Modbus TCP is available as EMU Professional II 3/100 for direct connection up to 100 A and as 3/5 for CT connection. The register table is on the product page. How Modbus TCP and MQTT differ on the same meter is shown on the page TCP/IP on the EMU Professional II.

The EMU M-Center makes M-Bus and Modbus RTU meters available as a Modbus TCP server, see M-Bus to Modbus TCP. For Loxone there are templates for the EMU Professional II, see EMU meters in Loxone.

Frequently asked questions


Which port does Modbus TCP use?

TCP port 502 by default. The encrypted variant Modbus/TCP Security uses port 802.

Does Modbus TCP run over Ethernet?

Yes. Modbus TCP uses TCP/IP and thus the normal Ethernet network, with switches, VLANs and routers. No bus line of its own is needed.

Do I need a slave address with Modbus TCP?

The device is addressed by its IP address. The unit ID in the MBAP header matters above all behind gateways, where it selects the device on the RS485 bus. On the EMU Professional II it is always 1.

Can several systems poll the same meter?

Yes, that is one of the advantages over Modbus RTU. How many simultaneous connections a device allows is stated in the manual.

What is the difference between Modbus TCP and MQTT?

With Modbus TCP a client fetches the values; with MQTT the meter sends them of its own accord to a broker. The comparison is on the page TCP/IP on the EMU Professional II.

Read more


SEITEPower meter with Modbus TCPEMU Professional II, registers and examples SEITEM-Bus to Modbus TCPGateway with the EMU M-Center SEITEModbus TCP or RTU?Decision guide for metering projects SEITEInterfaces explainedAll five interfaces compared

Bringing meters onto the network?


Send us the number of measuring points and the target system. We will tell you whether meters with Modbus TCP or an M-Center fit better.

Phone
+41 (0)41 545 03 00

Technical support
helpdesk [at] emuag.ch
Support form →