HOW TO CONNECT AN IOT FIELD DEVICE (RASPBERRY PI SIMULATOR) FROM THE FIELD TO AN AZURE CLOUD IOT HUB FOR COMMUNICATION AND DATA
Published: 2024-05-29 20:54:13

What is IOT?
Internet of Things (IoT) Central in Microsoft Azure is a managed IoT application platform that enables users to build, manage, and operate IoT solutions with ease. It provides a comprehensive and scalable environment for connecting, monitoring, and managing IoT devices, simplifying the deployment and management of IoT applications.
What is Raspberry PI Simulator?
Raspberry Pi Simulator is a powerful tool for prototyping, testing, and learning about Raspberry Pi projects and IoT applications, providing a virtual platform that mimics the functionality of a physical Raspberry Pi.
However, it allows users to simulate a Raspberry Pi with various sensors, interact with Azure services, and build IoT applications in a virtual environment.
Here’s a step-by-step guide on how to do this.
Step:1: Log on to Microsoft Azure account and search for IOT Hub
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ygg9nohqvnvo8u3ibzp.png)

Step:2:  Click on the Create Icon
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/decl5pl6v7r80q9jqrab.png)

Step:3: Fill the necessary details such as; Resource group, IOT hub name, Region, Tier, Daily message limit
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h5gseu0o3w66knue11dr.png)

Step:4: Click Review+Create
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tz7tzb0klnum6rvf8dc0.png)

Step:5: Click Create
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mfvtzerlp9t9w6f3769r.png)

Step:6: Wait for deployment to be completed
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/322zhvjk5mvpum9fq3lp.png)

Step:7: Go to resource after deployment is completed
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5zjy55znnkay160gooui.png)

Step:8: You must create a device for it. Click on devices icon.
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mbfpctakz1ig65f5iy1u.png)

Step:9: Click on Add device
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uc1uz5irwa1j7j18lyxa.png)

Step:10: Create (Device name, select “Symmetric key” and Enable) and save.
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qa157saqev5vvg385xl9.png)

Step:11: Click on the device created
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jcxu21r8b0aho83qoql2.png)

Step: 12: Copy “Primary connection string” and make sure Enable connection to IOT Hub is Enabled
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tfse9o87yrpmo9eo4pp1.png)

Step:13: Initiate https://azure-samples.github.io/raspberry-pi-web-simulator/ on a web browser , insert or paste the “primary connection string “ from the IOT device portal on Azure into “Line 15” on the Raspberry PI Simulator and click on RUN

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a80djdp06dwjl25vyl1e.png)

Step:14: Raspberry starts blinking Red hence, communicating to the IOT Device in Microsoft Azure portal and recording data or messages as seen below.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/duvoyk96z8cg4q6ikfe7.png)

Step:15: Go back to IOT Hub overview to show the messages received

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ps2lq1r1szajpmsb8t9u.png)