Connecting Your Physical Environment to a Digital World - A Roadmap to IoT Solutioning


Connecting Your Physical Environment to a Digital World
Main Presentation
PREVIEW27m 40s

The course is part of this learning path

Main Presentation

With 80% of the world's data collected in the last 2 years, it is estimated that there are currently 32 billion connected devices generating said data. Many organizations are looking to capitalize on this for the purposes of automation or estimation and require a starting point to do so. This session will share an IoT real-world adoption scenario and how the team went about incorporating IoT Azure services.

Learning Objectives

  • Understand the fundamentals of the Internet of Things (IoT)
  • Learn about Azure's IoT offering
  • Understand how IoT solutions can be used in the real world

Intended Audience

  • Solution architects
  • Business managers
  • Developers
  • Anyone interested in building IoT solutions with Azure services


To get the most out of this course, you should already have a working knowledge of Microsoft Azure.



Hello everyone and welcome to the Connecting Your Physical Environment to a Digital World, A Roadmap to IoT Solutioning session. My name is Anthony Bartolo and I'm a senior cloud advocate here at Microsoft, based in Toronto, Ontario, Canada, with a passion for connecting people, places, and things with the enablement of everyone.

In this session, there will be a brief introduction to IoT, and Microsoft's Azure IoT offering, a discussion around IoT solutioning, understanding the opportunity including the appropriate parties before harnessing the technology, and look at a real-world implementation of Azure IoT. Let's go ahead and get started.

So just what is the Internet of Things? The Internet of Things really comes down to four key things, physical things that, you know, such as line of business assets, including industry devices or sensors, those things have the ability to connect to the internet or to other humans. Those things have the ability to collect and communicate information. This information may include data collected from the environment or inputted by users. And the ability to take the information and provide analytics that comes from this data, to enable people or machines to take action. 

IoT has been seen as the innovation that enables new opportunities. With the introduction of cloud computing, IoT devices can be connected to globally available unlimited compute resources. These resources can harness signals, from a plethora of sensors and devices which can be managed centrally by the cloud. New advancements in Edge computing and AI, can now offload intelligence to the Edge, capturing only the result and not the raw data from said IoT devices. And finally, Digital Twins represents a new opportunity to create living replicas of any physical environment, track the past and predict the future.

Given our work with these types of customers, we've learned a lot in terms of our implementations of IoT. We've seen customers realize big benefits from using IoT to transform their business. But we've also learned that IoT projects can be complex. They can be long and drawn out, and they can take several months to complete a simple POC or Proof of Concept. One of the hardest problems is scale. When assets are spread all over the place, connecting to these devices, thousands and millions of them, and ingesting the data from these devices can be complex.

Lastly, it's no good to have an IoT solution that cannot integrate with your existing business system. And some of these solutions that are out of the box can be hard to customize and fit to your business needs. So let's show you how we're solving these opportunities, with Azure IoT Services. With Azure IoT Services, Microsoft gives you a very comprehensive solution that's designed to help you connect your devices, whether it be a few hundred or millions across the world, analyze all the data coming back from these devices, and take action from the insights by integrating with your backend systems.

Azure IoT Services offers the following capabilities: device, connection, and management. The ability to connect to millions of devices simultaneously. Enhanced security of your IoT solutions by taking advantage of per-device authentication to communicate with devices that have appropriate credentials. Revoke access rights to specific devices to maintain the integrity of your system. Data ingestion and command and control, establishes reliable bi-directional communication with these assets, even if they are intermittently connected, and analyzed on an act-on basis, on incoming telemetry data. Workflow automation, enabling the ability to integrate with your company's existing backend systems to enable the best use of data and processes you already have. Whether it's simple as sending a text or integrating with your CRM or EPP systems. Dashboards and visualization, creating powerful and rich visualization experiences with tools like Power BI, to view the larger picture of what your data is telling you. And finally, Preconfigured solutions. One of the biggest value Microsoft can provide is helping you develop IoT solutions faster. This will not only allow you to do more proof of concepts and pilots, it will also help accelerate the long project cycles we spoke about earlier. We do this by offering pre-configured solutions for the more common IoT scenarios.

So now we're gonna walk through a real world example of Azure IoT Services in use. In this proof of concept, a team of five were given 48 hours to address an opportunity with Microsoft's Azure IoT Services. The team's selected to address the opportunity of pest control. Rats, mice and other vermin had been a huge problem in many urban areas. They have the capability of spreading over 35 diseases, and can cause potential business loss if reported that mice were visible at their establishment. Understanding the opportunity provided the team with proper foundation to build the IoT mousetrap solution, as there was a clear benefit this solution would address. Pest control companies would greatly benefit in being more proactive, in the placement and clearing of traps. This would also provide an opportunity to increase revenue and reduce costs in worker hours and gas, by catching more mice effectively. Let's take a look at the design of the automated mousetrap solution, and what Azure IoT Services were used to architect it.

As mentioned earlier, IoT solutions can be complex. Something as simple as a smart mousetrap can be a daunting task to address. Let's take a moment to break this opportunity down and cover the Azure IoT Services that make up the solution. At the core, the mousetrap IoT application consists of the following subsystems. Devices, in essence the mousetrap, that has the ability to securely register with the cloud, and connectivity options for sending and receiving data with the cloud, a Cloud Gateway service or in our case Azure IoT Hub to securely accept that data and provide device management capabilities. Stream processors that consume the data, integrate it with your business processes and place the data into storage. And finally a user interface like Power BI, to visualize telemetry data and facilitate device management.

So here is the Raspberry Pi mousetrap in all its glory. As you can see, the construct is simple. When the trap captures a mouse, it sets off a trigger which sets off a bunch of tasks in motion. These tasks include the time of the trap being set off, the placement of the trap assigned by the mobile app, and the placement of the trap via GPS inside of the building. This project has been made available as an open source project and can be reviewed

All right, now it's time to dive into our demos. For our first demo, we're going to go ahead and set up an Azure IoT Hub. Once the IoT hub is created, we will connect a Raspberry Pi to the service, and begin capturing information. What is great about this demo, is that you too can participate in this demo via Microsoft Learn for free. Links to this demo will be shared at the end of this presentation. Now Raspberry Pi boards are popular IoT devices for education, for testing ideas, and even for building some worthwhile systems. Although the cost of a board isn't prohibitive, we can test the Raspberry Pi functionality before investing in actual hardware.

Microsoft has built an online Raspberry Pi as your IoT simulator, which allows users to control the emulated hardware via code. In this example, we will be using the emulator to simulate the capture of data pertaining to temperature, humidity, and pressure sensor, and a red LED pulse to boot. The emulated breadboard even contains a BME 280 sensor, to capture the required data. Also take note that the displayed side panel enables users to enter Node.js code, to control the LED, and collect a dummy data, from a simulated sensor. We will also be using the side panel, to add the IoT Hub key, to enable a secure connection between the simulated Raspberry Pi and the IoT Hub. So let's get started.

Here we are in the Azure Services portal. As you know, access to all of Azure Services begins here, and Azure IoT Services is no different. On the opposite side is the Raspberry Pi Azure IoT online simulator, which will simulate the capture, of data pertaining to temperature, humidity and pressure as mentioned earlier. Our first step will be to set up the Azure IoT Hub to register the devices. This will be followed by harnessing it to capture the information from the emulated Raspberry Pis. To do this, simply enter IoT in the search bar above, and then select IoT Hub to get started.

In the IoT pane, you're gonna be entering the following information into your IoT Hub. Subscription, which subscription are you gonna be using for this demonstration or proof of concept? Resource group, IoT Hub name. Make sure that your IoT Hub name is unique. You wanna ensure that you have the green check mark before you move forward. Once we've selected review and create and then create, it'll go forward and take some time to create the new Azure IoT Hub. Of course, we've sped it up for this demonstration. As you can see, you can actually download the deployment details as well to replicate your IoT Hub creation, as well as next steps are made available in terms of step-by-step instructions, right through Azure portal, to get understanding of what you could do next in adding devices to your Azure IoT Hub.

Select Go to resource when the deployment is complete. We also have a graphical representation of our IoT Hub in terms of connected devices and the information that it is sharing to that hub. Currently it's empty because we haven't connected any devices to it. That's our next step. So selecting IoT devices. We're now gonna add an IoT device to connect to our IoT Hub. We're gonna enter a meaningful device ID which will identify the IoT device that we're gonna connect. And we're gonna allow for the solution to auto-generate keys for us to use as a connection string, to the IoT Hub when we're plugging this into our Raspberry Pi. When this is completed, we're going to go back and we're gonna copy the primary connection string information to a text file, to use in the next section.

Next, we're gonna navigate back to the Raspberry Pi Azure IoT simulator and replace the placeholder in the line 15 with the connection string for Azure IoT Hub Service from the text file. We're next gonna select Run or enter NPN start in the console window, to run the application. You should now see an output being emulated as it shows the sensor data and messages sent to your IoT Hub. Also notice how the LED flashes each time a message is sent. When we navigate back to the IoT Hub pane, you can now see that the metrics or the reporting that the device is connected, and the IoT Hub is receiving messages.

Metrics located within Azure IoT Hub, provide further information about the state of Azure IoT resources in your subscription. This is currently showing a zero because no devices are connected to it. You also have the ability to report out specific messages that are coming out from your Azure IoT Hub devices, directly from the IoT Hub itself. And that's the end of the Azure IoT Hub demo. This is a visual representation as produced in Power BI that represents the mice being caught and what areas in the building they are being caught in. The visuals are interactive and provide device specific data in terms of the length of time it took to catch the mouse, and the length of time it took the pest control company to clear the traps within both a specific room, and the building itself. his report offers suggestions on better placement of the mousetraps within rooms, of a building via color coding. It also takes into consideration travel time the pest control company would need to complete to clear the set traps of vermin.

Next, we will look at how the data is fed into Power BI to be visualized. For our second demo in this presentation, we're now going to feed the Azure IoT Hub data into Stream Analytics, and finally visualize the output in Power BI. Visualization is important as it provides an easier way to view the data your IoT devices are capturing. In the case of the mousetrap solution, the data is being fed into your Machine Learning Workbench to analyze the data first, before outputting the results of the data through Power BI. We will not be showing the Azure Machine Learning Workbench in this example, since we are specifically focusing on Azure IoT Services enablement. Do know that the process to feed information into Azure Machine Learning Workbench, is in fact similar as it would be where the created output, would be pointed to for data ingestion. Again, this demo is offered as a Microsoft Learn module, allowing you to participate for free. Links to this demo will be shared at the end of this presentation. Let's begin with this demo.

So here we are back at the Azure IoT Hub from earlier. As you can see, the hub is still receiving data from the virtual Raspberry Pi we set up earlier. Our next step is to set up a Stream Analytics job to both ingest and output the data being captured by the Raspberry Pi device. To accomplish this we simply click on the search bar and enter the word Stream and select Stream Analytics job. We'll need to add a new job which will require a job name, resource group, and location. Also take note of the hosting environment selection. This solution will stream data from the cloud but data can also be streamed on the Edge, should the end point device support it. Once completed we would click create, but I've already created the Stream Analytics job so we'll use that instead.

Inside of our Stream Analytics job, we'll need to set up an input, a query, and an output. The query is what pulls the data from the input, pushes it to the output and it's customized by you to meet your data reporting requirements. We'll start with the input first, which has already been created. You are expected to provide the input alias. The Azure IoT Hub section is auto-completed, based on what is offered in your Azure subscription. The endpoint is set to messaging to feed data to the query.

Next, we'll create the output. This will require you to submit the alias workspace, dataset name, and table name. This is where the data will reside once pulled via the query and made ready for the output in Power BI. Next, we set up the query to pull the desired input data, to be pushed out to the output for visualization. Again, this can be customized to pull data or push data to multiple sources. And the selection can be customized based on need. As you can see, the input is capturing the data still being delivered, via the Raspberry Pi we set up earlier. With the query now created, we can go ahead and start the Stream Analytics job. 

In Power BI, we would capture the output dataset as provided by the same subscription. Our device has not been transmitting data for long, so the visualization of temperature and humidity is kind of small. This data can be visualized in many different chart formats and a free trial of Power BI is also available to allow you to complete this lab at home. And that is the end of the Stream Analytics job and Power BI visualization demo.

So let's take the mousetrap solution a step further. With the information on where the mouse traps have been placed and how many mice have been captured, we are now able to predict the best places to place the traps to catch the most mice. What if you wanted to speed up the learning process in terms of the best places to set the traps? Enter the concept of Digital Twin, a virtual representation of a physical environment, that brings in data from a variety of sources or in our case, mousetraps.

The Digital Twin concept can be broadly applicable to modeling all the ways we live and work in our physical environment. Modeling the complex interactions in high-value intersections between people, places, and things, can unlock new opportunities, create new efficiencies, and in our case, improve the ability to catch mice. The solution uses Azure's Digital Twins cloud, AI, and IoT capabilities to model a building that traps would be placed at, track real-time data and provide prediction of mouse capture in a virtualized model.

Innovation is a journey without end. People and organizations are constantly pushing the possibilities of our physical and digital worlds. Worlds that are increasingly converging, driven forward by technology from Cloud to the Edge. AI and IoT are now allowing us to create digital models of our physical spaces, creating the stories, touch points, and solutions by realizing the relationships and interactions between people, places, and devices. With the promise of AI we can uncover insights that see problems before we experience them. We can better understand the needs, and improve the experiences that our people want. We can see, learn, and even predict how people move through and interact with the spaces around them. Connecting these stories and data to power modern businesses, building new possibilities in real-time. This is made possible by Microsoft partners and an end-to-end Microsoft cloud offering, to help bring to life smarter spaces that connect to a digital world, and turn new possibilities into new realities.

Microsoft regularly participates in proof of concept projects as a way to test new theories on how new Azure Services can be adopted. Projects like the mousetrap solution also provide customers and Microsoft engineers, a unique way to upscale onset technology. What is special about the mousetrap project though is that the design, architecture, both machine learning and infrastructure, and code have been made available as an open source solution. People and organizations have taken advantage of this and have harnessed the solution to address other opportunities.

An example of this is a recent project that has taken the same architecture, and tied the trigger to the music played on an Ice Cream truck. These trucks frequently travel around major cities here in Canada, during the summer months to sell Ice Cream. Now, the drivers who have been selling Ice Cream for a while, know all the best places to sell the most Ice Cream. However, as gas prices rise and the operation of the Ice Cream truck becomes more expensive, the margins for selling Ice Cream become much smaller. Ice Cream truck drivers were looking for a better way to service their customers, and keep their overhead low to ensure that they can make a profit. Local developers stepped in, and devised a solution based on the open source offering of the mousetrap solution. When servicing customers, the Ice Cream truck drivers stop playing the music on the loudspeaker to be able to hear the customer's orders. With the trigger of turning off the music now enabled, information regarding the geographical location of the Ice Cream truck is captured, along with how many sales were completed at that stop. This data along with weather data and proximity data to surrounding fuel refill stations is fed into machine learning to understand the best practices, to service the Ice Cream truck drivers' customers at the lowest operating costs. Predictive analytical results of this data enables the Ice Cream truck driver to be more proactive in traveling to areas, to service the most customers, while keeping operational costs low. And it's visually represented via Power BI on their tablets in the Ice Cream truck.

So there was a lot covered in this session. And as mentioned during this presentation, all the live demos of connecting IoT devices to IoT Hub, as well as feeding information from IoT devices to streaming analytics are available for you to replicate and practice. This deck and other resources are gonna be made available, with the links that are provided in front of you. This will provide you full-on access to this deck, the videos, and the step-by-step instructions on how to complete the lives that were presented.

To also further assist you in your learning, we have curated a collection of modules on the Microsoft Learn platform, pertaining to the topics in this session. The demos that were delivered within this presentation, actually use Microsoft Learn technology to allow for step-by-step instruction and free replication of that information and creation of IoT Services. These modules will also allow you to interactively learn, how to securely connect IoT devices to the cloud, how to implement streaming analytics in the cloud, and detail how to create quick proof of concepts, with Azure IoT Central.

For those of you who are unaware, Microsoft Learn is a free hands-on resource that provides step-by-step instruction to these demos, as well as other Azure IoT labs. No Azure subscription is needed, for the majority of the Microsoft learning modules, and the learning paths offered. This presentation and the associated learn modules can help you start your journey to official certification. If you are interested in obtaining accreditation, that can help you stand as a certified Microsoft Azure IoT Developer, we recommend reviewing AZ-220 certification. You can find details on the topics covered, and schedule an exam today at For more free interactive learning content, check out Microsoft Learn at, to begin your own custom learning path with resources on the latest topics and trends in technology. Again, my name is Anthony Bartolo, senior cloud advocate with Microsoft. And if you wanna reach me, you can find me on Twitter @wirelesslife. Thank you for attending this session.

About the Author

This open-source content has been provided by Microsoft Learn under the Creative Commons public license, which can be accessed here. This content, which can be accessed here, is subject to copyright.