DEV Community

Cover image for Practical IoT Solution Using Azure IoT Hub
Chidera Enyelu
Chidera Enyelu

Posted on

Practical IoT Solution Using Azure IoT Hub

Azure IoT Hub is a cloud service for managing and scaling IoT device communication. It enables secure, bi-directional communication between IoT applications and devices. Benefits include reliable device-to-cloud and cloud-to-device messaging, real-time analytics, scalability, integration with Azure services, and robust security features.
This guide helps you Create a practical IoT solution using Azure IoT Hub. the solution should involve setting up an IoT Hub, registering a device, and simulating the device to send telemetry data or files to Azure Blob Storage.

Step 1: Set Up Azure IoT Hub

  • Create an Azure IoT Hub
  • Sign in to the Azure portal.
  • On the searchbar, search for IoT hub, select and click on create

Image description

Image description

  • Fill in the necessary details on the basics tab(Subscription, Resource Group, Region, IoT Hub Name, etc.). Leave the remaining tabs at default.

Image description

  • Review and create the IoT Hub.

Image description

  • After deployment, go to resources

Image description

Step 2: Register a Device in IoT Hub

  • Navigate to your IoT Hub:
  • Go to your newly created IoT Hub in the Azure portal.
  • On the "IoT devices" overview, on the left hand side, select "Devices"
  • Click on "+ New" to add a new device.

Image description

  • Provide a Device ID and click "Save".

Image description

Step 3: Get Device Connection String

  • After creating the device, click on the device ID to view the device details.

Image description

  • Copy the "Primary Connection String".

Image description

Step 4: Simulate a Device to Send Telemetry Data

  • On your phone device, download the IoT hub plug and play app and install
  • while on the app, select the options circled in the pictures below.

Image description

Image description

  • Copy and paste the Primary connection string and connect

  • The telemetry will be displayed as showed below.

Image description

Step 5: To upload a file in Azure Blob Storage.

  • Configure IoT Hub for File Upload.

Image description

  • Create a Storage Account and container.

Image description

Image description

  • Go to your IoT Hub in the Azure portal.
  • Under "Settings," select "File upload". Set the storage container for file uploads by linking the storage account and specifying the container name and save afterwards.

Image description

  • Upload a File from a Device you can upload the images from your phone device to azure by clicking on the "upload" in the plug and play IoT hub and select the files you want to upload and upload them.

Image description

Image description

  • To find your uploaded files,go to the container in the storage account and view them. NB: You can download the uploaded file.

Image description

By following these steps, you have set up an IoT solution using Azure IoT Hub, where you created an IoT Hub, registered a device, simulated sending telemetry data from the device, and routed this data to Azure Blob Storage using an Azure Function. This setup allows you to monitor real-time data and store it in a scalable and secure manner.

Top comments (0)