The leader in industrial automation and control solutions

Overview

This guide explains how to set up a device on Azure IoT Hub and utilize MQTT features in EBPro. It’s important to note that while the IoT Hub functions as an MQTT message broker, it may not fully support all behaviors specified in the MQTT v3.1.1 standard.

For more detailed information, please visit the Microsoft Azure website at:
https://learn.microsoft.com/en-us/azure/iot/iot-mqtt-connect-to-iot-hub

Additionally, the CMT X series offers a straightforward way to connect with devices on the IoT Hub using the MQTT protocol through simple configuration in EBPro. This guide provides a step-by-step walkthrough of setting up IoT Hub devices and configuring EBPro.

Setting up Devices on IoT Hub

The IoT Hub is located within Microsoft Azure, and all configurations are performed through the web portal. To get started, you need to register as a user on the Azure website by following these steps:

Instructions: Setting up Devices on IoT Hub
  1. Create new Account

    Visit the Microsoft Azure website at https://portal.azure.com and register for a new account.
    Azure sign-in screen. Log into your Microsoft Azure account if you have one, or register for an Azure account if you do not.
  2. Search for IoT Hub

    After logging in, search for “IoT Hub”.
    Azure search bar: IoT Hub
  3. Add a new IoT Hub

    Once in the IoT Hub interface, click on +Create to add a new IoT Hub.
    Adding a new IoT Hub in Microsoft Azure
  4. Configure IoT Hub Parameters

    Configure the Subscription, Resource group, IoT hub name, Region, and Tier according to your preferences. Leave the remaining settings as default and click Review + create.
    Azure IoT Hub configuration screen. Configure the Subscription, Resource group, IoT hub name, Region, and Tier according to your preferences. Leave the remaining settings as default and click Review + create.
  5. Open the newly-created IoT Hub

    Click on the IoT Hub created in step 5 to access it.
    Opening the newly-created Azure IoT Hub
  6. Add a new Device

    Within the IoT Hub, click on +Add Device to add a new device.
    Adding a new Device to the IoT hub by clicking the + sign
  7. Configure Device Parameters and Save

    Configure the Device ID, select Auto generate keys, set the authentication type to Symmetric key, and enable Connect this device to an IoT hub. Then, click Save to add the device.
    Configure the Device ID, select Auto generate keys, set the authentication type to Symmetric key, and enable Connect this device to an IoT hub
  8. Configure Device Settings

    Click on the device created in step 8 to access its settings.
    Configure the settings of the newly-created device.
  9. Copy Primary Connection String

    Copy the primary connection string.
    This will be used in the MQTT settings in EBPro, so please ensure that you remember it.
    Copy the Primary Connection String. This string will be used in your EBPro project, so ensure to remember it or store it in a safe location.

EasyBuilder Pro Settings

How to configure devices from the Azure IoT Hub in EBPro.

Instructions: EasyBuilder Pro Settings
  1. Create a new MQTT Object.

    Click on IIoT/Energy > MQTT to open the MQTT settings page.
    Image of the EBPro IIOT/Energy toolbar, showing the MQTT and OPC UA Server icons. To create a new Azure IoT hub server device, select the MQTT option to open the settings page.
  2. Configure General Tab Properties

    General settings: Choose Azure IoT Hub as the cloud service, use the primary connection string obtained earlier for the connection string, and leave the remaining settings as default.
    Configure the Azure IoT Hub connection settings in the General tab
  3. Configure Address Tab Properties

    Address settings: Configure the relevant parameters for the address.
    MQT Server, Address tab. This is the settings for the status, buffer and control address configuration.
  4. Confgure TLS/SSL Tab Properties

    TLS/SSL settings: Import the CA certificate. To use the CA certificate, download and import DigiCert Global Root G2.
    Configuring the TLS/SSL settings for our Azure IoT Hub device connection
  5. Publishing / Subscribing Clarification

    After completing the server configuration, the IoT Hub is not a fully functional MQTT broker and may not support all the behaviors specified in the MQTT v3.1.1 standard. Therefore, follow the instructions below for publishing and subscribing to topics.
  6. Publishing

    After the device is connected, the HMI will use “devices/{device-id}/messages/events/” or “devices/{device-id}/messages/events/{property-bag}” as the topic name to send messages to the IoT Hub.
    EBPro Publishing General tab with JSON (simple) content format.
  7. Subscribing

    To receive messages from the IoT Hub, use “devices/{device-id}/messages/devicebound/#” as the topic filter to subscribe to the topic.
    Note: Since “#” is a reserved character in EBPro, you need to use dynamic string and set the “#” as the string content during runtime.
    Subscribing to a topic with Azure IoT Hub.