With the Pi successfully reading temperature and pressure from the sensor, and connecting successfully to Azure it left one more step in my project – outputting the data in a meaningful way. For this part of my project I’m looking to collect the data Azure is receiving and put it into a line graph which should easily show any increases or decreases in temperature.
I started off at the Azure Portal ( https://portal.azure.com/ ), expanded the IoT menu and clicked IoT Hub.

Built in Endpoints
From the IoT Hub menu the option needed is “Built in Endpoints”.

Most the the settings for the endpoint can remain as the default, however I created a new consumer group for temperature reading. With the endpoint configured it is time to create a stream analytics job.
Stream Analytics Job
From the Internet of Things menu choose Stream Analytics Job, and add a new job.

- Job Name – Enter a unique name for the job.
- Subscription – If, like me, you are using the free resources then choose “Free Trial”. If not, choose an appropriate subscription.
- Resource Group – choose the IoT hub created earlier in this project.
- Location – Make sure this matches where your IoT hub is located (so “UK West” for me).

Once the stream analytics job is created, which may take a few minutes, open it and choose “inputs” from “Job Topology” on the left.

Give the input alias a name, select the appropriate IoT Hub and make sure Endpoint is set to messaging.

After the input is set up an output is needed. This is where Power BI comes into play. For this step an business or school account is needed.

- Output alias – has to be a unique name
- Group workspace – for testing I would leave as “My Workspace”
- Dataset Name – a name for the data as it pulls through to Power BI
- Table Name – a name for the table as it pulls through to Power BI
With an input and output created the project also needs a query so that Azure knows what data to send to Power BI. Under “Job Topology” click Query and change the “YourInputAlias” and “YourOutputAlias” to match aliases created above.

For me this was a simple * (for everything) into my output Power BI (GeekTechStuff) from my input temperature. Then from the “Overview” option on the left press the “Start” button to start streaming,

With the stream running I opened Power BI, clicked “My Workspace” on the left and chose the dataset for GeekTechStuff_Temperature. Then from the right I selected line graph and dragged the appropriate fields to get my line graph to populate – it’s flat as temperature has not increase/decreased whilst running.

2 thoughts on “Azure IoT Hub / Raspberry Pi IoT Project – Connecting Pi, Azure and Power BI.”
Comments are closed.