- Azure IoT Hub is a managed cloud service provided by Microsoft Azure
- It acts as a central message hub for bi-directional communication between IoT applications and the devices it manages.
- IoT Hub supports multiple protocols such as HTTP, AMQP, and MQTT to accommodate a wide range of devices.
- These step-by-step shows how to create an Azure IoT hub solution, connect and send data
Step 1; Sign in to Azure Portal
- Open your web browser and go to the Azure Portal Sign in with your Azure account credentials
Step 2; Create IoT Hub
- In the Azure portal, use the search bar type Iot Hub.
- Select IoT in the dropdown.
- Click on the Create button
Step 3; Configure the IoT Hub Setting
- On the Basic Tab, using the Project details,
- Subscription; Select your Azure subscription
- Resource group; Choose an existing Resource group or create a new one. Using the Instant details;
- Region; Select the region where you want to deploy the IoT hub
- IoT Hub name; Enter a unique name for your IoT
- Tier; Choose a pricing plan that fits your need (eg free, basic or standard)
- Daily message limit; Leave it at default
- Click on _Review + Create _and then after reviewing your settings
- Leave Networking, Management, Add-ons and Tags at Default
- Click on Create
- Deployment is completed
Go to Resource to complete the IoT hub
Step 4; Register a Device on IoT HubIn the newly created IoT Hub (Hagital-iot-hub)
Explore the overview page
Click on Device Management to manage your device
Device ID; Enter a unique ID for your device
Keep the default settings for Authentication type and other options
Click on save to create the device
Note the Primary Connection String of the device for you will need it to connect the device to the IoT hub
Step 5; Connect a Device And Send DataTo connect a device and send data, you can use a Simulated device
A simulator is like a motherboard with sensors
It is used to test out your device
Connect the simulator with the deviceAt the simulator, on the right corner, change our line 15 with the primary connection string provided on your created device
The primary connection string will help us connect to the device
Click on the device you created (Romanus-smart-phone) copy the primary connection string that comprises (hostname, device ID and shared access key) which is the primary key and paste it on line 15
At the simulator, under line 15, delete everything except the const connection string=''
Copy the primary connection string from the device
Make sure your cursor is placed at line 15 in between ''
Click on Run for the device to start sending messages to Azure IoT Hub
Step 6; How to Send Messages Back to The Device Created
- Go back to the IoT hub created
- Click Message to Device
- Compose a message in the body
- Click on Send message Step 6; Monitor Messages in the IoT Hub
- Download in Mobile Device IoT Plug and Play Using Play Store
- On your Mobile Device, Click on Scan QR code
- Click on Connect Manually
- Copy the IoT Hub primary connection string used earlier and paste on the corresponding required position on the mobile device
- Click on Connect Note the activities on IoT Plug and Play Under Telemetry Data
- Accelerometer
- Geolocation
- Battery level You will see other activities to undertake like;
- Properties
- Bluetooth
- Image upload
- Logo
Step 7; Sending Date/Files to Azure Blob Storage
- Navigate to IoT Hub
- Click Hub Setting
Click on + Add
Channell your messages to the particular Azure services you want
You send it in this case to Azure Blob
Transfer all the Telemetric data to Azure Blob Storage
Add a routeEndpoint Type; Storage
Endpoint Name; Romanus endpoint
We need to create an Azure container
Click on Pick a container
Click on + storage account
Storage account name;romanusstorage
Leave others in default
The storage account is created by default
There is no need to click Go to the resource
Click on + Container
Container name; Romanus
Click on the name of the container
Click Select to add a route
Select JSONEnter your route name; Romanus
Take others in default
Click on test
Enter your enrichment name; my name
Enter enrichment value; Romanus
Click custom endpoints to examine the work
Click Enrich messages to examine the work
Step 8; Create a Storage AccountOn the Azure portal, search storage account
Open the storage account link in a new tab
It is empty,
At the overview of the storage account
Navigate to Data storage
Click on the container we created
It shows no result from the overview page
When you start getting data from telemetry it comes here
Click file upload
Make use of the container you created
Save
Top comments (0)