How To Create Azure IoT Hub Solution, Connect a Device To Send Data Using Azure Portal

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 M…


This content originally appeared on DEV Community and was authored by Romanus Onyekwere

  • 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.

Image description

  • Click on the Create button Image description

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 Image description
  • Leave Networking, Management, Add-ons and Tags at Default
  • Click on Create Image description
  • Deployment is completed
  • Go to Resource to complete the IoT hub
    Image description
    Step 4; Register a Device on IoT Hub

  • In the newly created IoT Hub (Hagital-iot-hub)

  • Explore the overview page

  • Click on Device Management to manage your device

  • Click on Devices
    Image description
    Create a Device
    Click on + Add Device
    Image description

  • 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
    Image description
    Step 5; Connect a Device And Send Data

  • To 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 device

  • At the simulator, on the right corner, change our line 15 with the primary connection string provided on your created device
    Image description

  • 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
    Image description

  • 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
    Image description

Step 6; How to Send Messages Back to The Device Created

  • Go back to the IoT hub created
  • Click Message to Device Image description
  • Compose a message in the body
  • Click on Send message Image description 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 Image description 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 Image description

Step 7; Sending Date/Files to Azure Blob Storage

  • Navigate to IoT Hub
  • Click Hub Setting
  • Click Message Routing
    Image description

  • 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
    Image description
    Add a route

  • Endpoint Type; Storage

  • Endpoint Name; Romanus endpoint

  • Leave others in default
    Image description
    Create Storage Account

  • We need to create an Azure container

  • Click on Pick a container

  • Click on + storage account

  • Storage account name;romanusstorage

  • Leave others in default

  • Click Ok
    Image description

  • The storage account is created by default

  • There is no need to click Go to the resource

  • Click the name of the storage account
    Image description
    Create a Container

  • Click on + Container

  • Container name; Romanus

  • Click on Create
    Image description

  • Click on the name of the container

  • Click Select to add a route
    Select JSON

  • Click Create + next
    Image description

  • Enter your route name; Romanus

  • Take others in default

  • Click on test

  • Click on Create + Add enrichment
    Image description

  • Enter your enrichment name; my name

  • Enter enrichment value; Romanus

  • Click add to save and complete message routing
    Image description

  • Click custom endpoints to examine the work

  • Click Enrich messages to examine the work
    Image description
    Step 8; Create a Storage Account

  • On the Azure portal, search storage account

  • Open the storage account link in a new tab

  • Click on the storage account we created
    Image description

  • It is empty,

  • At the overview of the storage account

  • Navigate to Data storage

  • Click Container
    Image description

  • 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


This content originally appeared on DEV Community and was authored by Romanus Onyekwere


Print Share Comment Cite Upload Translate Updates
APA

Romanus Onyekwere | Sciencx (2024-07-20T12:10:02+00:00) How To Create Azure IoT Hub Solution, Connect a Device To Send Data Using Azure Portal. Retrieved from https://www.scien.cx/2024/07/20/how-to-create-azure-iot-hub-solution-connect-a-device-to-send-data-using-azure-portal/

MLA
" » How To Create Azure IoT Hub Solution, Connect a Device To Send Data Using Azure Portal." Romanus Onyekwere | Sciencx - Saturday July 20, 2024, https://www.scien.cx/2024/07/20/how-to-create-azure-iot-hub-solution-connect-a-device-to-send-data-using-azure-portal/
HARVARD
Romanus Onyekwere | Sciencx Saturday July 20, 2024 » How To Create Azure IoT Hub Solution, Connect a Device To Send Data Using Azure Portal., viewed ,<https://www.scien.cx/2024/07/20/how-to-create-azure-iot-hub-solution-connect-a-device-to-send-data-using-azure-portal/>
VANCOUVER
Romanus Onyekwere | Sciencx - » How To Create Azure IoT Hub Solution, Connect a Device To Send Data Using Azure Portal. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/07/20/how-to-create-azure-iot-hub-solution-connect-a-device-to-send-data-using-azure-portal/
CHICAGO
" » How To Create Azure IoT Hub Solution, Connect a Device To Send Data Using Azure Portal." Romanus Onyekwere | Sciencx - Accessed . https://www.scien.cx/2024/07/20/how-to-create-azure-iot-hub-solution-connect-a-device-to-send-data-using-azure-portal/
IEEE
" » How To Create Azure IoT Hub Solution, Connect a Device To Send Data Using Azure Portal." Romanus Onyekwere | Sciencx [Online]. Available: https://www.scien.cx/2024/07/20/how-to-create-azure-iot-hub-solution-connect-a-device-to-send-data-using-azure-portal/. [Accessed: ]
rf:citation
» How To Create Azure IoT Hub Solution, Connect a Device To Send Data Using Azure Portal | Romanus Onyekwere | Sciencx | https://www.scien.cx/2024/07/20/how-to-create-azure-iot-hub-solution-connect-a-device-to-send-data-using-azure-portal/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.