Create a practical IoT solution using Azure IoT Hub

Adeola Adebari - Jul 18 - - Dev Community

To create a practical IoT solution using Azure IoT Hub, follow these steps:

  • Set up Azure IoT Hub
  • Register a device
  • Simulate the device to send telemetry data
  • Store the telemetry data in Azure Blob Storage

Here's a detailed guide on how to accomplish this:

1. Set up Azure IoT Hub

Create an Azure IoT Hub

  • Sign in to the Azure portal.

Image description

  • Click on "Create a resource" .

Image description

  • Search for "IoT Hub" and click "Create".

Image description

  • Fill in the necessary details like subscription, resource group, region, and IoT Hub name.
  • Choose the pricing and scale tier that fits your needs.

Image description

  • Review and create the IoT Hub.

Image description

2. Register a Device

Add a device to the IoT Hub

  • In the Azure portal, navigate to your newly created IoT Hub.
  • Under the "Device Management" section, click on "Devices".
  • Click "Add Device" to add a new device.

Image description

  • Provide a device ID (e.g., ade-smartphone) and keep the authentication type as symmetric key.

Image description

  • Save the device. Note down the primary connection string; you will need this for device simulation.

Image description

3. Simulate the Device to Send Telemetry Data

Set up a mobile environment to simulate

  • Download the "IoT Play and Plug" app on your mobile

Image description

  • Copy and paste the primary connection string into the app to initiate connection between the iot hub and the mobile app.

Image description

4. Store Telemetry Data in Azure Blob Storage

Set up an Azure Storage account

  • In the Azure portal, click on "Create a resource" and search for "Storage account", click on "Create".

Image description

  • Fill in the necessary details.

Image description

  • Create a container.

Image description

Create a route in IoT Hub to send data to Blob Storage

  • In the IoT Hub, go to "Message Routing" under "Messaging".
  • Click "Add" to create a new route.

Image description

  • Provide a name for the route.
  • Select "Azure Storage" as the endpoint type and configure it with your storage account details.
  • Define the routing query to specify which messages should be sent to Blob Storage.
  • Save the route.

Image description

Verify the setup

  • Connect your IoT plug and Play app on your mobile and route the telemetry data by uploading an image to the Blob Storage as per the route configuration.

Image description

  • Navigate to the Blob Storage account in the Azure portal to verify that the data is being stored.

Image description

. . . . . .
Terabox Video Player