OPC UA to MQTT Integration (Step-by-Step Guide)


In the modern factory, the combination of OPC UA and MQTT is playing an increasingly decisive role in the seamless integration of OT and IT systems. OPC UA is used as a cross-platform OT standard for secure communication in automation technology. MQTT, on the other hand, offers the event-based and scalable interface between OT and IT. The growing popularity of the combination of both technologies, particularly within the Industrial Unified Namespace Architecture, also increases the need for seamless integration. The following step-by-step guide takes you through the process of how to integrate OPC UA with MQTT in a scalable way.


Options for OPC UA to MQTT Integration

In practice, OPC UA servers and clients are integrated into MQTT brokers in two ways: via a gateway or on the basis of direct communication using “OPC UA over MQTT”. The selection of the appropriate option depends on the specific use-case requirements and the existing infrastructure.

Options for OPC UA to MQTT Integration


1. Option: Gateway

One of the most common methods for integrating OPC UA with MQTT is the use of a gateway (software or hardware gateway). The gateway acts as a bridge between the OPC UA server and the MQTT broker. The gateway reads the data from OPC UA clients via the OPC UA server, transforms the data into MQTT messages and publishes these messages in the MQTT broker. This method is particularly suitable for the integration of brownfield systems that do not natively support “OPC UA over MQTT”.


2. Option: OPC UA over MQTT

With this option, the OPC UA server or client can transfer data directly to the MQTT broker as an MQTT message. The OPC UA server and clients themselves use the MQTT transport protocol to transfer the data to the broker. This option can be advantageous depending on the use case. However, this requires that both OPC UA servers and clients support the MQTT transport protocol (“OPC UA over MQTT”). This is defined in Part 14 “OPC UA Pub/Sub” of the OPC UA specification and must be implemented. This method is therefore particularly suitable in Greenfield scenarios. The specifications for new machines should include both Part 14 of the OPC UA specification and a defined and standardized OPC UA namespace. Caution: There is often confusion between OPC UA Pub/Sub (Part 14 of the specification) and the integrated subscription function in the OPC UA Client/Server model. This is merely a polling-based monitoring of variables in the OPC UA server. The client searches for changes on the server at defined intervals. Not to be confused with “OPC UA over MQTT”.


Step-by-Step Guide

As Part 14 of the OPC UA specification is not implemented as standard in today’s brownfield systems, the following instructions focus on option 1 (integration via gateway).

Step 1: Check the Prerequisites

Check the existing infrastructure and configure the necessary access rights to the systems to ensure reliable integration.

Check infrastructure: Check whether OPC UA Server and MQTT Broker are fully functional and set up a test environment. This allows you to test the integration and subsequent adjustments in a controlled environment before making changes in the production environment.

Select gateway: Ensure that your gateway natively supports OPC UA and MQTT protocols. Check compatibility with other relevant systems (e.g. controllers, ERP) in your OT/IT landscape. Ensure that the gateway offers the required security features. Depending on the use case, the gateway should meet additional requirements (e.g. redundancy, scalability).

Configure the network: Make the necessary adjustments to your network topology. This includes the configuration of ports and firewalls to enable communication and at the same time prevent unauthorized access.

Access and authorizations: Ensure that you have access to the OPC UA server, the MQTT broker and the gateway. This also includes the necessary user rights and authorizations to be able to make configurations. If necessary, install the corresponding configuration software for the systems.


Step 2: Identification of the relevant OPC UA Namespace

Check your OPC UA server to ensure that the server provides the relevant data points (nodes) securely and reliably. This includes identifying the OPC UA namespace (address space) relevant to the use-case. Identify OPC UA nodes: Determine which OPC UA nodes (data points such as sensor data, status information) are relevant for your use case. Check node types and attributes: Check whether the correct node types (e.g. Variable Nodes, Object Nodes) and attributes (BrowseName, DisplayName, Description and DataType) are assigned to the nodes.


Step 3: Definition of the MQTT Namespace

In OPC UA, the namespace is configured on the server side. In contrast, the MQTT namespace is created in collaboration between the publisher and subscriber. Compliance with a standardized structure is crucial for effective communication and data organization in MQTT. This step includes:

Standardization of the MQTT topic hierarchy: A topic is a UTF-8 string that specifies the path under which a message is published. Clients can publish messages to these topics or subscribe to topics to receive messages. Define guidelines for the naming of these topics, taking best practices into account, to ensure consistency.

Standardization of the MQTT message content (payload): The definition of a standardized payload is essential for interoperability and scalability, especially in the case of a heterogeneous machine park. To do this, create a data model that includes the following components:

    • Uniform structure of the payload, including metadata (e.g. machine type and ID) and their representation within the MQTT topics
    • Standardized data format, for example JSON or XML, to simplify data processing and integration
    • Standardized data types and naming conventions to ensure the uniqueness and comprehensibility of the data.


Step 4: Mapping of the OPC UA and MQTT Namespace

In this step, you establish a connection between the gateway, the OPC UA server and the MQTT broker. The gateway acts as a bridge between the two protocols and translates OPC UA data into standardized MQTT messages. Connection test: Check the connectivity between your OPC UA server, gateway and the MQTT broker. Pay particular attention to compliance with the security guidelines. This includes the correct setup of authentication and encryption methods.

Mapping of the MQTT payload: Map the relevant nodes from the OPC UA namespace to the data model defined in step 3. If necessary, complete the data model with static inputs (e.g. for metadata such as machine type and ID).

Mapping of the MQTT topics: Specify how the MQTT payloads are mapped to the MQTT topics. This can include simple 1:1 mappings or, depending on the use-case requirements, require more complex transformations.

Implement transformation logic: Use the functionalities of your gateway to perform the required data conversions. This can include the scaling of measured values, the conversion of data types or the aggregation of data points.

Mapping of the OPC UA and MQTT Namespace


Step 5: Integration of OPC UA and MQTT in the Test Environment

Define data transmission: Specify when the OPC data should be updated in MQTT. The update can take place when changes are made to specific OPC nodes (best practice) or according to a predefined cycle (e.g. every second). You can also define important MQTT settings such as Quality of Service (QoS), Retain and Report by Exception.

Check data integrity: Ensure that the data in your test environment flows correctly from the OPC UA server via the gateway to the MQTT broker and that all security mechanisms work as planned.


Step 6: Go-live and Monitoring

Go-live: After successful testing, you can put the OPC UA to MQTT integration into production.

Set up monitoring: Implement monitoring and alerting features to continuously monitor system performance and data transmission integrity.

Logging and diagnostics: Ensure that detailed logs are available for troubleshooting and optimizing system performance.



The combination of OPC UA and MQTT opens up new possibilities for intelligent and connected factories. Choosing the right integration method is crucial for success. By implementing a scalable integration strategy, companies can demonstrably increase efficiency, boost productivity and ultimately improve their competitiveness. The standardized mapping of the OPC UA and MQTT namespace across systems and factories is a key aspect of successful integration. In existing factories (brownfield), this is usually done via a gateway (software or hardware), which should support the scaling and standardization of the MQTT namespace throughout the entire company.

About i-flow: At i-flow, we are dedicated to empowering manufacturers with the world’s most intuitive software to seamlessly connect factories at scale. Over 400 million data operations daily in production-critical environments not only demonstrate the scalability of the software, but also the deep trust our customers place in i-flow. Close cooperation with our customers and partners worldwide, including renowned Fortune 500 companies and industry leaders such as Bosch, Sto and Lenze, is at the heart of our business.

Try it out now - free trial version

Experience the unlimited possibilities that i-flow offers by taking a test for yourself. Test now for 30 days free of charge on your systems.

Your question has not been answered? Contact us.

Our data policy applies.

Your Contact:

Marieke Severiens (i-flow GmbH)