Menu

Expand
Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Visualizing IoT Data with Trust Onboard and Microsoft Azure

This guide builds on steps you should have followed in Get Started with Trust Onboard and the Developer Kit for Broadband IoT and therefore requires you to have completed that tutorial. If you haven’t completed that guide, please do so now. If you have already set up your Developer Kit for Broadband IoT, you need perform only the Azure setup and app creation steps.

One of the major benefits of basing your IoT application around Microsoft Azure is the access this cloud platform gives you to additional functionality that can help you gain insights from the operation of your application. One of these is the ability to visualize the data you receive from your devices. This can help you identify patterns in the flow of data, and therefore potential issues.

For example, loss of data from a range of devices at a regular time may indicate that you need to add some variance in when they check in — some are clearly not able to contact an overloaded host.

Azure provides a service called Time Series Insights to help you turn your sensor data into attractive, easy to scan visualizations.

Let’s apply Time Series Insights to the data generated by the IoT application we built in Get Started with Trust Onboard and the Developer Kit for Broadband IoT which sends status and sensor readings from the device to the cloud.

What you will need to complete this tutorial

This tutorial makes use of billable Azure services. If you are using a free trial account, it will be billed to the credit that Microsoft grants you when you open your account. Other accounts will require payment for these services; you can calculate Azure service costs here. If you are unwilling or unable to pay for these services, please do not proceed with this tutorial.

Create a Time Series Insights environment

  1. In a browser tab on your computer, navigate to the main Azure Portal.
  2. In the Search field enter Time Series and select Time Series Insights environment from the list of options:

  3. Click + Add.
  4. In the Create Time Series Insights environment page’s Basics tab, fill in the fields as follows:
    1. Environment name Pick a good name for the Insights environment — you can’t change it after it’s created.
    2. Subscription Select Free Trial if you wish, or your existing subscription.
    3. Subscription Resource Group Select the group you created earlier when you worked through Get Started with Trust Onboard and the Developer Kit for Broadband IoT
    4. Location Leave this as is.
    5. Pricing Tier Select PAYG (Preview).
    6. Property Name Enter deviceId:

    7. Storage account name Choose and enter any name for the resource which will store any events you send.
    8. Storage account replication Select Locally redundant storage (LRS).
  5. Click Next: Event Source.
  6. On the Event Source tab, fill out the form as follows:
    1. Create an event source Click Yes.
    2. Name Choose and enter something memorable.
    3. Source type Select IoT Hub**.
    4. Select a hub Leave this as Select existing.
    5. Subscription Select Free Trial if you wish, or your existing subscription.
    6. IoT Hub name Choose the IoT Hub you created earlier.
    7. IoT Hub access policy name select iothubowner.
    8. IoT Hub consumer group Click New then key in a name in the text field. Click the blue Add button when you’re done:
    9. Property name Leave this blank.
  7. Now click Review + create and then Create.

Enter the new Time Series Insights environment

  1. In the Search field enter Time Series and select Time Series Insights environment from the list of options:
  2. Select the environment you just set up. You might need to wait a moment for Azure to finish deploying it.
  3. Click Data Access Policies on the left sidebar. Verify your name is there. If it isn’t, please read about Azure access policies and grant permission to the resource:
  4. Click Overview on the left sidebar. Click the web link under Time Series Insights explorer URL:

Build a visualization

The Time Series Insights Explorer is an amazing way to visualize all of your time-dependent data. Conveniently, it’s perfect for exactly the type of data you’re sending from the Developer Kit.

Let's get a great visualization up on your screen:

  1. Under All hierarchies on the left sidebar menu, select Time Series Instances.
  2. Click on your Developer Kit’s ID and select Show humidity from the popup:
  3. Click on your Developer Kit’s ID again but this time click Show temperatureFahrenheit.

Now you’ve got a graph that you can use to see all of your observations in one place.

Moving your mouse along the line will show you the exact reading at every point and the reading’s timestamp. Filter your data by dragging the slider on the time scale.

You can click Refresh to bring in new data at the top of the screen. Under the time slider are some extra controls. You’ll be able to set some built-in timeframes for averages, or set your own interval with a slider.

When you’re done exploring the options, it’s time to build a model.

Build a Time Series Explorer model

The model you’re going to build adds location awareness to your data. You’ll then be ready to scale — and monitor temperature, or any other data — all over the world.

  1. Click the Models icon in the left sidebar.
  2. Select the Types tab.
  3. Click + Add and enter the following items:
    1. Name Enter Weather.
    2. Description Enter Weather IoT Test:
  4. Select the Variables tab.
  5. Click + Add variable and enter its details as follows:
    1. Name Enter Max Humidity.
    2. Kind Select Numeric.
    3. Value Select humidity (Double).
    4. Click to show the advanced options.
    5. Under Aggregation Operation Select MAX:
  6. Click Apply.
  7. Click + Add variable and enter its details as follows:
    1. Name Enter Avg Temp F.
    2. Kind Select Numeric.
    3. Value Select temperatureFahrenheit (Double).
    4. Click to show the advanced options.
    5. Under Aggregation Operation select AVG.
  8. Click Apply and then Save.
  9. Select the Hierarchies tab.
  10. Click + Add and enter the following data. For each new level, just click + Add level:
    1. Name Enter Location Hierarchy.
    2. Level 1 Enter Country.
    3. Level 2 Enter State.
    4. Level 3 Enter City.
    5. Level 4 Enter Location:
  11. Click Save.
  12. Select the Instances tab.
  13. Click the pencil icon.
  14. Under Type select Weather.
  15. Under Name enter Weather Node.
  16. Under Description enter Weather Node:
  17. Click Save.
  18. Select the Instance fields tab.
  19. Check the Location Hierarchy box.
  20. Now it’s up to you! Enter your individual values for Country, State, City, and Location:
  21. Click Save.
  22. Click on the chart icon on the left sidebar to go back to the graph view.
  23. On the left side, you can now expand the Location Hierarchy item and pick the device. Show the two new variables you set, Average Temperature and Max Humidity:

You should delete your Time Series Insights environment once you have completed this guide because it is a billable service and will incur ongoing costs for as long as it is running. Even if you are only using a free trial allowance, you may wish to spend it trying other parts of Azure.

Well done — you’ve completed this tutorial. You now have a geo-tagged temperature monitoring system that is ready to scale all over the world — courtesy of Twilio Trust Onboard and Azure. Now it’s over to you — you can adapt the system you have created to meet the needs of your own use-case. We can't wait to see what you build.

What Next?

If you haven’t yet run through Get Started with the Twilio Developer Kit for Broadband IoT, why not try it now? You’ve performed the key Developer Kit set-up tasks already, so you can jump straight in to create an app that uses the popular IoT-centric publish/subscribe messaging protocol MQTT to relay sensor data from the Developer Kit via the Cloud, and send commands back to the hardware.

Rate this page:

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.