« All blog posts

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.

OPC UA over MQTT image

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

Pyry Grönholm

CEO

Email: pyry.gronholm@prosysopc.com

Tags: OPC UA, MQTT, PubSub

comments powered by Disqus

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.

Read more about us »

Newest blog posts

Introducing Prosys OPC UA Edge

The very first blog post about Prosys OPC UA Edge. The article introduces the main features and functionalities of the EDGE software.

Windows DCOM Hardening And OPC Classic Applications

How do the Windows DCOM hardening changes affect your OPC Classic applications.

OPC UA vs MQTT (or OPC UA over MQTT)

Our input on the debate of the differences between OPC UA and MQTT and how actually there is competition.

View all blog posts »

-->