OPC UA PubSub to Cloud via MQTT

In the demo, we use the Raspberry Pi 4 platform, where we have created an OPC UA PubSub solution that publishes JSON packaged data over MQTT protocol.

As hardware we chose the base Raspberry Pi 4 with the touchscreen addon. Using Prosys OPC UA SDK for Java, our team created a lightweight sample publisher that would serve as the basis for our demo. The demo is divided into two parts: a built-in event visualiser and the actual MQTT PubSub cloud connection.

Cloud Demo Image
Figure 1. The basic structure of the demo.

The event visualiser was configured into the demo to mimic a subscriber and show the JSON formatted data. Data contains sample values and simulated alarms and events generated by the publisher. This visualiser is additionally connected to a custom Web application that displays the sample data using MQTT-compatible JSON package form.

Raspberry Pi Screen
Figure 2. Screenshot of the Web APP showing sample data.

With the visualized PubSub connection ready, we configured an MQTT forwarder to publish the JSON sample data into the cloud. Using the MQTT protocol, we connect the PubSub demo to the SPS 2022 Marketing Broker. We also have a sample publisher running on a separate machine that sends data to the cloud connectivity wall of the OPC Foundation.

For the final version of the demo, everything is configured to run automatically on the Raspberry Pi 4 upon startup. The process begins by starting the sample publisher and opening the chromium-browser in the kiosk to autorun the visualiser application. Lastly, we connect the Mosquitto MQTT broker to the publisher and start sending the data to the cloud.

In addition to the PubSub MQTT cloud connection created with Prosys OPC UA SDK for Java, our free software Prosys OPC UA Simulation Server and Prosys OPC UA Browser are compatible with the 64-bit Raspberry Pi OS for future solutions. Both applications have built-in PubSub capabilities. You can read about them on our blog.

If you’re interested in the demo, our PubSub capabilities, or would like to ask any other questions, send an email to sales@prosysopc.com.


  • JSON = Java Script Object Notation
  • MQTT = Message Queuing Telemetry Transport
  • OPC UA = OPC Unified Architecture
  • PubSub = Publisher/Subscriber model
  • SDK = Software Development Kit

Tools Used

  • Prosys OPC UA SDK for Java: Development kit for OPC UA
  • Mosquitto: Open-source MQTT broker
  • Spring: Open-source backend for the Web Application
  • Vaadin: Open-source frontend for the Web Application
Headshot of Henri Toivola

Henri Toivola

Sales Engineer, Prosys OPC

Email: henri.toivola@prosysopc.com

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top