IndustrialPublished 7 min read

Modbus vs OPC UA vs MQTT: Which Protocol Fits a Factory Gateway?

Most factory Internet of Things (IoT) gateways use all three: Modbus reads meters, drives and older programmable logic controllers (PLCs), OPC UA (Open Platform Communications Unified Architecture) reads structured data from modern controllers, and MQTT (Message Queuing Telemetry Transport) publishes normalized data to a broker or cloud. This comparison explains where each fits and how to choose.

Modbus vs OPC UA vs MQTT: Which Protocol Fits a Factory Gateway?

Modbus, OPC UA (Open Platform Communications Unified Architecture) and MQTT (Message Queuing Telemetry Transport) are not competitors at the same layer. In a typical factory IoT gateway, Modbus and OPC UA are southbound protocols used to read machines, meters and PLCs (Programmable Logic Controllers), while MQTT is the northbound transport that publishes normalized data to a broker, historian or cloud platform. The real design question is which southbound protocol each asset supports and how the gateway maps that data into one consistent model.

What does each protocol actually do?

Modbus is a simple request and response protocol published in 1979 and still present in most energy meters, VFDs (Variable Frequency Drives), temperature controllers and older PLCs. Modbus RTU (Remote Terminal Unit) runs over RS485 serial lines, typically at 9,600 to 115,200 baud, and Modbus TCP runs over Ethernet on TCP port 502. Data is exposed as 16 bit registers and single bit coils with no built in names, units or types, so every integration starts from a register map supplied by the device vendor.

OPC UA, standardized as IEC 62541, is a service oriented framework rather than a register protocol. A server exposes an address space of typed nodes with names, engineering units, timestamps and quality codes, and clients can browse it, subscribe to changes and call methods. Security is part of the specification: application instance certificates based on X.509, message signing and encryption, and user authentication. Many modern PLCs, CNC (Computer Numerical Control) controllers and SCADA (Supervisory Control and Data Acquisition) servers ship with an OPC UA server, and companion specifications define standard models for machine types.

MQTT is a lightweight publish and subscribe protocol standardized by OASIS (MQTT 3.1.1 is also ISO/IEC 20922, and MQTT 5.0 is the current version). Devices and gateways publish to topics on a central broker, and any number of consumers subscribe. MQTT defines transport, not meaning, so industrial users often add the Eclipse Sparkplug specification, which fixes the topic namespace, payload encoding and device state handling so that consumers can discover data without custom agreements.

How do Modbus, OPC UA and MQTT compare side by side?

The table summarizes the differences that matter when you design a factory gateway.

Modbus vs OPC UA vs MQTT for factory IoT gateways
CriterionModbus RTU and Modbus TCPOPC UA (IEC 62541)MQTT (with optional Sparkplug)
Typical role in a gatewaySouthbound: meters, drives, older PLCsSouthbound: modern PLCs, CNC, SCADA serversNorthbound: gateway to broker, historian or cloud
Communication patternClient polls server (request and response)Client and server with subscriptions; PubSub also definedPublish and subscribe through a broker
Data modelRaw 16 bit registers and coils, no metadataTyped, browsable nodes with units, timestamps and qualityTopic plus payload; Sparkplug adds a defined model
Built in securityNone in classic Modbus; Modbus TCP Security adds TLS (Transport Layer Security)Certificates, signing, encryption, user authenticationTLS and client authentication provided by the broker
Physical layerRS485 serial or EthernetEthernet (TCP port 4840 by convention)Any TCP/IP link: Ethernet, WiFi, cellular
Change detectionGateway must poll and compare valuesServer side monitored items report changesPublisher decides when to send
Integration effort per assetLow protocol effort, high mapping effortModerate: certificates, browsing, namespace designLow on device side; topic and payload design matter
Typical weaknessRegister maps differ per vendor and firmwareHeavier stack, server licensing on some PLCsNo semantics without a convention such as Sparkplug

Which industrial protocols can be integrated into a factory IoT gateway?

A factory IoT gateway can integrate almost any industrial protocol for which a stable driver exists, but the practical list on a typical shop floor is short. The protocols below are common on brownfield plant equipment. Vendor specific protocols usually need either a licensed driver or the controller's own OPC UA server, which is often the cleaner option.

Protocols commonly integrated on the southbound side of a factory gateway:

  • Modbus RTU over RS485 and Modbus TCP over Ethernet for meters, drives, chillers and simple controllers.
  • OPC UA for modern PLCs, CNC controllers, robots and SCADA servers; OPC Classic DA (Data Access) through a wrapper on legacy Windows systems.
  • EtherNet/IP (Common Industrial Protocol, CIP) for Rockwell and compatible controllers, and PROFINET or Siemens S7 communication, often read through the PLC's OPC UA server.
  • Vendor serial or Ethernet protocols such as Mitsubishi SLMP and MC protocol, Omron FINS and Fanuc FOCAS for CNC data, where licensed drivers are available.
  • CAN (Controller Area Network) and SAE J1939 for mobile machinery, gensets and battery systems; IO Link through an IO Link master for smart sensors.
  • BACnet and Modbus for utilities, HVAC (Heating, Ventilation and Air Conditioning) and building systems connected to the plant.
  • Northbound: MQTT (optionally Sparkplug), HTTPS (Hypertext Transfer Protocol Secure) REST (Representational State Transfer) APIs, OPC UA server exposure to MES (Manufacturing Execution System), and store and forward buffering for network outages.

How do you choose the right protocol for each machine?

A repeatable selection procedure for a gateway project:

  • Step 1: Build an asset inventory listing every controller, meter and drive with its make, model, firmware version and available ports.
  • Step 2: For each asset, prefer an existing OPC UA server if one is licensed and enabled, because it brings names, units and quality codes.
  • Step 3: Where only Modbus is available, obtain the vendor register map, confirm byte and word order, scaling factors and polling limits.
  • Step 4: Define one plant data model (asset, tag name, unit, sampling interval) that all southbound sources are mapped into inside the gateway.
  • Step 5: Publish northbound over MQTT with TLS, using Sparkplug or a documented topic convention, so that consumers do not depend on southbound details.
  • Step 6: Size polling: total tags multiplied by polling rate must stay within what each RS485 segment or controller CPU can serve without affecting control.

As a rough sizing rule for illustration, a single RS485 segment at 19,200 baud carries roughly 1,750 bytes per second (11 bits per character); reading 10 registers costs about 33 bytes of request and response, about 19 ms on the wire, plus silent intervals and the device response delay, often tens of milliseconds in total, so a segment with 20 meters polled every second can already approach its practical limit. Measure on site before committing to sampling rates.

When does this comparison not apply?

This comparison assumes monitoring and data acquisition, not control. Writing setpoints or commands from a cloud platform into a PLC is a separate safety and cybersecurity decision that requires the plant controls owner's approval, interlocks and an OT (Operational Technology) security review under the IEC 62443 series. It also does not cover hard real time motion or safety networks such as PROFIsafe or CIP Safety, which must stay inside the control layer. Finally, if every machine already writes to a SCADA historian, reading the historian may be simpler than adding new connections to each PLC.

How should you decide?

Use OPC UA wherever the controller supports it, Modbus where it is the only option, and MQTT for everything leaving the gateway. Keep the mapping logic in one place in the gateway so that adding a machine means adding configuration, not new code. If you are unsure which assets expose what, a short readiness assessment that inventories controllers and tests one connection per protocol is cheaper than discovering gaps during rollout.

Sources and standards

Specifications referenced in this article:

  • Modbus Application Protocol Specification V1.1b3 and Modbus over Serial Line Specification (Modbus Organization)
  • IEC 62541 (OPC UA)
  • OASIS MQTT Version 5.0 and ISO/IEC 20922 (MQTT 3.1.1)
  • Eclipse Sparkplug Specification
  • IEC 62443 series (industrial automation and control systems security)
ModbusOPC UAMQTTIndustrial IoTIoT GatewayFactory Automation

EmbedCrest Engineering Team

Embedded Systems Engineers at EmbedCrest Technology

Embedded systems, IoT and Edge AI engineering, delivered from Kalyan, Maharashtra, India.

FAQ

Frequently Asked Questions

Which industrial protocols can be integrated into a factory IoT gateway?

Most gateways integrate Modbus RTU, Modbus TCP and OPC UA on the southbound side, plus EtherNet/IP, Siemens S7, Mitsubishi SLMP, Fanuc FOCAS, CAN, IO Link and BACnet where drivers exist. Northbound, MQTT with TLS is the usual choice, with REST APIs or an OPC UA server for MES. The final list depends on the asset inventory.

Is OPC UA replacing Modbus?

OPC UA is replacing Modbus in new controllers and higher level integration, but Modbus will remain in meters, drives and small devices for many years because it is simple and cheap to implement. A practical gateway supports both and maps them into one data model, so the choice is made per device rather than per plant.

Can MQTT talk directly to a PLC?

Some newer PLCs include an MQTT client and can publish directly to a broker, but most installed PLCs cannot. In those cases a gateway reads the PLC over OPC UA, Modbus or a vendor protocol and publishes the values over MQTT. Direct publishing still needs a defined topic and payload convention such as Sparkplug.

Is Modbus TCP secure enough for a connected factory?

Classic Modbus TCP has no authentication or encryption, so it should only run on a segmented OT network behind a firewall, never across the internet. The gateway should read Modbus locally and send data northbound over TLS. Modbus TCP Security adds TLS, but few installed devices support it.

Do I need Sparkplug if I already use MQTT?

You do not strictly need Sparkplug, but you need some documented convention for topics, payload encoding, units and device online state. Sparkplug provides that convention as an open specification, which helps when several vendors or software teams consume the same broker. Small single consumer projects can use a simpler, well documented topic scheme.

Ready to Build Your Embedded Solution?

From Edge AI to industrial IoT, our engineering team delivers end to end embedded systems solutions. Let us discuss your project requirements.

Discuss This With an Engineer