Send OPC UA Data to Azure With HiveMQ and MQTT

Send OPC UA Data to Azure With HiveMQ and MQTT

author Kudzai Manditereza

Written by Kudzai Manditereza

Category: HiveMQ

Published: March 17, 2022


It is often said that manufacturing organizations are data rich but information poor. I couldn’t agree more, as large amounts of data that could help manufacturers improve the productivity of their plants and personnel, and the quality of the goods they produce, remain trapped in production assets such as PLCs, industrial equipment, Supervisory Control, and Data Acquisition Systems (SCADA), Manufacturing Execution System (MES) and Process Historians.

In order to extract insights that could positively and significantly impact their industrial and business processes, manufacturers need to integrate real-time and historical data from those systems that are already operating on the factory floor, into platforms with powerful analytics software such as Azure Cloud.

The question is, how do you technically collect data from these factory floor systems and forward it to Azure Cloud?

A typical feature of most production systems is that they embed an OPC UA Server that exposes production-related data. And while it’s entirely possible to host an OPC UA Client on Azure to consume this data, the resulting system would be complex as it would require components such as OPC Twin, OPC publisher, and OPC Discovery on the edge within the plant, and OPC Twin, OPC Registry, OPC vault in the cloud for a robust solution.

Further, it would also be difficult to scale such a system due to inefficiencies inherent in the client-server communication pattern. On the other hand, using a publish-subscribe communication pattern to collect the OPC UA based telemetry data would result in a system that is scalable, future-proof, and easy to implement.

In the video below, I demonstrate how to use MQTT, a pub-sub communication protocol, to collect and send OPC UA data to Azure with HiveMQ MQTT broker for analytics using Azure Time-Series Insights analytics software. It’s also important to note here that the demo doesn’t use Azure IoT Hub for coordinating MQTT messages as it is not a 100% MQTT compliant broker.

Here’s the outline of the demo:

System Architecture

  • Deploying HiveMQ MQTT Broker Cluster on Azure Cloud
  • Configuring HiveMQ Kafka Extension for forwarding MQTT messages to Azure Event Hubs Service
  • Creating and configuring Azure Event Hubs service
  • Configuring KepserverEX OPC UA Server to expose factory floor data
  • Building a DotNet application to collect OPC UA data and publish it to HiveMQ broker on Azure
  • Visualising the information using Azure Time-Series Insights
author Kudzai Manditereza

About Kudzai Manditereza

Kudzai is an experienced Technology Communicator and Electronic Engineer based in Germany. As a Developer Advocate at HiveMQ, his goals include creating compelling content to help developers and architects adopt MQTT and HiveMQ for their IIoT projects. In addition to his primary job functions, Kudzai runs a popular YouTube channel and Podcast where he teaches and talks about IIoT and Smart Manufacturing technologies. He has since been recognized as one of the Top 100 global influential personas talking about Industry 4.0 online.

Follow Kudzai on LinkedIn

mail icon Contact Kudzai
newer posts What is the best way to ingest IoT data to Microsoft Azure?
UNS, ISA95 and MQTT Sparkplug in Industry 4.0 older posts