OPC UA vs MQTT (or OPC UA over MQTT)
12.01.2023
Definitions
MQTT is a lightweight, TCP/IP-based publish-subscribe network protocol that transports messages between devices. It is designed for connections with remote locations where a "small code footprint" is required or the network bandwidth can be limited.
OPC UA is a platform-independent, service-oriented, open, and secure communication architecture. It is designed to enable the interoperability of industrial automation devices, systems, and software applications from different vendors. OPC UA information model defines the data encoding and format of the data transported with various transport protocols.
OPC UA over MQTT is one of the protocols supporting OPC UA publish/subscribe specification. It aims to define how to transport OPC UA information models using the MQTT transport protocol.
OPC UA or MQTT
The question above is something I get asked rather frequently. While checking the comparisons made, they are mostly rather biased and not exactly reflecting the real world by assuming that factories are full of the latest technology.
First of all. The question is actually like comparing trucks and pallets. One is made to carry the other. MQTT is a way to transfer messages from one place to another, while OPC UA is more about standardising the message format that is carried by some transfer method.
Of course, the answer above is typically not what anyone is looking for; I will list a few more hands-on examples of the differences for you. In this post, I will cover the differences between OPC UA Client/Server and propriety payload MQTT messaging, which are the most common behind the question.
Let’s begin with remembering that OPC UA is a request-response two-way communication while MQTT is one-way communication. If you need a response to your call in OPC UA, your client gets it automatically, as, in MQTT, you need to make it asynchronously with customised code.
Another difference is OPC UA has a security built-in (six out of seven traditional aspects of security). In MQTT, you need to implement the security yourself and especially when the number of publishers and subscribers increases, it gets complicated.
OPC UA payload is standardised in a way that with standard browse and subscribe functions; any OPC UA can be configured to read and write to any OPC UA Server. In MQTT, the payload is typically different in each case, and coding is needed to interpret the payload of different publishers.
MQTT topic tree, especially when no encryption is used, provides an easy way for auto-configuration. OPC UA address space also enables auto-configuration, even when data transport is encrypted, but requires more expertise and effort from the programmer.
MQTT publishers and subscribers are very easy to implement using open-source libraries in a few days. Programming an OPC UA client or server takes a few weeks to implement using the commercial SDK and a bit more using the open-source.
MQTT scales to millions of values in millions of publishers. OPC UA clients may easily connect to hundreds of servers and dozens of thousands of nodes.
In the current reality of 2023, the OPC UA Client/Server is superior to MQTT when it comes to the integration of OT data sources into traditional factory IT. MQTT is, on the other hand, typically convenient when OT data is integrated into Industry 4.0 Cloud IT due to the easy autoconfiguration. In these cases, I suggest using OPC UA over MQTT, as it will enable you to use the best part of OPC UA’s standardised payload.
If I look a dozen years into the future, I predict that the use of MQTT and especially version 5+ will become mainstream, while the adoption of OPC UA Pub/Sub and Open industry 4.0 Alliance Open Edge Computation Guidelines will be de facto industrial standards.
After all, for deterministic secure communication between MES, Scada and Controller, for example, I don’t see that there will be any good alternatives for OPC UA even in the future. In these use cases, you want to be sure you have established communication and to get synchronous acknowledgement that your write operation was successful.
If you have any questions, feel free to directly contact the author, Pyry Grönholm or Prosys OPC Sales using our contact form.

Pyry Grönholm
CEO
Email: pyry.gronholm@prosysopc.com
About Prosys OPC Ltd
Prosys OPC is a leading provider of professional OPC software and services with over 20 years of experience in the field. OPC and OPC UA (Unified Architecture) are communications standards used especially by industrial and high-tech companies.
Newest blog posts
OPC UA PubSub to Cloud via MQTT
Detailed overview of the demo presented at the OPC Foundation booth
SimServer How To #3: Simulate data changes on a server using an OPC UA client
A two-part step-by-step tutorial on how to write data changes on an OPC UA server using an OPC UA client.
How to Succeed in the Production Analytics Project
Industry 4.0 analytics projects are going to be Significantly rising business in the next couple of years. Read how to bypass the most common cavepits and delivery projects succesfully.