engineering

4min read

Smart Office—Bluetooth Mesh Sensors System for Better Office Life

Smart Office—what is it?

We created a system of sensors called Smart Office to measure various parameters in Polidea’s office. Most of the sensors measure air quality (PM pollution, CO2 concentration), temperature, humidity, etc. but pretty much any kind of sensor can be easily added to the whole system. Measurements are displayed on the web dashboard accessible for everyone in our internal office network.

Why creating a custom sensors system

Our initial idea behind the project was to present some possibly useful data about the conditions in the office to our coworkers. Especially data about CO2 concentration and temperature in conference rooms could be valuable when choosing a place for your next meeting. Or maybe we would like to spot the noisiest part of the office and find a way to solve this problem.

Another reason was our curiosity on how the data would look like and how it would change in correlation to some external factors—like the current number of people in the office or air pollution level outside the office.

Last but not least, as always, we wanted to try out some new technology that we haven’t touched before.This time we chose Bluetooth Mesh, technology born in 2014 but officially presented in 2017. It is still fairly new, especially when it comes to small embedded devices. We thought that this project would be a perfect opportunity to get more familiar with it and check if it is ready to be used in commercial products.

Conference meeting at the office.

The tech behind

Let’s have a look at what our system consists of. At first, we decided on some sensors that we thought would be useful in the office. We bought some CO2, temperature, humidity, pressure and particulate matter (PM) sensors. From the beginning, we planned to put most of them in the conference rooms. The rest of them, like PM or possibly a noise measuring sensor which we may add in the future, we planned to place somewhere in the open space of our office.

As mentioned before, we wanted to test Bluetooth Mesh technology so we needed some small development boards of some kind with a Bluetooth chip and a processor that we could program to read data from the sensors. We chose ESP32 development boards. With 3 UART ports and a Bluetooth module they seemed perfect for the job. A single board can accommodate more than one sensor, so there is no need to put more of them at the same location.

The second part of the whole system is the backend that aggregates data from sensors and presents them in a convenient way, as a web page available for everyone in the office. The backend offers a simple API to serve the data, which can be used by other systems as well, e.g., mobile apps, other websites and maybe even our internal conference room booking system called Salove.

A quick guide to how we did it

Firmware and hardware

There are few platforms that currently support BLE Mesh. We have picked ESP32 as it has been getting very popular lately and it’s definitely one of the most low-cost and high-performance solutions which might be very appealing to our potential customers. When we started this project BLE Mesh implementation was still a feature under development and we encountered few problems with stability. That occurred mainly during provisioning when the device wasn’t able to finish the last phase and just kept resetting itself.

The graph showing the mesh network of Smart Office systems.

Our mesh network consists of a few nodes with sensors that gather data in our office. Some of these nodes also serve the role of a Mesh Relay or a Mesh Proxy.

There is also a special node called Mesh Gateway. It’s a node that is both connected to the Mesh network as well as to our office ethernet. It can forward all the necessary data from our nodes to the server hosted somewhere in the cloud. We have used the ESP32-POE board as a base for our gateway. Previously we have tried the WiFi and Mesh coexistence on a single board but that turned out to be a little bit unreliable. The great feature that ESP32-POE has is that (as you can see from the name) it can be powered over the ethernet without the need for external power supply.

Backend and Frontend

When it comes to the backend, we were considering the implementation of a simple HTTP server on one of the nodes of the mesh network (perhaps extended with a more powerful board). However, to minimize maintenance issues we finally decided to proceed with a backend located in the cloud using one of the PaaS providers. Since we have a huge experience with AWS Beanstalk and Heroku, we wanted to try something new, which is why we appointed Google App Engine platform. As we’ve recently heard some opinions that the Flask framework is getting more and more mature, reliable and extendable, we thought we could give it a try. Here’s the high-level schematic of the backend and frontend architecture:

The high-level schematic of the backend and frontend architecture.

The dashboard UI is written in React and is really simple—it displays our office map with the sensor locations and recent readings.

The office map with the sensor locations and recent readings.

Did it work?

The simple answer could be: yes. The whole system seems to work fine and has gotten a lot of attention among Polideans so far. We hope that the data that is being collected will be valuable and will possibly help us to make our office space even more pleasant to work in. We have a lot of ideas that will be implemented in the future and make the whole system more functional. Unfortunately, the COVID-19 outbreak stopped our development, but we plan to update this project in the future when we finally get back to our office. Stay tuned!

Damian

Senior Software Engineer

Maciej

Lead Software Engineer

Rafał

Senior Software Engineer

Did you enjoy the read?

If you have any questions, don’t hesitate to ask!