MQTT vs OPC UA: Which Should Carry Your Plant Data?
MQTT and OPC UA solve different problems, so the right choice depends on what you need the data to do. MQTT is a lightweight publish/subscribe messaging protocol. It is good at moving values from many sources to many consumers through a central broker. OPC UA is an industrial interoperability standard that combines communication with a rich information model, so a client can browse, read, write and call methods on a server that describes its own data. Many plants end up using OPC UA close to the machines and MQTT to distribute data upward. The questions below help you decide where each belongs on your site.
How does publish/subscribe differ from client/server?
In MQTT, devices and applications do not talk to each other directly. A publisher sends a message to a broker under a named topic, such as a line, machine and measurement. Any subscriber interested in that topic receives the message. The publisher does not need to know who is listening, and new consumers can be added without changing the source.
In the classic OPC UA model, a client connects to a server, usually one embedded in a PLC, gateway or software package, and asks for what it needs. The client can browse the server's address space, read values, write setpoints, subscribe to changes on that connection and call methods. The relationship is direct and session-based.
OPC UA also defines a publish/subscribe mode, and that mode can run over MQTT as a transport. Support for PubSub varies between products, so check what your equipment offers before relying on it.
What this means for a plant manager:
- Publish/subscribe decouples sources from consumers. It suits one-to-many distribution, such as sending machine states to a dashboard, a historian and a maintenance system at the same time.
- Client/server suits interaction. An engineering tool or SCADA system can find out what a machine offers and act on it.
What does each protocol say about the data itself?
This is often the deciding difference.
MQTT defines how a message is delivered. It does not define what the message contains. The payload might be JSON, a compact binary format or plain text, and the topic naming is up to whoever designs the system. Two vendors can both "support MQTT" and still produce data that cannot be combined without mapping. Conventions such as Sparkplug add structure on top of MQTT, but you have to choose them and enforce them.
OPC UA includes an information model. Nodes have data types, engineering units, descriptions, relationships and quality status. Companion specifications describe common equipment types in a standard way. Check whether one exists for your equipment type. A client can therefore learn what a value means as well as what number it currently holds.
If your data already suffers from inconsistent naming and units, MQTT alone will move the inconsistency faster. The guide to standardising engineering units in plant data covers the groundwork, and our plain-language guide to OPC UA for plant managers explains the information model in more depth.
How do MQTT and OPC UA compare on security?
Both can be operated securely. Both can also be deployed insecurely.
MQTT relies on the transport and the broker. Encryption comes from TLS. Authentication uses usernames and passwords or client certificates. Authorisation, meaning which client may publish or subscribe to which topics, is a broker configuration matter, and brokers differ in how they handle it. A broker left with anonymous access and no TLS exposes every topic.
OPC UA builds security into the protocol. It supports message signing and encryption, application certificates, user authentication and security policies negotiated per connection. The weak points tend to be operational: certificate management, servers left in a "None" security mode for convenience, and accepting untrusted certificates during commissioning and never revisiting the decision.
One architectural difference matters for networks. MQTT clients make outbound connections to the broker, which can make it easier to send data out of a protected machine network without opening inbound ports. OPC UA clients connect into servers, so where the servers sit relative to your network zones needs thought. See separating machine networks from office networks before you decide where either protocol crosses a boundary.
Have security design reviewed by someone qualified for your site. Neither protocol makes a network secure on its own.
Where does each one fit? A side-by-side comparison
| Aspect | MQTT | OPC UA |
|---|---|---|
| Communication pattern | Publish/subscribe through a broker | Client/server sessions; PubSub also defined |
| Data model | None built in; payload and topics defined by you | Rich typed information model with metadata |
| Discovery | Subscribers need to know topic names | Clients can browse the server's address space |
| Writing and commands | Possible, but no standard command semantics | Standard writes and method calls |
| Security | TLS, credentials and broker access rules | Built-in signing, encryption, certificates, user auth |
| Network direction | Clients connect outbound to the broker | Clients connect inbound to servers |
| Typical strength | Distributing data to many consumers efficiently | Structured, interoperable access to machines |
| Typical location | Edge to site systems, site to enterprise or cloud | Machine and cell level, SCADA and MES integration |
| Main risk | Unstructured payloads and inconsistent topics | Configuration effort and certificate management |
When is a combination the sensible answer?
A common illustrative pattern looks like this. A gateway or edge device connects to PLCs as an OPC UA client, or through a native driver where OPC UA is not available. It reads the structured data, applies names, units and context, and publishes the results to an MQTT broker. Dashboards, the historian and higher-level systems subscribe to the broker.
This keeps rich, browsable access close to the equipment and gives you loose coupling higher up. The gateway becomes an important component, so choose it carefully. Our guide to choosing an industrial protocol gateway covers what to check, and collecting data from an existing PLC covers the source side.
Which questions should decide it for your plant?
Work through this checklist before committing:
- [ ] What do your existing PLCs, drives and software already support natively?
- [ ] Do consumers only need to read values, or must they also write setpoints and commands?
- [ ] How many systems will consume the same data, now and later?
- [ ] Who will own the naming convention, units and payload format?
- [ ] Where do network zone boundaries sit, and which direction may connections cross them?
- [ ] Who will manage certificates and credentials after handover?
- ] What happens to data when a link drops? See [buffering plant data during network outages.
- [ ] Does your team have the skills to support the chosen design?
What mistakes should you avoid?
Treating the protocol choice as a data strategy. Neither protocol cleans data or settles naming disputes. Agree the data structure first.
Assuming "MQTT compatible" means interoperable. Ask for the payload format and topic structure in writing.
Running OPC UA without security to save commissioning time. Temporary settings tend to become permanent. Put the security review on the handover list.
Using MQTT for control commands without defined behaviour. If a message is delayed, duplicated or lost, the machine's response must still be safe and predictable. Define PLC behaviour on communication loss, and involve a qualified assessor wherever safety functions are affected.
Making the broker or gateway a hidden single point of failure. Decide what availability it needs and who supports it.
When does this comparison not apply?
If your only consumer is a single SCADA system that already uses a native PLC driver, adding either protocol may bring cost without benefit. Likewise, safety-rated communication and time-critical machine control run on dedicated fieldbus and safety protocols. MQTT and OPC UA in their usual forms are not substitutes for these.
Frequently asked questions
Is MQTT replacing OPC UA?
No. They overlap less than the comparison suggests. MQTT is a transport for messages, and OPC UA is a model and protocol for interoperable data access. Many architectures use both.
Can OPC UA run over MQTT?
Yes. The OPC UA PubSub specification defines MQTT as one of its transports, which combines OPC UA's information model with broker-based distribution. Check that the equipment and software you have support it before designing around it.
Which is easier to set up?
A basic MQTT link is usually quicker to start. The ongoing work of keeping topics and payloads consistent comes later. OPC UA takes more configuration up front, particularly for security, but it gives you more structure from the start.
Do we need a broker for OPC UA?
Not for client/server communication, which connects clients directly to servers. A broker is only involved if you use OPC UA PubSub over MQTT.
Can we start with one and add the other later?
Usually, yes, if the data structure is agreed early. Talk to us through the services page if you want an independent review of your plant data architecture.