The process can be carried out in two ways
- You can use your physical device like Raspberry Pi and physical sensors directly to get your sensor’s visualization over the remote GUI through IOT hub.
- You can use a simulated device (and can create simulated sensors) to send the data over the cloud.
- Create an IoT hub
In this step you just need to search for the IOT hub service over the Azure and create your own IOT hub by labeling it with an unique name. Select the region and pricing tier according to your subscription plan.
- Register a device for Pi in your IoT hub
https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-raspberry-pi-kit-c-get-started
- Setup Raspberry Pi
This includes the basic Raspberry Pi setup like flashing your memory card with Raspbian OS and updating it. Check if your Raspberry Pi is working properly. 4.Run a sample application on Pi to send a sensor data to your IoT hub.
This is the crucial part of the entire process wherein you need to run the sample application first in order to establish the path between your device and cloud.The sample application being provided by azure can be found over here
https://github.com/Azure-Samples/iot-hub-python-raspberrypi-client-app.git
Once you succeed in the establishment of the path between device and cloud, you will start getting an acknowledgement in terms of updated messages in the special icon over the cloud. You can check it in IOT hub overview. You can actually check how many messages are being sent from your device.
Here your device will send some random messages to the cloud, which you need to streamline by editing the code according to your requirement to change your temperature sensor’s data to that of the cloud.
In the file app.py that you have downloaded from GitHub integrate your sensor’s code and adjust the message time span accordingly.
Now run the app.py file followed by the device connection string being generated by the cloud while registering your device to cloud. You will get to see the string in your IOT hub under the IOT device section. Select the primary connection string. Copy it and paste it while running the file.
After the successful establishment of the path between your device and the cloud you should see the following script running over your device.