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.
- Azure IoT Hub
- Amazon IoT Core
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
- Create a new device in the IoT Hub.
- 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.
- Generate the SAS Token with Visual Studio Code.
![vscode_sas - Prosys OPC - Prosys OPC Generating password (SAS Token) for Azure IoT Hub in Visual Studio Code](https://prosysopc.com/wp-content/uploads/vscode_sas.webp)
- Open Prosys OPC UA Forge and add the OPC UA Publisher Module.
- In the OPC UA Publisher -tab, you will need to add at least a Connection, Writer Group, and either Variable or Event Data Set.
- Add a Connection to Azure using the connection information you previously collected.
![forge_connection - Prosys OPC - Prosys OPC Azure connection information in Forge](https://prosysopc.com/wp-content/uploads/forge_connection-1024x988.webp)
- 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.
![writer_group - Prosys OPC - Prosys OPC MQTT Topic settings for Azure IoT Hub](https://prosysopc.com/wp-content/uploads/writer_group-1024x306.webp)
- The Publisher should now be enabled, and the IoT Hub should receive data. You can check the sent messages from Visual Studio Code.
![vscode_c2d - Prosys OPC - Prosys OPC Subscribing to Azure IoT Hub Publisher in Visual Studio Code](https://prosysopc.com/wp-content/uploads/vscode_c2d.webp)
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
- Create a new single Thing in IoT Core/Manage/All devices/Things/Create Things.
- Enter a name for the Thing and set it to have no shadow.
- Auto-generate a new certificate and download all certificate files when prompted.
![aws_load_cert - Prosys OPC - Prosys OPC Certificate generation and downloading in AWS IoT Core](https://prosysopc.com/wp-content/uploads/aws_load_cert-660x1024.webp)
- Create a new policy, IoT Core/Manage/Security/Policies.
- Give the policy a name and fill in the policy document information as shown in the image below.
![aws_policy - Prosys OPC - Prosys OPC Policy document creation information in AWS IoT Core](https://prosysopc.com/wp-content/uploads/aws_policy-1024x296.webp)
- 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.
![aws_attach_policy - Prosys OPC - Prosys OPC Security Policies in Amazon IoT Core](https://prosysopc.com/wp-content/uploads/aws_attach_policy-1024x195.webp)
- You can find the connection Endpoint from IoT Core/Test/MQTT test client/Connection details/Endpoint.
- Open Prosys OPC UA Forge and add the Publisher and Subscriber Modules.
- In the OPC UA Publisher -tab you will need to add at least a Connection, Writer Group, and either Variable or Event Data Set.
- Add a new Connection using the connection Endpoint from IoT Core and the certificates downloaded.
![aws_connection - Prosys OPC - Prosys OPC Forge connection screen for AWS IoT Core](https://prosysopc.com/wp-content/uploads/aws_connection-942x1024.webp)
- Create a Writer Group and choose a Variable or Event Data Set that the Writer Group Publishes.
- Now, you should see some data in the IoT Core/Test/MQTT test client.
- Use Subscriber wildcard * for the topic filter.
- 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.
![author-general-avatar - Prosys OPC - Prosys OPC A generic vector graphic of an author avatar](https://prosysopc.com/wp-content/uploads/2022/07/author-general-avatar.webp)
Elias Nykänen
Software Engineer
Email: elias.nykanen@prosysopc.com