, , , ,

Sending our Temperature data to the cloud for Power BI

In the previous post I outlined connecting our temperature/humidity sensor to a Raspberry Pi and taking a reading from it. The next step is to send that data to the cloud and make use of it in Power BI.

Here’s a basic outline of the process

Connecting the sensor to the Cloud

Of course, Power BI isn’t the only thing you could use this data for, though our goal is to add this temperature reading to the Power BI dashboard in our office.

The first thing I needed to find was somebody who had done this before. A few days ago I found this post by Rakesh George that outlines his process: http://www.identitymine.com/blog/2015/06/19/iot-with-raspberry-pi-azure-and-windows-devices/

His temperature sensor setup is a lot more complicated than mine – it looks like he’s taking the binary values from the sensor and working out the temperature value. In our case, we had a great library from Adafruit that did all of that for us.

Compared to other IoT projects, this one is extremely simple. We’re not making use of Event Hubs or Stream Analytics or any of the high scale, high performance tools in Azure. We’re just sending a temperature and humidity value to Azure Table Storage once a minute, then connecting to that data via Power BI Desktop.

I downloaded Rakesh’s source files to see how it can apply to my setup.

Firstly, you’ll need to install the Azure SDK on the Raspberry Pi to make use of the Azure services, check the linuxruninstructions.txt in Rakesh’s Python source file download for instructions on this.

Most of the code relevant to Azure is located in the azuremodule.py file. I learnt a lot about the Azure Python SDK by reading and modifying this script file.

If you’re setting this up yourself, you’ll need to sign up for Microsoft Azure (free trials are available), create a storage account, and add the storage account name and primary key into the sample code.

After a little bit of tweaking, I was able to get it to work using the Adafruit library to retrieve the values from my sensor and upload it to my Azure Table Storage account every 60 seconds.

Once you’re collecting data, you can use the Power BI Desktop App to pull this data into your dashboards for reporting. As I’m testing it, I created a new dashboard for these temperature/humidity values.

Power BI Desktop can be downloaded from here: https://powerbi.microsoft.com/desktop

A basic version of Power BI is available free, though you can sign up for a 60 day trial of Power BI Pro, which has many of the same features, though it refreshes your dashboards hourly instead of daily.

Importing and preparing the data for Power BI

Click Get Data, choose Azure, Microsoft Azure Table Storage.

Get Data in Power BI

Enter the storage account name, click OK, then enter the primary key.

Connect to Azure Table Storage

Select the table to import.

Connect to data in Power BI

Import the data, and use the query editor to set the data types and separate the columns for humidity and temperature values.

Modify Data in Power BI

Create your Power BI graphs and publish them to Power BI.

Building Graphs in Power BI

Once published, you can access them via the browser or the Power BI apps on mobile devices.

View graphs on Power BI Mobile Devices
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *