Email Us at [email protected]

Download N3uron

Back to videos

MQTT Client / Connecting MQTT Client to Azure

Connecting MQTT Client to Azure

Description

In this video of our N3uron Academy, we’ll configure the N3uron MQTT Client to connect to Azure IoT Hub. Let’s get started!

  • [04:46] Connecting MQTT Client to Azure

Transcription

[00:00] Hello everyone! In this video, we’ll configure the N3uron MQTT Client to connect to Azure IoT Hub. We’ll acquire shaft temperature, gearbox temperature, and wind speed data from three wind turbines via the SQL Client module and publish it to Azure IoT Hub. To follow along with this tutorial, you will need to install Azure IoT Explorer on your computer. This tool will help configure our IoT device and verify data flow to Azure IoT Hub. First, navigate to your Azure Portal account and ensure you have an active subscription, a Resource Group, and an IoT Hub resource configured. If you do not have an IoT Hub resource yet, you can create one by clicking on the “Create a resource” shortcut, selecting “IoT Hub” from the “Internet of Things” section, and following the on-screen instructions.

[01:01] More details can be found in the N3uron Knowledge Base. Since I already have an IoT Hub resource ready, I will navigate to it, select “Shared Access Policies,” and choose “iothubowner” to start creating a new device. Next, I will copy the Primary Connection String from the right-hand panel. Now, open the Azure IoT Explorer program and click on the “Add connection” button. Paste the Primary Connection String in the Connection String text box and click “Save.” In the Devices section, click on the “New” button and enter a name for your device. In this example, we will name it “N3uron_Gateway.” For Authentication Type, select “Symmetric key,” check the “Auto-generate keys” field, and click “Create.” After creating the new device identity, expand the “Connection string with SAS token” section. In the Symmetric key drop-down menu, select “Primary Key.” Enter a sufficiently high value in the “Expiration” field, click on “Generate,” and copy the part of the SAS token connection string from the Shared Access Signature and equal sign onwards.

[02:02] Next, let’s configure the MQTT Client module in N3uron. In the Navigation panel, select “Config.” Then, in the Explorer panel, select “Modules.” Click on the “Model” menu and select “New Module.” Assign a name to the module, such as “MqttClient.” In the Explorer panel, select the MQTT Client instance you have just created. Navigate to the module header, click on the burger menu, and select “New Connection.” Name the connection something like “Azure_IoT_Hub.” For the Destination Broker, select “Azure IoT Hub.” In the Password field, paste the SAS token connection string copied earlier. For the Username field, enter the Hostname of your Azure IoT Hub, followed by a forward slash and the name of the device, in this case: N3-IoT.azure-devices.net/N3uron_Gateway. In the Broker URL field, enter the Hostname of your Azure IoT Hub.

[03:01] Leave the remaining settings at their default values. Now, let’s create a new publisher agent to publish the turbine data. Change the Publishing Interval to 5000ms. For the topic, we must use the precise syntax that Azure IoT Hub requires: devices, forward slash, the device ID, which in this case is N3uron_Gateway, forward slash, messages, forward slash, events, and forward slash. Additionally, I’ll modify the message format so that the date is represented as an ISO string, while all other settings remain at their default values. Next, create a new filter to include all the tags from the root folder. Save the changes and navigate to the “Diagnostics” tab to check if the MQTT connection is working correctly and if data is being published successfully. To verify data flow in Azure IoT Explorer, open the program, select the “N3uron_Gateway” device, navigate to the “Telemetry” section, and click on “Start.”

[04:01] You should see data being published to Azure IoT Hub. And that’s it! We’ve successfully set up and configured N3uron’s MQTT Client to establish a connection and transmit real-time data to Azure IoT Hub. Thanks for watching, and see you in the next video!

Privacy Settings
We use cookies to enhance your experience while using our website. If you are using our Services via a browser you can restrict, block or remove cookies through your web browser settings. We also use content and scripts from third parties that may use tracking technologies. You can selectively provide your consent below to allow such third party embeds. For complete information about the cookies we use, data we collect and how we process them, please check our Privacy Policy
Youtube
Consent to display content from - Youtube
Vimeo
Consent to display content from - Vimeo
Google Maps
Consent to display content from - Google
Spotify
Consent to display content from - Spotify
Sound Cloud
Consent to display content from - Sound