Monitoring office asset use for improved facility management with Yanzi, Coor, and Intel
Our need to be flexible and mobile and work in an agile way demands that we be able to prioritize. Being productive is a function of doing things in the right order. This can vary from day to day and often depends on the needs for that specific moment.
Still, we get used to doing things the same way every day. When someone cleans an office, for example, they might start with the first room and work their way systematically through the others. But in an open office landscape, some areas might not have been used that day. Why clean the area again if no one has used it?
What if we knew that an area had been used a lot during the day and could prioritize it for more deep cleaning? What if all wastebaskets that needed emptying would signal this, and the cleaner would get a live report showing exactly when a basket is emptied and automatically creating a sign-off report?
Today we can put sensors on a lot of items, and they can return different kinds of data. With this in mind, Microsoft worked with Yanzi Networks, Coor, and Intel to showcase how to easily set up a grid of sensors and deploy them in Microsoft Azure to follow different activities.
The array of Yanzi Networks sensors is automatically configured, and in just a few hours it can be installed in a full-sized office and be up and running, with sensor data being transferred to an Azure implementation where you can easily monitor your data. With enough data, you can even predict when different scenarios may occur.
Coor can get this information into their planning phase for each worker, helping them focus on the areas of importance and ensure that more frequently used office areas are prioritized.
Key technologies used
- Azure Event Hubs
- Azure IoT Hub
- Azure Functions
- Azure Service Bus
- Azure SQL Database
- Azure Stream Analytics
- Microsoft Power BI
- Universal Windows Platform (UWP) app
- Sanna Edmundsson – Head of Space Management, Coor
- Marie Lassborn – Vice President Cloud Platform, Yanzi Networks
- Oriol Piñol Piñol – Technical Lead IoT Platform, Yanzi Networks
- Dag König – Senior Technical Evangelist, Microsoft Sweden
- Anders Thun – Principal Technical Evangelist, Microsoft Sweden
- Peter Bryntesson – Principal Technical Evangelist, Microsoft Sweden
This is a joint venture with three partners and Microsoft:
Yanzi Networks has developed an open, fast, robust, and evolutionary software and networking platform for IoT. Yanzi collaborates with the industry’s largest vendors to deliver value to the real estate owners and facility management companies that wish to enter the world of “smart” buildings. Yanzi Networks AB is a venture-backed company with headquarters in Kista, Sweden.
“Adding sensors to existing buildings is giving us the chance to actually learn to know the buildings in a new way.” —Marie Lassborn, VP Cloud Platform, Yanzi Networks
Coor is a leading provider of IFM and FM services in the Nordic region, offering all the facility management services necessary for a company or public body to work smoothly and effectively.
“This kind of solution will be a fundamental tool for any activity-based workplace.” —Sanna Edmundsson, Head of Space Management, Coor
Intel is a leading global provider of computing technologies for global cloud providers, communications network providers, and computing clients such as PCs, tablets, and Internet of Things (IoT).
Yanzi Networks has developed a software and networking platform for IoT that includes sensors and network infrastructure. Several Yanzi products, primary gateways, and cloud servers run on Intel hardware platforms, which makes Yanzi part of the Intel ecosystem for IoT. Yanzi’s expertise lies in device management and the secure collection of data from sensor to cloud. Currently, the Yanzi platform does not provide a platform for analyzing and visualizing the information. Yanzi needed a simple way to get customers up and running and be able to quickly start the analysis of the office data.
Microsoft Sweden’s facilities are managed by Coor, which made it natural to start implementation of the solution here. It has been partly implemented, and a project to develop the service further is ongoing. In the long run, Coor believes that this kind of solution will be a fundamental tool for any activity-based workplace to ensure control of facility and real estate management as well as space utilization. The benefit of the end-to-end solution for a supplier of facilities management such as Coor lies primarily in two areas:
Coor has an advisory service function that explicitly works with developing new, smarter workplaces with a customized, activity-based approach. To develop a customized workplace, the key is to have a granular analysis of the actual need for workspaces, and this solution could measure the utilization in an efficient way. It would put the facts on the table and be a strong tool in creating and anchoring the future workplace need—both from a physical and behavioral perspective.
Coor also believes this kind of solution will give their customers a better service delivery when operating a facility. It will be a cost-effective solution that Coor can offer to their customers, which guarantees a customized service delivery based on actual need, rather than frequencies decided beforehand. Coor sees enormous potential and a wide variety of possible functionality—from being notified when the coffee beans will run out to detailed space management analysis revealing whether the current location really can handle a planned expansion of the workforce.
Solution and steps
This project has three objectives:
- Implement an IoT solution for facility management at the sample office, that is, Microsoft’s office in Sweden.
- Extract a general template for creating this solution in other situations and places.
- Create a simulated environment for testing the solution prior to installing any real Yanzi Networks sensors.
The solution focuses on collecting information from sensors, both for real time (website) and batch (Power BI) analysis. Two types of data are collected: status, with the interval of one minute, and events, when a status has changed. They are collected for the following:
- Temperature (status)
- Humidity (status)
- CO2 (status)
- Desks (event, free/occupied)
- Conference rooms (event, free/occupied)
- Toilets (event, free/occupied)
Yanzi Networks installed 140 sensors on the first floor of the Microsoft building. It was a combination of sensors collecting temperature, motion, CO2, and humidity. The installation took about 2.5 minutes per sensor. This allowed for very efficient physical deployments of sensors.
Motion sensors were used to register whether an area, such as a conference room, desk, or toilet, was occupied.
The following image shows one of the areas in the Microsoft office where all the desks are monitored.
A motion sensor is installed beneath each desk.
One or two motion sensors were needed in each room, depending on the size of the room. Here the sensor has been mounted onto the wall.
Yanzi Networks cloud servers collect the sensor information and send it by the Yanzi gateway to an event hub in Azure (IoT Hub can also be used depending on the need). The development adjustments of the Yanzi gateway to communicate with Azure were also part of this project. The gateway is done in Java and deployed on a Linux server. (The Yanzi gateway code is not part of the GitHub repository.)
An Azure Stream Analytics job reads from the event hub/IoT hub and processes the information, mainly by transferring it to different sources. The Stream Analytics job sends the information to an Azure Service Bus topic for real-time information and to an Azure SQL Database for business analysis.
A web application, hosted in Azure as a web app, is listening to the events from the Service Bus topic queue and sends the events to a web page by using a web socket connection. The web page contains an SVG map of the office and updates the map using the information in the events.
The real-time visualization is a good way to see which desks and conference rooms are available. Real-time visualization is one productivity key for an office worker and will drive usage of otherwise unused areas when those are a bit further away from the main parts of the office.
We added an optional Universal Windows Platform (UWP) app, which can be easily installed on an Intel Stick and added to a monitor or a TV as shown in the following diagram.
Because the application is very lightweight, we also tried the solution using a Raspberry Pi to drive the display of the real-time floor map on a large screen. (This app is in the GitHub repository.)
Regarding the choice between Event Hubs and IoT Hub
The solution is built to support both types of gateways, but for the current solution we decided to use Azure Event Hubs for the following reasons:
- It is only one device (channel) from the Yanzi gateway to the event hub, and is secured with its own key.
- Yanzi itself has a very good device management solution, including certificates for each device and over-the-air upgrades (this is part of their core offering).
- It has an archiving function.
- It is a more economical solution with this load.
Azure IoT Hub is a better choice when:
- More devices are added to the solution—for example, from other manufacturers, especially if they don’t have good device management.
- Features that IoT Hub has, such as File Transfer, are needed.
- A more predictable cost is needed.
Visualization of data
A Power BI dashboard was created to host visualizations of the data. It uses the SQL Database as its source and primarily illustrates an overview of the office use.
Diving into the visualization, we can see several things:
Some KPIs over current usage
A list of all the different sensors, sorted by usage
At the top, a graph that correlates the use this week against average use
A heatmap superimposed on top of the floor plan, indicating the usage of the individual desks, conference rooms, and toilets. It goes from blue to red—where blue is very low usage and red is very high.
In the rightmost column, we see three different views on usage:
- Top: By type, such as desks, conference rooms, and toilets.
- Middle: By time per weekday, so we can compare over the course of a day between weekdays.
- Bottom: A trending overall usage per week.
This view shows data from the different environmental sensors.
The graphs, all by time per weekday, hold data from a screenshot taken in October 2016. The graphs show:
- Carbon dioxide levels. Note that it’s not until Saturday at 18:00 that we reach the «low» level. (Work days in Sweden are Monday–Friday).
- Temperature. Here we see that both people and time of day influence temperature. (Weather, such as sun/no sun, affects the overall temperature as well.)
- Humidity. It varies little and it’s difficult to draw any conclusions.
If we go beyond the individual trends and look at the values themselves, we can see that the office is good at maintaining a healthy and steady working climate.
This solution relies on Yanzi for endpoint security of devices. It is a highly secure solution with all links being authenticated with client and server certificates, and all communication made using SSL encryption. Each device has an individual key and can be revoked remotely. Yanzi is also responsible for the update strategy of firmware.
The access to the data is done through user authentication within an Azure Active Directory. (In the example, this is not enabled for the real-time website, only for the Power BI dashboard.)
The Event Hubs endpoint is secured with a symmetric key for each gateway. All internal connections between services also use unique shared access policies with minimal claims.
The data is stored in two places:
- Azure SQL Database, where auditing and other security features can be leveraged.
- Azure Storage, using the security features that this service provides.
This solution doesn’t collect any personal information, especially in the Microsoft installation, where an open office policy is in place. However, if this solution is used in other settings, it could indirectly collect personal information (for example, if each person has his/her own workspace).
Also, be aware that, if this data is combined with other data sources (such as new types of sensors) or is used by other services (such as Office 365), the privacy concerns need to be evaluated.
Always use data with precaution, and always think about how the data could be used.
Architecture technical implementation
Azure Event Hubs
Yanzi Networks has a gateway that transfers all messages (called “samples” in their system) into Azure, using an event hub. (We could also use an IoT hub, but we do not need device management or commands in version 1.0 of this solution.)
The event hub stores all incoming messages into Azure Blob storage. The messages stored there are not actively used today. However, they will be used to transfer data into Big Data Analysis in the future.
Azure Stream Analytics
A Stream Analytics job reads the messages from the event hub and converts and transfers these messages from Yanzi to four outputs:
- Two outputs into a SQL database.
- A Service Bus topic that the web server is listening to. It is used to update the real-time floor map.
- A Service Bus topic that transfers all admin messages to Azure WebJobs, which updates reference data in the SQL database.
Azure Blob storage is also used as an input to Stream Analytics. It contains additional reference information about the sensors and is used by joining it with the stream to produce richer output.
Azure SQL Database
This database is used to:
- Store reference data about all sensors (assets).
- Be the source for Power BI reports.
Three tables are used in the database:
- Asset. The information about the sensors.
- LastKnownSampleStatus. The latest sample from each sensor.
- Samples. The samples history.
The solution uses only stored procedures to communicate with the database.
Most of these WebJobs can be migrated to Azure Functions when functions are available and mature. Because SQL Server Agent is not available for SQL Database, the WebJobs approach is the best way of calling stored procedures on a schedule.
Create Snapshot (webjob-snapshot-sql). This WebJob is executed every 10 minutes, providing a snapshot of the status for event type sensors in the table LastKnownSampleStatus and storing that information in Samples. For this solution, this is the best way to store data points every 10 minutes, which is needed for Power BI to produce accurate usage reports.
For status type sensors (such as temperature and humidity), a Stream Analytics query with a tumbling window of 10 minutes is used.
Admin (webjob-admin-worker). This WebJob listens to admin messages from the Admin Service Bus topic and updates the table Asset accordingly.
A Web App is used to view the real-time display of a floor. When it starts, it first gets the current status of all assets from SQL Database and then starts listening on the Service Bus topic.
Universal Windows Platform app
An app is created that hosts the website, and that app is installed on a Raspberry Pi, running Windows IoT Core, or on an Intel Stick, running the desktop version of Windows 10.
Because the UWP app uses Xamarin, it is available for all relevant mobile devices as well.
This is a Windows console application that gets sensor information from Yanzi (their API is called “Cirrus”) and sends it to the Admin Service Bus topic. This temporary solution is being used right now to get it to work until Yanzi has implemented support for admin messages.
This is a Windows console application that creates a reference blob that Stream Analytics uses. This is a temporary solution for now.
The simulator has two responsibilities: it initializes the solution with sensor data, and it simulates messages from the Yanzi gateway.
Yanzi Networks sensors. All sensor products are multi-sensor solutions with duplex communication and over-the-air upgrades. Each sensor communicates wirelessly every minute with a local gateway. This local gateway communicates with Yanzi’s cloud.
The following sensors are used in this solution:
- Yanzi Motion (motion, acceleration, temperature)
- Yanzi Air (CO2, temperature, humidity)
- Yanzi Climate (temperature, humidity)
Deployment of the simulated solution
Be aware that there will be a charge to run this solution in Azure.
This deployment script will create the following artifacts:
- Event Hubs
- Stream Analytics job
- Service Bus with two topics
- SQL database
- Storage account
- Web App for real-time floor map visualization
- Admin WebJob
- SQL Snapshot WebJob
- WebJob that hosts the Yanzi Networks simulator
It will not install the Power BI reports because this is not currently possible to do through scripting.
Clone or download the source code. You’ll find the solution in this GitHub repository.
Install Azure CLI:
npm install -g azure-cli
Choose an account and subscription in which to install the solution.
3.1. First, sign in to Azure:
3.2. Check to see if you have several subscriptions on your account:
azure account list
3.3. Look in the current column to see if the right subscription is set. If not, use
azure account setto change the subscription.
Start the installation of the solution.
4.1. Go to the deployment directory.
npm install node deploy
4.3. Provide this information:
- A prefix, used in namespaces and URLs to make names globally unique. Keep it short, with a maximum of five characters.
- The name of the resource group in which the solution will be hosted.
- The region where it should be deployed.
It will take 5 to 10 minutes to deploy the solution. Following is a shortened screen capture of this deployment.
Run the solution.
** DEPLOYMENT SUCCEDED ** ============================ SUMMARY ================================= == SQL Server == Server name: k12-sqlser-k6vwbkvm77z64 == Database name: anneroDb == Admin Login name: k12-admin == Admin Password: WZLNaN?3fpXco43974 == Web Application Url: http://k12-floormap.azurewebsites.net == == Yanzi Send Connection string: Endpoint=sb://k12-fm112.servicebus.windows.net/;SharedAccessKeyName=yanziSendRule;SharedAccessKey=Ph4/CyJU63zSYGB5tmimytWL19rzUXmzBSgrLX85bwQ=;EntityPath=annero-eh == ======================================================================
Open the Web App to see the simulation. Also, open the Azure Portal and the resource group that you just created and explore all the services hosted inside.
Sensors can give us data, and data can be collected and stored. But it is when we use the data, turn it into insights, and illustrate it in the right way and in the right format that it becomes valuable. With this project, we wanted to illustrate how to set up an office space with sensors, easily deploy a solution to both collect and store the data, and get insights from the data.
Deploying the backend in Azure is easily done with ARM templates in just a few minutes, and insights can be viewed and drilled down into by using Power BI. Real-time information can be shown using tiny Raspberry Pi devices and a UWP app. The solution works both with Event Hubs and IOT Hub, and anyone can hook into the data flow to add new functionality and more value to the solution.
The code is provided as a sample. It can be used as a starting point for anyone wanting to explore the world of IoT.
Opportunities going forward
This is only the beginning—we hope to take this solution even further. With this platform, it will be easy to start building systems that are integrated with Office 365, allowing better management of, for example, conference room bookings. Further along, it can also be used to send commands back to control and automatically manage the building—for example, change the air ventilation if CO2 levels are too high.
We (Microsoft) have included this in our experience tour that we have for customers who visit us here in Sweden. This gives customers a feel for IoT in place in a very easy way. We are taking the bits to customers and kick-starting lots of projects in many different verticals. The uptake has been fantastic. It’s an easy way to get started, understand the benefits, and grow at your own pace.
Feel free to use the bits to play with and learn how this will fit you in the best of ways. Have fun!
- Azure Event Hubs documentation
- Azure Functions developers guide
- Azure IoT Hub documentation
- Azure Service Bus documentation
- Azure SQL Database documentation
- Azure Stream Analytics documentation
- Find IoT devices and starter kits: Azure IoT device catalog
- Try any Azure services for free: Create your free Azure account today
- Check out a curated collection of IoT learning resources: Microsoft Technical Community Content on GitHub
- Read more IoT-focused technical case studies (like this one)