Internet Of Things aka IOT is gaining its popularity ever since its inception as we can see. Everything is being IOTized now in order to centralize and streamline the data coming from variety of sources. In a single line IOT can be defined as any device that lets you connect to the internet with the help of just one switch. Raspberry pi is gaining its popularity among developers because of its simple design and plug-and-play connectivity. Since Raspberry Pi is providing you an ability to interface hardware and visualize the data being received from your sensor over its GUI, it is slowly making its way to stand first among the crowd of different prototyping devices in the market. Here goes the glimpse of process flow on how to take your sensor’s data to that of the cloud.
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
- 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
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.