If you are connecting machines to SCADA, MES, a data platform or the cloud, two protocols dominate the conversation: OPC UA and MQTT. They are frequently framed as an either/or decision. In practice, they answer different questions:

  • OPC UA answers "What does this data mean, and how do I access it securely?" It is a complete framework for describing industrial equipment and exchanging data with it.
  • MQTT answers "How do I get messages from many producers to many consumers efficiently?" It is a lightweight transport that deliberately says nothing about what the messages contain.

Understanding that distinction makes most architecture decisions straightforward.

What is OPC UA?

OPC Unified Architecture (OPC UA) is a platform-independent industrial interoperability framework maintained by the OPC Foundation and published internationally as IEC 62541. It succeeded "OPC Classic", which depended on Microsoft COM/DCOM.

Key characteristics:

  • Information modeling. OPC UA servers expose an address space of nodes — objects, variables, methods and types — with relationships between them. Data arrives with its engineering units, ranges, data types and context.
  • Companion specifications. Industry groups publish standard information models for specific equipment, such as machine tools, robotics, packaging machines and process instruments. A client can understand any compliant device without custom mapping.
  • Two communication patterns. The classic client/server model (browse, read, write, subscribe, call methods) and a PubSub model (OPC UA Part 14) that can run over UDP or over message brokers including MQTT.
  • Built-in security. Application authentication with X.509 certificates, message signing and encryption, and user authentication and authorization are part of the specification.

What is MQTT?

MQTT is a lightweight publish/subscribe messaging protocol standardized by OASIS. Version 3.1.1 is also published as ISO/IEC 20922, and MQTT 5.0 (2019) added features such as reason codes, message expiry, shared subscriptions and user properties.

Key characteristics:

  • Broker-based publish/subscribe. Clients publish messages to topics on a central broker; other clients subscribe to topics. Producers and consumers never talk to each other directly.
  • Report by exception. Devices publish only when data changes, which drastically reduces bandwidth compared with polling.
  • Outbound connections. Edge devices connect out to the broker, which works well through firewalls and NAT — a significant advantage for remote assets.
  • Quality of Service levels. QoS 0 (at most once), QoS 1 (at least once) and QoS 2 (exactly once).
  • Payload-agnostic. MQTT carries bytes. Topic structure, payload format and semantics are entirely up to you.

That last point is MQTT's greatest strength and its biggest weakness in industrial settings: without conventions, every integration invents its own topic tree and JSON format.

Sparkplug: adding industrial semantics to MQTT

Sparkplug, an Eclipse Foundation specification, fills that gap. It defines a topic namespace, a compact Protocol Buffers payload, and state management using birth and death certificates so that subscribers always know whether an edge node and its data are online and current. Sparkplug 3.0 has also been published as ISO/IEC 20237.

Sparkplug is popular in architectures built around a Unified Namespace (UNS) — a central broker where every system publishes its current state in a consistent hierarchy, typically modeled on ISA-95 levels (enterprise / site / area / line / cell).

Side-by-side comparison

CriterionOPC UA (client/server)MQTT (+ Sparkplug)
Primary purposeInteroperability and information modelingEfficient message distribution
Communication modelClient/server; PubSub also availablePublish/subscribe via broker
Data semanticsRich, standardized (companion specs)None in MQTT; basic in Sparkplug
Connection directionClient connects to server (often inbound to the machine)Clients connect outbound to broker
SecurityCertificates, signing, encryption, user roles built inTLS plus broker authentication and ACLs
Scaling to many consumersEach client holds sessions with each serverBroker fans out to any number of subscribers
FootprintHeavier; nano/micro profiles existVery light
Typical homeMachine and cell level, vendor-neutral device accessEdge-to-enterprise and edge-to-cloud data distribution

When to choose OPC UA

  • You need vendor-neutral access to PLCs, CNCs, robots or instruments, with rich context and browsable structure.
  • You need commands and methods, not just telemetry — for example, writing setpoints or starting a job with confirmation.
  • A companion specification already exists for your equipment class.
  • You are integrating at the machine-to-machine or machine-to-SCADA level inside a plant network.

When to choose MQTT

  • Many consumers — historians, analytics, MES, cloud services — need the same data.
  • Devices are remote or bandwidth-constrained, such as oil and gas wellheads, water utilities or mobile equipment.
  • You are building a Unified Namespace or an event-driven architecture.
  • You want to decouple producers from consumers so systems can be added without touching the edge.

The common answer: use both

Most modern architectures combine the two:

  1. OPC UA at the edge to read structured data from controllers and machines.
  2. An edge gateway that normalizes data and publishes it via MQTT/Sparkplug to a broker.
  3. Enterprise and cloud applications subscribe to the broker.

OPC UA PubSub over MQTT is another bridge between the two worlds: it keeps OPC UA's information model while using an MQTT broker for transport.

Security checklist for either protocol

  • Never expose OPC UA servers or MQTT brokers directly to the internet.
  • Use OPC UA security mode SignAndEncrypt and manage certificates deliberately — avoid blanket "trust all" settings.
  • For MQTT, require TLS, unique credentials per client, and topic-level access control lists.
  • Place brokers and gateways in a DMZ or dedicated zone, consistent with an IEC 62443 zones-and-conduits design.