Have you been having problems implementing an IoT Hub in Azure? Here is an easy guide to implementing an IoT Hub in Azure. Perhaps this sounds new to you, let's do a brief introduction to IoT Hub.
IoT meaning Internet of Things, is the ability of internet connected devices to garner and relay information for data analysis. The key components of IoT include:
Smart devices that have computing capabilities and can collect data
IoT applications which are able to integrate data from various IoT devices and analyze the data for decision making
Users Interface which allows users to manage and control IoT devices.
IoT is used in smart homes, vehicles to monitor performance, industries etc.
An IoT Hub is a managed service hosted in the cloud which acts as a central message hub for bi-directional communication between IoT applications and the devices they manage. In this article, we'll create an IoT Hub and connect it to a device (Rasberry pi) to monitor how an IoT Hub functions. Let's dive right in:
Step 1: Login to your azure portal at portal.azure.com
Step 2: In the search box, type IoT and select IoT Hub from the list of auto-suggested services.
Step 3: On the IoT Hub page, click Create.
Step 4: Fill in the basic details, then click Review and Create leaving other parameters on default.
Step 5: On passing validation, click Create and await deployment.
Step 6: After successful deployment, click Go to resource to view your newly created IoT Hub.
Note that, the IoT Hub has no device connected to it, however, every information or message on it will be blank (0).
Step 7: From the menu of the IoT Hub, click Device management drop down menu and select Devices
Step 8: Click Add device to create a device, fill in the device and save.
Step 9: Click the added IoT device and note the primary connection string. Copy the primary connection string.
Step 10: On your browser, search Azure raspberry pi simulator, click raspberry pi azure IoT simulator.
This displays a raspberry pi whose LED is off, which implies it hasn't been connected.
Step 11: In line 15, edit the placeholder and paste the primary connection string. Click Run, at the bottom of the script.
The device responds by blinking the LED signifying successful connection.
Finally, check the response script below the code script to see how many messages the device is sending to the Hub per time and go to the overview page of your IoT Hub on Azure portal, refresh to see how many messages the IoT device has sent to the Hub.
Congratulations! You just created an IoT Hub and connected a device to it.
Top comments (0)