
"Let's do everything in MQTT, OK?" Or: "The machine builder gives us OPC UA, do we also need MQTT?" The question comes up often at the start of a project, before anyone knows which machines will arrive. Behind it there is usually an article or a demo that pits one against the other.
It is the wrong question. It compares two things that work at different points: one talks to the machine, the other carries the data to whoever uses it. Even inside OPC UA the specification defines two exchange models, client/server and publish/subscribe, and describes them as complementary: the first for configuration, control and on-demand reads, the second for distributing real-time data (OPC 10000-1, 5.6).
In the project behind my note on the Unified Namespace I use both, each in its place. I read machines that expose an OPC UA server over OPC UA. From the middleware up, all data travels on MQTT.
01What each one does well
Reads the machine
OPC UA
An information model: typed nodes linked by references, which a client can browse without knowing them in advance (OPC 10000-1, 5.3.4 and 6.6). Every value comes with a quality code and, if the source provides one, its own timestamp (OPC 10000-4, 7.11).
The client reads, subscribes, writes and calls methods, inside a session. Trust goes through the applications' certificates.
The limit, in the client/server model: every system that wants the data opens its own session to the machine, or goes through a server that aggregates them.
Distributes the data
MQTT
Publish/subscribe through a broker: the publisher does not know who reads, and one message reaches many. Lightweight, also designed for low-bandwidth networks (OASIS, MQTT 5.0).
If a client has set one up and disappears without saying goodbye, the broker publishes its "last will" message on its behalf (section 3.1.2.5).
The limit: it is only transport. Content and format of the message are the application's business (section 3.3.3 of the specification).
02Where I put them
The adapter is the point where one protocol ends and the other begins. Each machine has its own: for those with an OPC UA server it is an OPC UA client with subscriptions; for the others it speaks FINS or S7, reads a file or calls an API. The mapper brings everything back to one standard object, and only that goes onto the broker.
Each in its place
Towards the machine its own language, OPC UA when available; from the middleware up one format, on MQTT
Whoever consumes the data does not know which language the machine spoke, and does not need to. Whoever acquires the data does not know who will use it. That decoupling is what I care about, not the protocol itself.
03When OPC UA is enough
A few machines, all with an OPC UA server, and a single system reading them: a SCADA, or the MES. There I do not add a broker. It would be one more component to install, protect, make highly available and watch, with no concrete benefit.
I add it when the systems reading the data become more than one or two, when the data must leave the cell towards systems that must not see the PLCs, or when I know more machines are coming. Even without a broker, though, I define the standard object from day one. Then, when I add MQTT, I change the transport without reopening the meaning of the data.
04When MQTT is enough
The opposite case: new sensors and devices with an MQTT client on board, or machine builders' gateways that already publish. It works when the data is simple and whoever publishes it also decides its meaning.
The risk is that everyone publishes with their own topics and their own format. MQTT does not prevent it: it fixes neither the topic structure nor the message format, and that is the gap Sparkplug explicitly sets out to fill (Sparkplug 3.0, 1.1). This is why I connect a device that publishes over MQTT directly only if it follows the topic convention and the standard object. Otherwise it goes through a mapper like any other machine.
A device that is "already MQTT" with a format of its own is one more system to integrate, not one less.
05The model does not come from the protocol
OPC UA has a rich information model, MQTT has none. It is tempting to think that the model, then, comes from OPC UA. In a mixed fleet of machines, it does not.
There are companion specifications, OPC UA information models shared by an industry or a type of machine. But they apply where someone implements them, and not to machines that do not speak OPC UA.
I use the OPC UA model for reading: to browse the machine, understand types and units, read quality and timestamps. But in the project OPC UA is just one of the languages the machines speak, alongside FINS, S7, files and APIs, and the common model must also work for the one that writes a CSV for every part. I define the model in the standard object, and from OPC UA I bring in what is needed:
- the machine and its context, the workcenter;
- the source timestamp, not the arrival time;
- the quality of the value, because an invalid value is not a zero;
- the unit of measure.
The meaning of the data is decided in the standard object, not in the protocol.
06OPC UA on top of MQTT
There is also a third way, which makes the original question even stranger: OPC UA over MQTT. Part 14 of the specification, PubSub, lets you publish OPC UA data without a session, either without a broker, over UDP or directly over Ethernet, or through an MQTT broker (OPC 10000-14, 5.4.6 and 7.3). On MQTT it defines a topic convention, by default along the lines of opcua/json/data/<publisher>/…, and two message formats: JSON or binary UADP (OPC 10000-14, 7.3.4).
I don't use it in the project I'm describing here. The idea makes sense: it carries OPC UA data and metadata over MQTT. The practical limit is that you need a publisher that supports it, in the machine or in the gateway. My view is the same as for Sparkplug B: it makes sense when you must interoperate with other people's systems through a shared standard. When I control the architecture and the parties involved, I do not add a constraint without a concrete benefit.
07Security, where it hurts
Certificates
Every application has its own, and trust goes through trust lists. They need renewing and updating over time (OPC 10000-1, 5.7.3), and nobody does it unless it is written down who does.
SecurityPolicy None
During commissioning people connect without security "just to try", or accept any certificate. Then it stays that way.
Credentials and permissions
TLS is the easy part. The problem is a single user for all clients, and topics anyone can write to.
The typical failure makes no noise: a certificate expires and at the next reconnect the channel no longer opens, the machine keeps producing and the data stops arriving. That is why I schedule renewal, with a named owner, rather than leaving it to chance. For MQTT I want one identity per client and write permissions only on the topics it is responsible for: the specification leaves these choices to whoever designs the system (OASIS, MQTT 5.0, chapter 5). The case of the certificate that does not match the address, behind a NAT, is in Two machines, the same address.
08The most common mistake
Choosing the protocol before knowing who consumes the data. People start from "all MQTT" or "all OPC UA", and the requirements surface later: how many systems read, what has to be written to the machine, who decides the meaning of each piece of data.
Two mistakes I often see follow from that. The first is thinking that MQTT brings interoperability on its own: it carries bytes, not meaning. Without a convention for topics and messages the tangle does not go away, it moves onto the broker. The second is sending commands and writes to the PLCs through the broker, on any topic, without confirmation of execution and without an agreement with the automation team. On MQTT, at QoS 1, a successful PUBACK confirms that the broker has accepted the message, not that the machine has executed it. I keep writes to the machine on a controlled channel, with confirmation of execution.
Before choosing the protocol
The questions I ask
- Who consumes the data today, and who will in two years.
- Which machines already expose OPC UA, and which speak something else.
- Where the meaning of the data is decided, and who is accountable for it.
- What has to be written to the machine, and with which confirmations.
- Who manages certificates, credentials and permissions after commissioning.
If the answers say a single system reading and machines that all have OPC UA, OPC UA is enough. If they say devices that already publish over MQTT following the common convention, MQTT is enough. Otherwise I use both, each in its place.
Sources (6)
- OPC Foundation, OPC 10000-1: Overview and Concepts, version 1.05.06, October 2025: AddressSpace (5.3.4), synergy between client/server and PubSub (5.6), certificate management (5.7.3), node browsing (6.6).
- OPC Foundation, OPC 10000-4: Services, version 1.05.07, April 2026: DataValue, with quality and source timestamp (7.11).
- OPC Foundation, UA Companion Specifications: industry information models.
- OPC Foundation, OPC 10000-14: PubSub, version 1.05.06, October 2025: broker-less and broker-based middleware (5.4.6), transport protocol mappings (7.3), MQTT mapping, topics and security (7.3.4).
- OASIS, MQTT Version 5.0, OASIS standard, 2019: content-agnostic transport (abstract and 3.3.3), Will Message (3.1.2.5), PUBACK (3.4 and 4.3.2), security (chapter 5).
- Eclipse Foundation, Sparkplug Specification 3.0.0, November 2022: topics and payload that MQTT does not define, and state management built on MQTT's native features (1.1).


