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.
Prosys OPC UA Forge is an Edge Gateway product that enables easier Operational Technology (OT) and Information Technology (IT) integrations. This is done by reducing complexity and enabling data harmonization, simple business logic features, and straightforward cloud connectivity setup.
Introduction
The question above is something I get asked rather frequently. While checking the comparisons made, they are mostly rather biased and do not exactly reflect 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 standardizing the message format that is carried by some transfer method.
Of course, the answer above is typically different from 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.
OPC UA or MQTT
Let’s begin with remembering that OPC UA is a request-response two-way communication while MQTT is a 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 customized code.
Another difference is that OPC UA has built-in security (six out of seven traditional security aspects). 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.
Current Reality
In the current reality of 2023, the OPC UA Client/Server is superior to MQTT when it comes to integrating 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 auto-configuration. In these cases, I suggest using OPC UA over MQTT, as it will enable you to use the best part of OPC UA’s standardized payload.
Prosys OPC UA Forge is a middleware application that, among its various features, enables the conversion between OPC UA Client/Server and OPC UA over MQTT. Although the most common use case involves publishing data from OPC UA Servers to the Cloud using OPC UA over MQTT, the conversion can also be performed in the opposite direction. This allows writing data published on the MQTT broker to set points or other variables in an OPC UA Server.
Future Glance
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 acknowledgment that your write operation was successful.
More Information and Testing
If you have any questions, feel free to directly contact the author, Pyry Grönholm or Prosys OPC Sales using our contact form.
To try Prosys OPC UA Forge, you can request the software download on the product page. For more information about the solution, subscribe to our RSS feed and follow us on social media, which are great options. We’ll be posting tutorials and other interesting details in the coming months.
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
Why Do Standards Matter in Smart Manufacturing?
The blog post discusses the importance of standards in smart manufacturing, envisioning a future where auto-configurable systems in manufacturing rely on standardized data formats for seamless integration and reduced costs, with a focus on the OPC UA standard family as a key enabler.
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.