The challenge
The quality of the air we breathe has a direct impact on our health. Poor air quality can cause a variety of health problems, including respiratory infections, headaches, and fatigue. It can also aggravate existing conditions such as asthma and allergies. That’s why it’s so important to monitor the air quality in your office and take steps to improve it if necessary.
Furthermore, the number of people in an office can have a significant impact on air quality. The more people there are, the greater the chance of contaminants being emitted into the air. This is why environmental monitoring is so important in corporate offices; it helps to ensure that the air quality is safe for all workers.
The last few years added to this challenge yet another layer: The COVID-19 pandemic has forced many businesses to re-evaluate their workplace safety protocols. One of the most important considerations is air quality. Poor air quality can lead to a variety of health problems, including respiratory infections.
Environmental monitoring in buildings refers to the security and privacy practices used to protect workers and office buildings from airborne contaminants. This includes collecting data on air quality, temperature, humidity, and other environmental factors. This data is then used to assess the risk of exposure to hazardous materials and take steps to mitigate or eliminate those risks.
Our solution
To address the challenge, we will devise an environmental monitoring system based on sensor nodes that monitor each room and send the collected data to a gateway that can either display it locally or push it toward a cloud solution where further computation can be done. Either at the gateway level or in the cloud, alerts can be set based on certain thresholds considered relevant.
Air quality monitoring
For monitoring the environmental conditions we have chosen the Arduino Nicla Sense ME, which is designed to easily analyze motion and the surrounding environment – hence the “M” and “E” in the name. It measures rotation, acceleration, pressure, humidity, temperature, air quality, and CO2 levels by introducing completely new Bosch Sensortec sensors on the market.
The sensor we are most interested in on the Nicla Sense ME is the BME688, the first gas sensor with artificial intelligence (AI) and integrated high-linearity and high-accuracy pressure, humidity, and temperature sensors. It is housed in a robust yet compact 3.0 x 3.0 x 0.9 mm³ package and specially developed for mobile and connected applications where size and low power consumption are critical requirements. The gas sensor can detect volatile organic compounds (VOCs), volatile sulfur compounds (VSCs), and other gasses such as carbon monoxide and hydrogen in the part per billion (ppb) range.
The full datasheet is available here.
People counting
For monitoring the number of people in each room we have chosen the Arduino Nicla Vision, which combines a powerful STM32H747AII6 dual Arm Cortex-M7/M4 processor with a 2MP color camera that supports tinyML, as well as a smart six-axis motion sensor, integrated microphone, and distance sensor.
One thing that must be addressed when using cameras is privacy concerns and for good reasons! In our case, the cameras are used to execute an edge model to evaluate the number of persons in the view and no actual video stream or pictures are leaving the camera. Only the actual number makes it both safe and efficient.
For this purpose, we have chosen the Edge Impulse platform where we can easily train and deploy a model that will allow us to detect the number of persons in the view of the camera. After the deployment, no further need of internet connectivity is needed for the camera and only the number of persons will be relayed to the gateway.
Both the Nicla Vision and Nicla Sense ME have the same size and PCB format, with the main difference being that one features a camera and the other one an array of sensors. For each, we have created a 3D-printed enclosure to accommodate mounting and fulfilling their primary functions easily.
Edge computing
For the gateway we have chosen the Portenta X8, which is a powerful, industrial-grade SOM with Linux OS preloaded onboard, capable of running device-independent software thanks to its modular container architecture. It features an NXP i.MX 8M Mini Cortex-A53 quad-core, up to 1.8GHz per core + 1x Cortex-M4 up to 400MHz, plus the STMicroelectronics STM32H747 dual-core Cortex-M7 up to 480Mhz and M4 32-bit Arm MCU up to 240MHz.
Since space is not an issue when designing building management issues, we have chosen the Portenta Max Carrier, to host and power the Portenta X8 while enhancing its connectivity options and providing it with easy-to-mount options and power supply plugs. We hosted the devices inside an easy to mount on a wall enclosure according to the overall size of the hardware.
The Portenta X8 can gather via BLE the data from quite a few sensor nodes as long as they are in range and not blocked by heavy walls or structures in between and either store the data locally for displaying it via the local server stack or relay it further to the cloud.
IoT Cloud solution
Although the Portenta X8 board is capable of storing data locally, there may be times when it is also desirable to send data to the cloud. This can be accomplished by forwarding data from the InfluxDB database on the Portenta X8 board to the Arduino IoT Cloud via MQTT. The arduino-iot-js NPM module makes it easy to set up this connection, and the steps to do so are not covered in this tutorial. For illustrative purposes, however, the diagram below offers a brief overview of our proposed architecture for one potential deployment scenario in a building with multiple rooms.
Solving it with Arduino Pro
Now let’s explore how we could put all of this together and what we would need for deployment both in terms of hardware and software stack. The Arduino Pro ecosystem is the latest generation of Arduino solutions bringing users the simplicity of integration and scalable, secure, professionally supported services.
Hardware requirements
- Arduino Nicla Vision
- Arduino Nicla Sense Me
- Arduino Portenta X8
- Enclosures
Software requirements
- Arduino IDE
- OpenMV IDE
- Edge Impulse account
The Nicla Vision has been programmed in Python since the Edge Impulse model was created/tested using the OpenMV IDE and thus we have also sent the data over BLE using the Python library.
The Nicla Sense ME has been programmed in C/C++ using the Arduino IDE since reading the sensors and sending their data over the BLE can be done faster via the C/C++ programming language since the code is already compiled and we do not need any heavy computing like when dealing with video on the Nicla Vision.
The Portenta X8 with its Linux OS preloaded onboard is fully capable of running Docker and thus containers with a vast array of functionalities. In our case, we found it most useful to use a time series database to store the data and display it locally. There is a pre-built container including InfluxDB, Grafana, and Node-Red that can be easily deployed to achieve this task.
Here is a screenshot from a dashboard created directly in InfluxDB showcasing data received from the sensor nodes:
The dashboard can be visualized by accessing the InfluxDB interface on the Portenta X8 IP on port 8086 in a browser on another computer connected to the same WiFi network (for example, http://192.168.1.199:8086/).
Here is an overview of the software stack and how a minimum deployment with one of each hardware module communicates to fulfill the proposed solution:
Conclusion
Environmental monitoring is essential for corporate offices in order to ensure the safety and health of workers. The correlation between the number of people in an office and air quality means that more people can lead to more contaminants in the air. Additionally, data latency can be a challenge when it comes to environmental monitoring. This is why it is important to have systems in place that can collect data quickly and efficiently and make this data available to decision-makers in a timely manner.
There are many benefits to using this solution. First, it enables building managers to monitor the environmental conditions in each room and take steps to mitigate any risks. Second, it provides a system for collecting data on occupancy, air quality, temperature, humidity, and other environmental factors. This data can be used to assess the risk of exposure to hazardous materials and take steps to mitigate or eliminate those risks. Finally, our solution is easy to use and can be installed in any office building.
Website: LINK