Creating Dynamic Grafana Dashboards for AWS IoT TwinMaker

4 minute read
Content level: Intermediate
5

This article provides guidance on using Grafana Variables together AWS IoT TwinMaker to build dynamic dashboards that will display Entity specific data as you navigate from one Tag to another within a Scene. This approach helps scale your application and reduces the burden of creating unique dashboards for every Entity you may have within IoT TwinMaker.

Introduction

As you build out visualizations for your digital twins in Grafana, you may have asked yourself “How can I use the same dashboard for multiple entities?” To simplify this, AWS IoT TwinMaker supports the use of Grafana Variables. The TwinMaker Scenes you create can populate variables in Grafana as you navigate from one Scene Tag to another. In this article, you will see how this is implemented using a Semi-Truck Digital Twin example from this workshop.

Overview

Prerequisites

  • AWS Account
  • An existing AWS IoT TwinMaker workspace with multiple entities and Grafana. If you do not have this, feel free to create this environment using this workshop: AWS IoT TwinMaker Advanced Workshop

Steps

  1. Let’s start by creating a scene with multiple entities such as Semi-Trucks in a parking lot. For each truck, create a Scene Tag and assign it an entity id. When you view this scene in Grafana and click on a Scene Tag, two variables in Grafana will be populated with context of your selection. You will create these variables in Grafana later.
  • sel_entity = Assigned entity to tag
  • sel_comp = Assigned component to tag

ReservedVariables

  1. In addition to these reserved variables, you can set customized ones. By adding a parameter to a Tag, you can set the Key (Variable name), and the value. In this case, the value is a property name for that entity we would like to trend data for. This allows you to have a time series panel that can switch from trending one property to another. You can create multiple parameters if needed.

CustomizedVariables

  1. Next we will create another scene for a selected truck. We will configure Scene Templatization in this view. Go to the Settings tab and assign an entity and component to Data Binding.

SceneTemplates

  1. For the model in your scene, reference the sel_entity and sel_comp template variables in your animations. The example below is applying that to the model shader. This can also be applied to other animations like the motion indicator.

UseVariablesinSceneTemplate

  1. Now with both scenes created, we will build a dynamic dashboard in Grafana. In a new or existing dashboard, go to the settings of the dashboard. Select variables and create sel_entity. Select type Text Box. If you want the variable to be hidden from view of users, select to hide Variable. Note, in the following screenshots, this is not hidden so you can see the value that is assigned to these variables at the top of the dashboard.

CreateVariablesInGrafana

  1. Create the remaining variables: sel_comp (reserved), sel_property (custom)

CreateRemainingVariables

  1. With the variables created, add a panel to the dashboard and select the visualization type “AWS IoT TwinMaker Scene Viewer”. On the properties to the right, assign sel_entity and sel_comp for the selected variables. By doing so, when you select one Tag versus another, it will assign the values of these variables based on the configuration of the Scene Tag we did earlier.

ConfigureSceneInGrafana

  1. When you select a Tag in the scene, you will notice the values change based on the Tag selected. Again, these variables are currently not “Hidden”.

GrafanaVariables

  1. Create another panel to trend time series data. Use the variables created earlier so you can query data that is defined for that Tag.

TimeSeriesTrend

  1. Create one last panel for the scene of the selected truck. Configure the panel with the variables as well.

ConfigureTruckSceneInGrafana

  1. That’s it! Now when you navigate from one Scene Tag to another, the dashboard will display data for the selected entity.

Conclusion

In this article, you learned how to use Grafana Variables together AWS IoT TwinMaker to build dynamic dashboards that will display Entity specific data as you navigate from one Tag to another within a Scene. With this approach, you can create a scalable solution that reduces the burden of creating unique dashboards for every Entity you may have within IoT TwinMaker.

profile pictureAWS
EXPERT
published a year ago1900 views