Configuring Raspberry Pi With Azure IoT Hub

Introduction

This article is the continuation of my previous article in which I have explained about Azure hub Service and the method of creating an IoT hub in Azure portal. You can find it in the
link.

Here, in this article, we are going to add our IoT device in IoT hub with the help of Windows IoT Core Dashboard. Before we get into it, have a look over the screenshot. In the screenshot given below, there are no devices added in IoT hub Service. Also, the data transfer is nil.

 

IoT Core Dashboard

The IoT Core Dashboard is a tool, which is used for writing IoT Core operating system to the USB devices, which are used for booting the Raspberrry Pi. You can find the tool in the site.

Once you download it, simply boot  up your Raspberry Pi. Make sure that your PC and the Raspberry Pi are connected to the same network. If they are in the same network, you can find your Raspberry Pi under the menu 'My devices'.

 

Connecting to the Azure from IoT core Dashboard

Now, click 'Connect to Azure' option and click 'Sign in' option. This will prompt you to sign  into the Azure portal. Give your Azure credentials and login to the portal. Make sure to give the same Azure portal details to access the IoT hub Service, which you have already created.




You can now even create a new IoT hub from this Window. Since we already created the IoT hub, we can make use of the same. Now, we need to create a new device ID, which will be stored in IoT hub of Azure. This will help Azure to access your device and to store the data of it in a separate directory. To create a new device ID, click on the Create new device option. Once you click on it, you will be asked to enter a new name for the device. Give some name by which you would like to register your device in Azure IoT hub and click 'Create' button.
 
 
 

Now, a separate ID will be created for your Raspberry Pi in IoT hub in Azure portal. Now, there will be an option called Device to provision. This provisioning will register your device in IoT hub. Now, click 'Provision' button. This will take the details of Raspberry Pi to IoT hub and it will register the device in the hub. Once it is provisioned, you will be notified with a message. This indicates that your device is registered in IoT hub.

 
 

Checking the registered device in the hub

Again, open your portal and go to IoT hub Service, which you have created previously. In the beginning of this article, I have shown in a screenshot that there are no devices found in the hub. I have marked it in the screenshot. Have a look over it again, if you don’t remember. Since we have provisioned our device now, the device is already configured in IoT hub Service. You can have a look over the screenshot below to find the change. Now, if you click on the devices option in the top, you can see the set of all devices which you have connected. Since you have connected one device now, you will see only one. The usage meter given below will measure the amount of data, which is sent and received. You can find the connection string from the device option too.

 

Conclusion

Thus, in this article, we have learned the process of connecting our IoT device to Azure IoT hub Service. This also made us create a new registry ID for our IoT device namely Raspberry Pi. In the future articles, I will try to explore Azure along with Raspberry Pi. I hope you liked my way of explanation. Thank you.

Up Next
    Ebook Download
    View all
    Learn
    View all