Connecting Prosys OPC UA Forge to Various MQTT Brokers

While Forge’s functions and capabilities expand, so does the demand for augmented connectivity. The offering of different MQTT brokers is growing fast, and we want to enable you to connect to the broker of your choice as quickly as possible.

This blog post will guide you through the steps to connect Prosys OPC UA Forge with prominent platforms such as Azure IoT Hub and Amazon IoT Core. In the future, this blog post will be updated with more MQTT brokers.

The MQTT brokers we have already tested are:

We are currently working to add the following MQTT brokers to this blog post:

  • Azure Event Grid
  • RabbitMQ
  • HiveMQ
  • Eclipse Mosquitto

If you don’t see your broker on the lists above and would like us to test it, contact us by email or via our contact form to let us know about the broker, and we’ll add it to our list.

Guides

You can find our finished guides below. Click on the tab you are interested in to read the guide for that specific MQTT broker.

Forge Publisher – Azure IoT Hub

During this tutorial, we will be using the following products:

  • Azure IoT Hub
  • Visual Studio Code with Azure IoT Hub extension

Connecting to Azure IoT Hub

  1. Create a new device in the IoT Hub.
  2. The connection information to the IoT Hub is as follows:
    • Connection address: mqtts://”Hostname”:8883
    • Client Id: “DeviceId”
    • Username: “Hostname”/”DeviceId”/?api-version=2021-04-12
    • Password: “SAS Token”
    • Queue: devices/”DeviceId”/messages/events/
    • Metadata Queue: devices/”DeviceId”/messages/events/metadata/
    • The hostname is the name of your IoT Hub, and it can be seen on the front page of the IoT Hub.
    • DeviceId is the name of the device you created.
  3. Generate the SAS Token with Visual Studio Code.
Generating password (SAS Token) for Azure IoT Hub in Visual Studio Code
  1. Open Prosys OPC UA Forge and add the OPC UA Publisher Module.
  2. In the OPC UA Publisher -tab, you will need to add at least a Connection, Writer Group, and either Variable or Event Data Set.
  3. Add a Connection to Azure using the connection information you previously collected.
Azure connection information in Forge
  1. Create a Writer Group and choose a Variable or Event Data Set that the Writer Group Publishes. Remember to add the correct MQTT Topic Settings to the Writer Group.
MQTT Topic settings for Azure IoT Hub
  1. The Publisher should now be enabled, and the IoT Hub should receive data. You can check the sent messages from Visual Studio Code.
Subscribing to Azure IoT Hub Publisher in Visual Studio Code

Forge Publisher – Amazon IoT Core – Forge Subscriber

During this tutorial, we will be using the following products:

  • Amazon IoT Core

Connecting to Amazon IoT Core

  1. Create a new single Thing in IoT Core/Manage/All devices/Things/Create Things.
  2. Enter a name for the Thing and set it to have no shadow.
  3. Auto-generate a new certificate and download all certificate files when prompted.
Certificate generation and downloading in AWS IoT Core
  1. Create a new policy, IoT Core/Manage/Security/Policies.
  2. Give the policy a name and fill in the policy document information as shown in the image below.
Policy document creation information in AWS IoT Core
  1. To attach the created policy, go to IoT Core/Manage/Things/”name of the created Thing”/Certificates and choose the certificate you wish to add the policy to.
Security Policies in Amazon IoT Core
  1. You can find the connection Endpoint from IoT Core/Test/MQTT test client/Connection details/Endpoint.
  2. Open Prosys OPC UA Forge and add the Publisher and Subscriber Modules.
  3. In the OPC UA Publisher -tab you will need to add at least a Connection, Writer Group, and either Variable or Event Data Set.
  4. Add a new Connection using the connection Endpoint from IoT Core and the certificates downloaded.
Forge connection screen for AWS IoT Core
  1. Create a Writer Group and choose a Variable or Event Data Set that the Writer Group Publishes.
  2. Now, you should see some data in the IoT Core/Test/MQTT test client.
  3. Use Subscriber wildcard * for the topic filter.
  4. Lastly, create an MQTT subscriber. In Forge/Data Sources/OPC UA Subscribers, add a new Subscriber using the same certificate files and Endpoint address as for the publisher.

Next Steps

To learn more about Forge and its capabilities, request a detailed introduction by emailing sales@prosysopc.com or using our contact form. We’d be delighted to provide tailored information about Forge that aligns with your interests and requirements.

If you want to test Forge yourself, we can provide you with an evaluation license to get you started. You can request an evaluation license by emailing our sales team or filling out the request form.

A generic vector graphic of an author avatar

Elias Nykänen

Software Engineer

Email: elias.nykanen@prosysopc.com

Leave a Comment

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

Scroll to Top