Enabling Rapid Interoperability Between OPC UA & MQTT Sparkplug B

5 min read

Jul 21, 2022 2:00:00 PM

Ongoing digital transformation and operational visibility initiatives continue to demand the integration of different systems using different technologies. With increased adoption of secure OPC UA and MQTT Sparkplug B, it’s only to be expected that users will have systems that support one or the other technology but need to communicate with each other.

Although OPC UA supports a publish-subscribe mechanism with OPC UA PubSub, and adoption of OPC UA is strong and growing, the reality is there will be situations where the user is already using MQTT Sparkplug B and needs to integrate it with OPC UA or vice-versa, without writing custom code or going through complex configuration.

Software Toolbox was founded in 1996 on the principal of making data and device integration easy by using configurable off-the-shelf software to avoiding writing custom solutions and knowing the pros and cons of and ins and outs of many technologies. That mission remains strong, as you’ll see, as we discuss interoperating between OPC UA and MQTT in this blog post.

So, if you're not familiar with Sparkplug B for MQTT, there are certainly a wide variety of online resources providing detail on what it is with varying degrees of depth. For simplicity and the purposes of this post, though, Sparkplug B takes the openness of MQTT and enhances its usability and reliability by giving it some structure for greater compatibility between the MQTT clients and brokers supporting it.

Namely, Sparkplug B clearly defines topic addressing and namespace so that there’s no ambiguity between clients and brokers, which ensures greater interoperability. To draw somewhat of a parallel with OPC UA, the companion specifications and modeling capabilities available in the OPC UA standards provide a means to add structure and organization beyond just basic data points. We’re sure there are purists out there reading that may wish to debate which is better but, given our mission of automation interoperability, we’re here to talk about that interoperability, not to pick which technology is right, better, or whatever measure you prefer to use!

Additionally, to increase reliability, Sparkplug B employs a mechanism for state management that builds on the previously existing MQTT last will and testament to include the use of birth and death messages, which provide greater visibility into the current state of the connection. This is important for giving users awareness into the health of the connection so they can rely on the data being provided (i.e. no one wants to make critical decisions based on stale data).

You've likely heard of at least some of the long-established benefits of OPC UA with respect to secure and reliable remote connectivity and its proliferation for bringing together data from the farthest edge of a user’s enterprise for use in analytics, big data and decision making. So having the ability to take process data from OPC UA sources and publish that data to MQTT Sparkplug B brokers (for access by Sparkplug B capable clients) is a natural progression towards the greater goal of connecting any and all systems for comprehensive control and monitoring of an enterprise. Let’s look at how the already strong and recently extended support for OPC standards in Cogent DataHub® can help users and integrators using different technologies to achieve interoperability without custom code or complex configuration.

The Version 10 release of Cogent DataHub® adds OPC UA Alarms & Conditions (UA A&C) and OPC UA Historical data support to its already strong support for OPC UA client and server for real-time data, OPC Classic DA and Alarms & Events (A&E) and many other data sources.


Cogent DataHub’s OPC UA implementation is known for its strong OPC UA secure certificate management, rapid OPC UA configuration abilities, strong interoperability, and connection troubleshooting tools that guide a user through the OPC UA connection.

Once an OPC data point is in the Cogent DataHub, it’s automatically made available to any other interface supported by the solution, including all its supported OPC UA interfaces. This principal combined with the solution’s ability to integrate and tunnel data through DMZ’s and proxies to avoid any open ports on IT or OT networks, have made it a natural choice for integrating technologies in the rapidly evolving security landscape.


In the OPC world, the DataHub is a secure, rapidly configurable gateway between OPC DA and OPC UA, OPC Classic A&E and OPC UA A&C.


Datahub-Gateway-DA-UA-AEWhen Cogent DataHub V10 added support for MQTT Sparkplug B in both its MQTT client and MQTT broker interfaces, providing the functionality to act as a primary app, non-primary app and EoN device, it took this concept of instant conversion a step further. Now users can achieve automatic conversion between MQTT SparkplugB clients and brokers and OPC UA. They just enable the interfaces and then data in the Cogent DataHub sourced via MQTT can be exposed via OPC UA. No code and no complex configuration is required unlike multi-vendor solutions for the same problem.

Datahub-MQTT-ClientRecognizing the high variability in device message formats, Cogent DataHub uniquely supports the ability to handle multiple JSON formats per MQTT connection for greater flexibility, which adds further value to the MQTT to OPC UA conversion capabilities.

Users of OPC UA standards may not realize some of the details involved with using MQTT nor want to be experts at them. Users and integrators typically want interoperability and Cogent DataHub delivers in several ways. The smart capabilities of DataHub’s MQTT client/broker functionality many complex details involved in using MQTT in industrial control and SCADA applications are transparent to the user, especially in larger systems with multiple SCADA nodes, device types and more. For example, the Sparkplug B support automatically creates DataHub tags from Sparkplug B topics and the data they provide, without any complicated parsing required.

And in a world where new security vulnerabilities are popping up regularly, the DataHub MQTT broker can disable writes from any MQTT client connection, allowing you to only permit writes from fully trusted MQTT clients. That security coupled with the powerful encryption and authentication security of underlying OPC UA real-time, alarms & conditions, and historical data sources supported by Cogent DataHub along with its secure advanced tunneling, provides additional peace of mind that your process networks are safe.

If you're interested in learning more, you can access free on-demand video training that shows how to configure Cogent DataHub for MQTT Sparkplug B and a video on how to configure OPC UA connections using the links below:

WATCH NOW - Configuring Cogent DataHub OPC UA Connections

WATCH NOW - Configuring Cogent DataHub for MQTT Sparkplug B

And don't forget to subscribe to our blog to find out about more relevant technical topics applying to industrial process automation and solving related challenges.

Ready to access integrate your own OPC UA and MQTT Sparkplug B systems using DataHub?

Integrate OPC UA and MQTT Sparkplug B Data Sources using Cogent DataHub

John Weber
Written by John Weber

Software Toolbox Technical Blog

We're engineers like you, so this blog focuses on "How to" appnotes, videos, tech team tips, product update announcements, user case studies, and other technical updates.  Subscribe to updates below. Your feedback and questions on posts are always welcomed - just use the area at the bottom of any post.

Subscribe to our Blog

Recent Posts

Posts by Topic

See all