Introduction
In the following article, we are going to discuss the method of creating IoT Hub service which is used for connecting your device to the Azure cloud services for remote access to your devices. When connected to an IoT Hub, you can send and receive messages from your device. Using the same concept, you can control the device with commands. Let us proceed with an explanation about the creation of IoT Hub and the process of creating it.
IoT Hub
An IOT Hub is like a normal hub connection except that is located in Azure cloud service and also, it is mainly configured for the Azure services for IoT devices. You can make us of this IoT Hub and add your IoT devices to the hub. Once you have configured your device to the hub, you can send and receive the data to the IoT device. You can connect multiple devices to a single hub. However, the increase in the number of devices will increase the cost of the service. After you configure your device to the hub, you can use the connection string of it to connect your device to the hub from your application. I hope, this gives you a little idea about the hub. Now, let us see the method of creating a hub.
Creating IoT Hub
As usual, login to your Azure portal. You can make use of the Hub Service for free of cost too. There is a free service for hub in which you can connect one IoT device. To create a Hub, go to New >> Internet of Things >> IoT Hub.
Configuring the Hub
- You will be shown a new window in which the name of the Hub Service will be asked. Enter the name of your choice.
- Now, click on the Pricing and Scale tier option. This will display the set of configurations and the cost of each. You can choose the tier service as you need. The tier service which is of free cost is capable of handling only one IoT device per Hub. If you need to handle multiple devices, you can choose a different pricing tier which can fulfill your requirement.
- Now, select the subscription you need and choose the resource group to allocate the service for easy access.
- Finally, elect the region of storage and click on the "Create" button.
Accessing the Hub
Once the Hub is created, go to the resource group which you have used to create the service and click on the Hub Service you have created. Once you click on the service, you can find the Configuration menu for the service in which you can make changes to your service and all other things.
You will see the monitor and the amount of data which has been sent and received from the device. There at the top, you can find that no devices are added to the service. This is because the Hub Service is a new one and there are no devices configured so far.
Shared access polices
Click on the "Shared Access Policies" option and you will see a set of service policies for the devices. There, you can see five different access policies for your devices in which you can make use of all the different services for your IoT device. In those five services, you can use each different service for your IoT devices.
Connection string
Now, you can find the page of connection string which you use to connect your device with the Azure Service. Select the "device connect" option as in the screenshot below. There in the bottom of the window, you can find four different types of connection strings which you are going to use for connecting your service with the device. This will be used to configure your device with the Hub.
Conclusion
I hope you have learned the method of creating an IoT Hub in the Azure portal. In the next article, you will see the method to configure your IoT device with the IoT Hub. Once you add your IoT device to the hub, you can send and receive messages from your device with remote access.