DEV Community

Cover image for How to send messages to IoT Hub in Azure
Tijani Mojeed
Tijani Mojeed

Posted on • Edited on

How to send messages to IoT Hub in Azure

The Internet of Things (IoT) describes the ability of devices equipped with sensors to collect data and send that data to an endpoint for logging, processing, analysis, and/or other actions.
Consolidating sensor data is just one aspect of IoT. Controlling and managing the distributed devices is another aspect.
The scenarios below are examples of IoT
 Consider an automobile manufacturer that builds sensors into its vehicles to monitor performance and sends that data to Azure for real-time analytics Or
 Imagine a connected house where the refrigerator, oven, microwave, lighting systems, garage door, thermostat, and security system all collect and send data to a central app or service to enable the homeowner to monitor and potentially control the function of all of these systems Or
 Consider a manufacturing floor where sensors track the manufacturing process and send data back to a centralized system that operators and engineers use to monitor and control the manufacturing process.

Azure includes several services that enable organizations to integrate IoT devices quickly and easily and deploy solutions based on IoT.

Azure IoT has 3 components

 Azure IoT Hub Azure IoT Hub: is an Azure-hosted service that functions as a message hub for bi-directional communication between your deployed IoT devices and Azure services.
• IoT Hub supports multiple protocols and open-source software development kits (SDKs), enabling it to integrate most IoT devices.
• IoT Hub is highly scalable, which means it can integrate billions of devices.
• IoT Hub supports multiple communication and control functions.
• IoT Hub can route messages received from devices to other Azure services as needed.
• IoT Hub is the service that integrates your IoT devices and other Azure services. However, IoT Hub does not provide analysis services or dashboards for viewing device state or analyzing data. That is where IoT Central comes in.
Below describes the procedure on how to send messages to IoT Hub in Azure
 Go to Azure portal
 On the search bar, type IoT Hub and search
 Click on create

Image description

 Input all necessary details as indicated in the image below and click on review and create

Image description

 After the IoT Hub has finished deployed

Image description

 Create on Resources and then you have your IoT Hub

Image description

Step 2 is adding an IoT device
Click on devices after which a page will displace and click add device

Image description

Image description

Put name on device ID and click on save then you have the below image, at this stage you have successfully add an IoT device

Image description

Step 3 is testing the device using the Raspberry Pi Simulator.
Click on the name you used as your device ID, then you have your ID details as shown in the image below

Image description

Next is to click and copy the primary connection String and paste it on your downloaded Raspberry Pi simulator on number 15 that is, replace what you have in the raspberry pi with the Primary connection string you copied then click on run

Image description

Image description

Next is to go back to your Azure portal and check for messages sent to your IoT Hub

Image description

Image description

Image description

From the above image you can see messages has been sent to the IoT Hub.

Top comments (0)