This project is designed to demonstrate how from a device via Microsoft Azure can display information in PowerBI. (This project got much inspiration from the following project SensorTagToEventHub.)
A Universal Windows App connects to the SensorTag with Bluetooth. This app reads the sensor each second and sends the data to Azure EventHub. An Azure Stream Analytics job analyse the data and send it to PowerBI.
- Windows 10 computer
- TI SensorTag
- Windows Azure Account using Organization account (Power BI works with Organization account only. Organization account is often your work or business email address e.g. xyz@mycompany.com. Personal emails like xyz@hotmail.com are not organizations accounts).
To make sure that the demonstration work, it is a good practice to remove other SensorTags that are already paired in the system.
1. Open http://manage.windowsazure.com
2. Navigate to the Service Bus pane.
3. Click on the plus sign to create a new Service Bus Namespace and enter the information seen in the screenshot below.
4. Click on the new Service Bus namespace.
5. Open the tab EVENT HUBS and click on Create a New Event Hub in your Service Bus namespace.
6. Enter the following information and click on Create a new Event Hub.
7. Click on the new Event hub after it is created.
8. Click on the tab CONFIGURE and enter the information shown in the screen below in the section shared access policy. Remember to also save it by clicking SAVE in the bottom of the screen.
When it is saved a new section will appear, shared access key generator. The Policy Name and the Primary Key will we use later in the application that sends the information to the EventHub.
We are now ready to start sending information from the SensorTag into Azure.
1. Start SensorTagReader on you computer and enter the information to connect to the Event Hub.
2. Click on Start and make sure that the SensorTag is connected.
If everything is ok you will see events data appering in the dashboard. (This could take up to ten minutes before you see any data in the dashboard.)
1. Navigate to Stream Analytics pane.
2. Create a new Stream Analytics Job.
3. Click on the newly created job to open the details page for that job.
4. Click on INPUTS in the tab menu to see a list of inputs for this job.
5. Click on Add an input
6. Create a new output by going to the OUTPUTS tab
You need to connect to PowerBI with an organization account, as I said above. You can't use a Microsoft Live account for this. So, if you logged in with a Micrsoft Live account you need to create an Azure Active Directory tenant and create one user in that tenant. Use that new user when you authorize the connection that we will do in the instructions below.
7. Click on Add an output
8. Authorize the connection to PowerBI
It is here you need your organizational account.
9. PowerBI settings
10. Output created
11. Time to create the query that analyze the stream. Open the tab QUERY.
SELECT
max(humidity) as humidity,
max(temperature) as temperature,
time,
-20 as minTemperature,
60 as maxTemperature,
23 as targetTemperature,
100 as maxHumidity,
70 as targetHumidity
FROM Input
WHERE sensorName = 'sensor001'
Group by TUMBLINGWINDOW(ss,1), time, sensorName
Remember to save your query.
12. Click on START in the dark menu in the bottom of the screen to start the job.
1. Go to http://www.powerbi.com and login with the same account as you used to authenticate the connection to PowerBI when creating the output from the Stream Analytics job.
2. Click on the heading Power BI to open your workspace.
3. Click on the hamburger icon up in the left corner to expand the navigation pane.
4. If all previous steps has worked, you will now see that a new dataset called sensortag has appeared.
5. Click on the dataset sensortag to start creating a visualization.
6. Click on the line chart icon in the Visualizations pane.
7. Drag time to the field Axis and temperature to the field Values