DEV Community

Cover image for Create a practical IoT Solution using Azure IoT
OLALEKAN john Ayansola
OLALEKAN john Ayansola

Posted on

Create a practical IoT Solution using Azure IoT

Practical IoT Solution Using Azure IoT Hub
In this exercise, I will create an IoT solution that involves:

  1. Setting up an Azure IoT Hub to manage IoT devices.
  2. Registering a device with the IoT Hub.
  3. Simulating device telemetry to send data to the IoT Hub.
  4. Sending the telemetry data to Azure Blob Storage for persistent storage.

Steps in creating a practical IoT Hub to manage devices, simulate telemetry data, and store data in Azure Blob Storage

  • Go to the Azure Portal

Azure portal

  • Select create a resource, navigate to internet of things and select IoT Hub

Internet of things

  • Select subscription

  • Select or create existing resource group

  • Choose a region

  • Give your IoT Hub name

  • Select free in Tier

  • Click on review +Create to deploy the IoT Hub

Configuration

  • Go to resource after the deployment is completed

resource

Iot device

  • Click on add Device to add device

Add device

  • Enter the device ID (e.g myiotdevice), leave the rest at default and click save

Naming

  • After the save be sure the IoT device is created

myiot

  • Click on the device and copy the primary connection string

primary connection

  • Paste the primary connection string that was copied to connect the simulated device to the IoT Hub and click run

simulated device

Run

  • Click on message to device

send message

  • The message received by the Raspberry simulator

Raspberry

  • Navigate to the overview page of the IoT Hub setting and click on message routing

message routing

  • Click on +Add a route

Add a route

  • Select the endpoint to be storage

  • Name your Endpoint (myiotendpoint)

  • Click on pick a container

container

  • Click on pick container and navigate to + storage account

storage

  • Give the storage account name and choose default for the remaining setting then click ok

storage

  • Select the storage account you just created

select storage

  • Click on + container to create a container

Container

  • Give the container a name and then create

name the container

  • Choose the new container and click on select

create

  • Click on create + next

next

  • Create a route, and add a query to filter data before routing it to the endpoint

storage

  • Open the storage account on a new tab

new tab

  • Click on container

container

  • On the IoT hub overview page, navigate to file upload

file

  • Select the storage and container created earlier

save

  • From the IoT plug and play app that you installed on your phone, upload a file or image and make sure you save file upload changes on the IoT Hub page on the Azure portal, you will notice the file will reflect on the container page

uploaded image

  • Click on the container to see the default telemetry file created and myiotdevice contain the uploaded file

Telemetry

  • Double click on myiotdevice then click on edit to view the document

Edit

  • View the image or the file

Happy birthday

Conclusion
By following these steps, you've created a practical IoT solution using Azure IoT Hub to manage devices, simulate telemetry data, and store that data in Azure Blob Storage. This solution can be extended by adding more devices, enhancing telemetry data types, or integrating with other Azure services for advanced analytics

Top comments (0)