Skip to content

buzzfrog/SensorTag-Azure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SensorTag Azure

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.)

Overview

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.

What you need

  • 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).

Getting started

1. Pair the TI SensorTag in the Manage Bluetooth devices settings

To make sure that the demonstration work, it is a good practice to remove other SensorTags that are already paired in the system.

2. Download the source code or the compiled executable.

3. Create EventHub in Azure

1. Open http://manage.windowsazure.com

2. Navigate to the Service Bus pane.

Service Bus

3. Click on the plus sign to create a new Service Bus Namespace and enter the information seen in the screenshot below.

New Service Bus Namespace

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.

Create new Event Hub

6. Enter the following information and click on Create a new Event Hub.

Create new Event Hub

7. Click on the new Event hub after it is created.

New Event Hub Ready

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.

New Shared Access Policy

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.

Shared Access Key Generator

Ready to test sendning the information to Azure

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.

SensorTagReader

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.)

Event Hub Diagnostics

4. Create Stream Analytics Jobs in Azure

1. Navigate to Stream Analytics pane.

New Stream Analytics

2. Create a new Stream Analytics Job.

Create New Stream Analytics Job

Stream Analytics Job

3. Click on the newly created job to open the details page for that job.

Stream Analytics Job Detail

4. Click on INPUTS in the tab menu to see a list of inputs for this job.

Stream Analytics Input

5. Click on Add an input

Stream Analytics Input Create 1

Stream Analytics Input Create 2

Stream Analytics Input Create 3

Stream Analytics Input Create 4

6. Create a new output by going to the OUTPUTS tab

VERY IMPORTANT INFORMATION

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

Stream Analytics Output Create

8. Authorize the connection to PowerBI

It is here you need your organizational account.

Stream Analytics Output Authorize

9. PowerBI settings

Stream Analytics Output Create 3

10. Output created

Stream Analytics Output Create 3

11. Time to create the query that analyze the stream. Open the tab QUERY.

Stream Analytics 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.

5. Create a PowerBI report

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.

PowerBI Main Page

3. Click on the hamburger icon up in the left corner to expand the navigation pane.

PowerBI Workspace

4. If all previous steps has worked, you will now see that a new dataset called sensortag has appeared.

PowerBI Dataset

5. Click on the dataset sensortag to start creating a visualization.

Create a simple line chart

6. Click on the line chart icon in the Visualizations pane.

PowerBI Create a Line Chart

7. Drag time to the field Axis and temperature to the field Values

PowerBI Create a Line Chart

About

Demonstration of IoT with TI SensorTag in Azure.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages