How to implement feature flags and filters in .NET apps? A step-by-step guide
Along with improved DevOps expertise comes a better performance of delivery teams. And when many deployments take pl...
When talking about IoT solutions, think of devices generating data that we can analyze. Some sensors measure temperature or pressure. Others measure humidity and carbon dioxide level. All this data needs to be collected and processed. This creates a great opportunity to predict future trends, patterns or anomalies, like a machine overheating.
A function that can visualize physical environments and associated devices will help us make better use of this information. Microsoft just happens to offer such a service. They call it Azure Digital Twins.
Azure Digital Twins is an Azure IoT service that enables comprehensive virtual representations of physical environments and associated devices, sensors, and people. You can think of it as a service that lets you create definitions of spaces and combine them together with information about connected devices and sensors.
How about an example? You can define the location of offices at your place of business. Inside each office there are IoT devices with specific sensors (e.g. temperature). Now you can assign users to each room, so you have a clear view of the distribution of people in the office.
The image below shows a high-level concept of Azure Digital Twins:
As I mentioned before, the key concept of Azure Digital Twins is to create a virtual representation of spaces together with information about connected devices and sensors. When defining your setup, it is crucial to provide all these details.
When there are, say, two IoT devices with temperature sensors in three specific rooms in the office, it is important to recreate this mapping in the Azure Digital Twins spatial graph. Spatial graphs are virtual representations of the many relationships between spaces, devices, and people that are relevant to a specific IoT solution.
There are four main categories of objects in spatial graphs:
All of the above objects can have defined relationships with each other, with the end goal being a clear view of all spaces, devices connected to them and the people involved.
Going further, you can define actions based on data from specific sensors. For instance, if the temperature in a specific room is too high, there can be an e-mail sent to the office administrator to prompt them to adjust HVAC settings for that area.
This is possible because of another object in Azure Digital Twins called User-defined functions (UDFs) can perform the following actions:
Underneath, Azure Digital Twins uses the IoT Hub service, which is why it is much easier to integrate IoT devices with it.
If you are not familiar with the IoT Hub service, I encourage you to read one of my previous articles called Microsoft Azure Services For The Internet Of Things, where I cover a few of the key Azure services for the Internet of Things.
I’ve included a fragment of code definition for a spatial graph:
– name: Predica Office
– type: IoTHub
– name: Floor 0
– name: Conference Room 1
– name: AzureSphere
– dataType: Temperature
The following diagram presents the data flow and processing in Azure Digital Twins:
The main question is: How can we use Azure Digital Twins in application? Let’s go over some examples.
If you work in an office, you are probably aware of the constant challenges with meeting room availability. You are constantly trying to find free space to have a call with a customer or to organize a meeting with your team, but all the rooms are either booked in the calendar, or randomly occupied by people. If there are many meeting rooms in your office, it would be nice to quickly check availability in real-time. Azure Digital Twins can help.
There can be a motion sensor mounted in the each room, connected to Azure Digital Twins. Now, finding a free room in real time would be much easier.
Next, consider an organization with a large fleet of vehicles. Managing it is not an easy task.
Finding an available car or localizing it could be much easier with Azure Digital Twins. Each vehicle could have a GPS device which sends information about its position to the service.
Going further, there could be an application with a map to show the available vehicles, as well as those that are already on the road, assigned to specific employees.
The term “smart home” is not new to the market. You can use Azure Digital Twins to also build “smart home” solutions.
If each room had a mounted IoT device with specific sensors (like temperature or humidity), an owner of that house you could have a mobile application that shows all the readings in one place.
I encourage you to watch a short video which shows how Azure Digital Twins can be useful in hotel management:
As described earlier in the article, Azure Digital Twins enables physical environment mapping using IoT devices. I mentioned some use cases above but we can look at the Digital Twins from from a wider perspective. There are many possible use cases, lets discuss few of them:
Imagine that you are the owner of the hotel. You would like to have knowledge about parts in each room, that should be repaired or serviced, like a radiator or air conditioning.
As a restaurant owner you would like to measure power usage of some electronic devices in the kitchen so you can replace them with more efficient ones.
Managing manufacturing plant and predicting usage of some parts is not an easy task. It would be great to have information that some parts of the machines will broke soon so it is time to replace them in time.
It would be nice to automate the process related with creating tickets in your CRM, in this case Dynamics 365, to plan some actions like scheduling the meeting with person from service team. All these scenarios can be addressed with the Azure IoT service called Connected Field Service for Dynamics 365. Connected Field Service is an add-on solution to Microsoft Dynamics 365 for Field Service that connects IoT (Internet of Things) telemetry to business actions (like reporting that radiator is broken). Below diagram presents sample architecture for predictive maintenance solution:
With such solution you have not only the knowledge about exact place where intervention is required (thanks to Azure Digital Twins) but also automatic report in the Dynamics 365 so right people can solve all these problems quickly.
IoT solutions can be complex, so it is much easier to build them with existing cloud services like Azure Digital Twins. In this article I showcased a few key concepts related to this service.
Now you know that in a spatial graph there are four main object categories: spaces, devices, sensors and users. Based on data collected from IoT sensors, there can be actions performed. These are called User-defined functions (UDFs) and they include functionality like sending notifications or performing some additional, custom logic. We covered a few real-world scenarios.
At the time of writing this article, the Azure Digital Twins service is in the preview stage. Hopefully, Microsoft will announce the final version soon. In the meantime, feel free to get in touch for more information!
Read other similar articles