<img alt="" src="https://secure.leadforensics.com/150446.png " style="display:none;">

Blogs

Taking your sensor’s data to AZURE IoT hub

Taking your sensor’s data to AZURE IoT hub
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.
The basic setup:

  • 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
Here you can refer to the following link:

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.
IoT Hub Usage
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.

Device id
After the successful establishment of the path between your device and the cloud you should see the following script running over your device.


Topics: Azure AZURE IoT hub

e-Zest is a leading digital innovation partner for enterprises and technology companies that utilizes emerging technologies for creating engaging customers experiences. Being a customer-focused and technology-driven company, it always helps clients in crafting holistic business value for their software development efforts. It offers software development and consulting services for cloud computing, enterprise mobility, big data and analytics, user experience and digital commerce.