IoT.Central.and.ADT.3d.Scenes.mp4
IoT Central as we know is a No Code aPaaS which allows users to quickly connect IoT Devices to cloud and start realizing use cases like Condition Monitoring, Remote Operations etc. Each device that gets connected already has Twin model defined, which makes integration with ADT as the logical next step. Here I demonstrate how you can not only integrate with ADT and start sending telemetry and properties to ADT but also how you can embed the ADT 3d Scenes back in IoT Central to close the loop and provide a richer experience to your users. This enables the users to walk through a plant or a mine, observe state of different assets, quickly identify assets which need attention and then drill down in a particular asset to view it in detail.
For the device groups/models that you would like to integrate with ADT, upload their DTDL Models into the ADT. Once uploaded create a default/empty twin of the asset with a dtid same as the device id from IoT Central.
- Manage models
- Create twins
- Models I used can be found in DTDLs directory
In IoT Central create a Data Export for all your devices to an Event Hub destination as per the instructions here. Configure the Data Export to export all of the Telemetry to the Even Hub.
Create an Azure Function with a trigger on Event Hub. This would be responsible to receive the telemetry from Event Hub and Patch it in ADT for the respective twin. You can find the source code for this Function at /Azure Function - Event Hub to ADT/TelemetryTrigger.cs You can see it finds the deviceId from the message which is used to link to the corresponding twin via dtid. Next it sends a Patch to ADT for all telemetry received.
The Azure Function requires following Applications settings defined:
- EVENTHUB - this is a connection string to the Event Hub
- ADT_SERVICE_URL - This is the ADT Instance URL e.g. https://my-twins3.api.aue.digitaltwins.azure.net
Please Note: The Azure Function must have Azure Digital Twins Data Owner access to the ADT. You can achieve this by giving a System assigned identity to the Azure function and then adding a Role access for it on ADT.
Now that we have Twins integrated with Device telemetry from IoT Central, next step is to create 3d Scenes and map telemetry and behaviors in the 3d models. You can follow the instructions here. Sample models can be found in this repository.
In this step you create an Azure App Service using https://github.com/malichishti/adt-3d-embedder-app This would enable you to embed any specific 3d Scene using an iFrame.
You are now ready to embed the 3d Scene in IoT Central:
- Create a new dashboard
- In he edit view, add a External content Tile
- In the properties of the tile add a URL to your embedder app including a querystring parameter called sceneId e.g.
https://3d-embedder.azurewebsites.net/?sceneId=3b614761fd1187ace3bac52ebb241c54
Now you will be able to see the 3d scene in your dashboard.
You can also setup navigation/drilldown between 3d scenes by using the Link Widget in 3d Scene Build view and passing a link to the embedder app.