IoT Guide

OPC UA to MQTT — Industrial Bridge and Unified Namespace

OPC UA client to MQTT publisher bridge: Unified Namespace, Sparkplug B, HiveMQ, AWS IoT. Comparison of OPC UA and Modbus, security, modern IIoT architecture.

Quick answer
A OPC UA → MQTT bridge connects to your servers (PLCs, SCADA systems, robots) as an OPC UA client and publishes the values of the subscribed nodes in MQTT JSON or Sparkplug B to a cloud broker. It is the cornerstone of theUnified Namespace (UNS), the Industry 4.0 reference architecture for centralizing all production data.

OPC UA: The Industry 4.0 Protocol

OPC UA (OPC Unified Architecture, IEC 62541) is the standard protocol for Industry 4.0. Unlike Modbus, which exposes registers without context, OPC UA exposes an object-oriented information model: each variable is a typed node in a hierarchical address space, with metadata (engineering unit, range, description), callable methods, and events.

Modern PLCs (Siemens S7-1500, Beckhoff CX, Rockwell ControlLogix), robots, and recent SCADA systems all include an OPC UA server. The OPC UA → MQTT bridge allows you to extract this rich data and feed it into the cloud architecture.

Architecture of the OPC UA → MQTT Bridge

Serveurs OPC UA Bridge Eziwan MQTT Broker / UNS
─────────────── ────────────── ─────────────────
Siemens PLC ─┐ ┌── HiveMQ Cloud OPC UA Client
Robot Beckhoff ─┤── TCP ───►│ Subscriptions MQTT AWS IoT Core
SCADA Ignition ─┤ │ MonitoredItems ──TLS► Mosquitto
MES Wonderware ─┘ │ Decode + Map Eziwan UNS
└── Sparkplug B / JSON

The bridge maintains a persistent OPC UA connection with each server. It creates OPC UA subscriptions with MonitoredItems on the nodes to be monitored. The server proactively sends updated values (push mode), which is much more efficient than Modbus polling.

Mapping OPC UA Nodes to MQTT Topics

Configuring the bridge involves mapping OPC UA NodeIDs to MQTT topics. There are two approaches:

Manual Mapping

OPC UA NodeID → Topic MQTT
ns=2;s=Station1.Pump.Pressure → plant/line1/pump01/pressure_bar
ns=2;s=Station1.Pump.Flow → plant/line1/pump01/flow_m3h
ns=2;s=Station1.Pump.Status → plant/line1/pump01/status

Automatic Mapping (OPC UA → UNS) The bridge scans the OPC UA address space and automatically generates a mirrored MQTT topic hierarchy. This is the recommended approach for installations with many nodes.

Unified Namespace: OPC UA as the Single Source of Truth

The Unified Namespace (UNS) is the modern IIoT architecture recommended by Industry 4.0 experts. It uses a central MQTT broker (HiveMQ, EMQX, VerneMQ) as a single data hub:

SourcePublication in the UNS
PLCs (OPC UA)OPC UA → MQTT Bridge
Legacy devices (Modbus RTU)Modbus → MQTT bridge
M-Bus metersM-Bus → MQTT bridge
MES / ERPAPI → MQTT
IoT sensorsNative MQTT

All applications (SCADA, MES, dashboards, AI) subscribe to the MQTT broker as needed. No more point-to-point integrations: each system publishes once, and all consumers receive the data.

Sparkplug B: The Specification for Industrial UNS

Sparkplug B (Eclipse Foundation, spBv1.0) standardizes the use of MQTT for the IIoT:

Topic Structure:

spBv1.0/{group_id}/NBIRTH/{edge_node_id} ← Node connection
spBv1.0/{group_id}/DBIRTH/{edge_node_id}/{device_id} ← Connexion device
spBv1.0/{group_id}/NDATA/{edge_node_id} ← Node data
spBv1.0/{group_id}/DDATA/{edge_node_id}/{device_id} ← Device data
spBv1.0/{group_id}/NDEATH/{edge_node_id} ← Disconnect (LWT)

Sparkplug B Benefits:

  • Protobuf payload (binary, 3 to 10 times more compact than JSON)
  • Device lifecycle management (BIRTH/DEATH)
  • Metrics aliases to reduce bandwidth
  • Compatibility with HiveMQ Sparkplug Extension, Ignition Cirrus Link, and AWS IoT SiteWise

OPC UA + MQTT Security: Defense in Depth

The combination of OPC UA and MQTT provides two layers of security:

OPC UA Layer (field → bridge):

  • Security Mode: Sign & Encrypt (AES-256)
  • Authentication: x509 certificate or username/password
  • Validation of server and client certificates

MQTT layer (bridge → cloud):

  • Transport: TLS 1.3
  • Authentication: x509 client certificate (mutual TLS)
  • Authorization: ACL by topic on the broker

This defense-in-depth architecture complies with the IEC 62443 recommendations for the cybersecurity of industrial systems.

Compatibility with Major Cloud Platforms

PlatformProtocolSpecific module
AWS IoT CoreMQTT TLSAWS IoT SiteWise (native OPC UA)
Azure IoT HubMQTT / AMQPAzure IoT OPC Publisher (open source)
HiveMQ CloudMQTT 5.0 + SparkplugNative Sparkplug Extension
Eziwan CloudMQTT TLSIntegrated dashboard and alerts
Ignition (Inductive Automation)MQTT TransmissionCirrus Link Sparkplug Module

Frequently Asked Questions

You might also like