You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/hardware/06.nicla/boards/nicla-sense-env/tutorials/03.elevator-monitoring-application-note/content.md
+53-45Lines changed: 53 additions & 45 deletions
Original file line number
Diff line number
Diff line change
@@ -22,22 +22,22 @@ software:
22
22
23
23
## Introduction
24
24
25
-
Air pollution is a threat that lurks even where we least expect it, from the comfort of our homes to our workplaces. Pollutants like CO₂ and volatile organic compounds (TVOC) silently threaten our health, representing a determining factor for our quality of life.
25
+
Air pollution is an often overlooked threat that exists even in the places we feel safest, from our homes to our workplaces. Pollutants like CO₂ and volatile organic compounds (TVOC) silently threaten our health, representing a determining factor for our quality of life.
26
26
27
-
This application note describes the building of an air quality monitor and occupancy machine vision tracker for indoor environments, in this case an elevator.
27
+
This application note describes building an air quality monitor and occupancy tracking system using machine vision for indoor environments designed for use in an elevator.
28
28
29
29

30
30
31
-
The monitoring system will measure the elevator's temperature, relative humidity, indoor air quality (IAQ), estimated CO₂ and total volatile organic compounds (TVOC) while counting the people inside the elevator. All this information will be forwarded to the Arduino Cloud for further visualization and tracking. The system will give a real-time visual feedback of the condition inside the elevator to warn people of harmful air quality.
31
+
The monitoring system will measure the elevator's temperature, relative humidity, indoor air quality (IAQ), estimated CO₂ and total volatile organic compounds (TVOC) while counting the people inside the elevator. All this information will be forwarded to the Arduino Cloud for further visualization and ongoing monitoring. The system will provide real-time visual feedback of the condition inside the elevator to warn people of harmful air quality.
32
32
33
33
## Goals
34
34
35
35
The project showcased in this application note has the following objectives:
36
36
37
-
-Monitoring the air quality and environmental variables inside the elevator.
38
-
-Counting the people inside the elevator using Machine Vision.
39
-
-Giving real-time visual feedback of the conditions of the elevator using Modulino® Pixels:.
40
-
-Sharing all the gathered data to the Arduino Cloud for remote monitoring.
37
+
-Monitor the air quality and environmental conditions within the elevator.
38
+
-Count people inside the elevator using Machine Vision.
39
+
-Provide real-time visual feedback on the elevator conditions using Modulino® Pixels.
40
+
-Share all collected data to the Arduino Cloud for remote monitoring.
41
41
42
42
## Hardware and Software Requirements
43
43
@@ -66,6 +66,15 @@ This project is meant to be developed with the **Portenta Proto Kit** that inclu
66
66
-[Arduino Portenta Boards core](https://github.com/arduino/ArduinoCore-mbed) (required to work with the Portenta H7 board)
67
67
-[Arduino Cloud](https://create.arduino.cc/iot/things). If you do not have an account, create one for free [here](https://cloud.arduino.cc/).
68
68
69
+
### Complete Project Sketch
70
+
71
+

72
+
73
+
The complete project sketches can be downloaded here:
The electrical connections for the project are outlined in the diagram below:
@@ -75,71 +84,70 @@ The electrical connections for the project are outlined in the diagram below:
75
84
This diagram shows how the components are connected.
76
85
77
86
- The Portenta H7 is attached to the Portenta Mid Carrier using the High-Density connectors.
78
-
- The Mid Carrier Proto Shield is stacked to the Portenta Mid Carrier using the breakout connectors.
79
-
- The Modulino Pixels is wired to the Portenta Mid Carrier using the Qwiic cable and fixed with the included screws and nuts.
80
-
- The Nicla Vision and the Nicla Sense Env are wired to the Mid Carrier Proto Shield using ESLOV cables.
87
+
- The Mid Carrier Proto Shield is stacked onto the Portenta Mid Carrier via breakout connectors.
88
+
- The Modulino Pixels is wired to the Portenta Mid Carrier using the Qwiic cable and secured with the included screws and nuts.
89
+
- The Nicla Vision and the Nicla Sense Env are connected to the Mid Carrier Proto Shield using ESLOV cables.
81
90
82
91
### Powering Options
83
92
84
-
To power the project you can use the terminal block of the Portenta Mid Carrier, the USB-C connector of the Portenta H7 or the barrel jack of the Mid Carrier Proto Shield.
93
+
The project can be powered using the terminal block on the Portenta Mid Carrier, the USB-C connector on the Portenta H7 or the barrel jack on the Mid Carrier Proto Shield.
85
94
86
95

87
96
88
97
## Smart Elevator Monitoring System Overview
89
98
90
-
The elevator monitoring system integrates sensor data gathering, machine vision, live user feedback and cloud communication using the Portenta H7 Wi-Fi® connection.
99
+
The elevator monitoring system integrates sensor data collection, machine vision, live user feedback and cloud connectivity via the Portenta H7’s Wi-Fi® connection.
91
100
92
-
The **Portenta H7** is responsible for the Nicla Sense Env sensors reading, receiving people count from the Nicla Vision through I2C, showing air quality status on the Modulino Pixels and communicating with the Cloud.
101
+
The **Portenta H7** is responsible for the Nicla Sense Env sensor readings, receiving occupant counts from the Nicla Vision through I2C, showing air quality status on the Modulino Pixels and communicating with the Cloud.
93
102
94
-
The **Nicla Vision** is the project's second SoM and is dedicated exclusively to detecting faces in the elevator, counting them and reporting the number to the Portenta H7.
103
+
The **Nicla Vision** is the project's second system-on-module (SoM) dedicated exclusively to detecting faces in the elevator, counting them and reporting the count to the Portenta H7.
95
104
96
-
The **Nicla Sense Env** is a sensor shield that must be controlled by a host, in this case the Portenta H7, that includes several environment sensors.
105
+
The **Nicla Sense Env** is a sensor shield that must be controlled by a host, in this case by the Portenta H7, and houses several environment sensors.
97
106
98
107
### Indoor Air Quality Sensor
99
108
100
-
One of the project's main features is the environment variables sensing, this is possible using the **ZMOD4410** indoor air quality sensor featured by the **Nicla Sense Env**.
109
+
A key feature of this projectis monitoring environmental variables, which is made possible by the **ZMOD4410** indoor air quality sensor featured within the **Nicla Sense Env**.
101
110
102
-
The ZMOD4410 is a gas sensor module designed for easy implementation to detect total volatile organic compounds (TVOC), estimate CO₂ and monitor indoor air quality (IAQ).
111
+
The **ZMOD4410** is a gas sensor module designed to detect total volatile organic compounds (TVOC), estimate CO₂ and monitor indoor air quality (IAQ) with ease of implementation.
103
112
104
-
The sensor can output air quality in the following three ways:
113
+
The sensor can provide air quality data in three ways:
105
114
106
115
-**Renesas IAQ Rating**: 0 - 5 (being 0 the cleaner and healthier air)
107
-
-**Interpreted Air Quality**: in words, "Very Good", "Good", "Medium", "Poor" and "Bad"
116
+
-**Interpreted Air Quality**: Qualitative ratings, as "Very Good", "Good", "Medium", "Poor" and "Bad"
108
117
-**Relative Air Quality**: 0 - 500 (being 0 the cleaner and healthier air)
109
118
110
-
We are going to use the **Relative Air Quality**range because it will give us a more accurate and sensitive range to measure variations in the air quality, use the following table for reference:
119
+
For this project, we will use the **Relative Air Quality**scale, as it offers an accurate and sensitive range to measure variations in air quality. Refer to the table below for reference:
111
120
112
121

113
122
114
-
To complement the environment monitoring we are going to use also the **HS4001** temperature and humidity sensor of the Nicla Sense Env.
123
+
To complement the environment monitoring, we will also use the **HS4001** temperature and humidity sensor of the Nicla Sense Env.
115
124
116
125
### Visual Air Quality Feedback
117
126
118
-
The system features a real-time visual feedback to warn the occupants of the elevator so they know the current air quality status in any time and take the right preventive measures.
127
+
The system features real-time visual feedback to warn the occupants of the elevator so they know the current air quality status at any time and take the right preventive measures.
119
128
120
-
Using the Modulino Pixels the system will display the colors corresponding to the Air Quality Index shown in the table from above.
129
+
Using the Modulino Pixels, the system will display the colors corresponding to the Air Quality Index levels shown in the table above.
The Nicla Vision will use a built-in FOMO model for face detection, with a very simple python script it will be able to report through I2C the faces count on a single frame covering the whole elevator.
127
-
135
+
The Nicla Vision will use a built-in FOMO (Faster Objects, More Objects) model for face detection. With a simple Python script, it can report the face count within a single frame covering the entire elevator via I2C.
128
136

129
137
130
138
### Portenta H7 Code
131
139
132
140
Let's go through some important code sections to make this application fully operational, starting with the required libraries:
133
141
134
-
-`Arduino_NiclaSenseEnv.h`includes the support for the Nicla Sense Env sensor data gathering.
135
-
-`Wire.h` enables the I2C communication for the Nicla Sense Env and Nicla Vision boards.
136
-
-`modulino.h`includes the support for the Modulino Pixels.
142
+
-`Arduino_NiclaSenseEnv.h`provides support for collecting data from the Nicla Sense Env sensor.
143
+
-`Wire.h` enables I2C communication with the Nicla Sense Env and Nicla Vision boards.
144
+
-`modulino.h`provides support for controlling the Modulino Pixels.
137
145
138
146
There is a header included in the project code for the Arduino Cloud configuration:
139
147
140
148
-`thingProperties.h` includes the Wi-Fi® credentials and Arduino Cloud configuration.
141
149
142
-
This header includes other two libraries necessary for the cloud communication which are:
150
+
This header includes two other libraries necessary for cloud communication, which are:
143
151
144
152
-`ArduinoIoTCloud.h` enables Arduino Cloud integration. Search for *ArduinoIoTCloud* in the Library Manager to install it.
145
153
-`Arduino_ConnectionHandler.h` manages the board's internet connectivity. Search for *Arduino_ConnectionHandler* in the Library Manager to install it.
@@ -244,7 +252,7 @@ void loop() {
244
252
}
245
253
```
246
254
247
-
One of the main functions in the `loop()` is the `readSensors()` one, here we use the Nicla Sense Env API to read the following variables:
255
+
One of the main functions in the `loop()` is `readSensors()`, which uses the Nicla Sense Env API to read the following variables:
248
256
249
257
- Temperature (°C)
250
258
- Relative Humidity (%)
@@ -255,17 +263,17 @@ One of the main functions in the `loop()` is the `readSensors()` one, here we us
255
263
256
264
We also control the Modulino Pixels color based on the IAQ and update the cloud variables.
257
265
258
-
The `getPeopleCount()` function creates an I2C request asking for the people detected by the Nicla Vision.
266
+
The `getPeopleCount()` function creates an I2C request asking for the count of people detected by the Nicla Vision.
259
267
260
268
***You can download the complete example code for the Portenta H7 [here](assets/Smart_elevator_Portenta_h7.zip)***
261
269
262
270
### Nicla Vision Code
263
271
264
272
The people counting feature of the project is achieved by the Nicla Vision running a FOMO face detection model.
265
273
266
-
For this feature we are using the [OpenMV IDE](https://openmv.io/pages/download) for running MicroPython sketches that you can download from [here](https://openmv.io/pages/download).
274
+
For this feature, we are using the [OpenMV IDE](https://openmv.io/pages/download) for running MicroPython sketches that you can download from [here](https://openmv.io/pages/download).
267
275
268
-
Let's explain a bit how the code works starting from the main loop of the sketch:
276
+
Here’s a brief overview of how the code works, starting with the main loop of the script:
269
277
270
278
```python
271
279
if__name__=="__main__":
@@ -290,19 +298,19 @@ if __name__ == "__main__":
290
298
now = ticks_ms()
291
299
```
292
300
293
-
In simple words, we are on an infinite loop taking pictures with the `sensor.snapshot()` function which are then used as inputs for the face detection model using the `analyze_image()` function.
301
+
In simple words, we are on an infinite loop taking pictures with the `sensor.snapshot()` function, which is then used as inputs for the face detection model using the `analyze_image()` function.
294
302
295
-
If faces are detected, the onboard green LED will light up and the count will be sent by I2C to the Portenta H7.
303
+
If faces are detected, the onboard green LED will light up and the count will be sent via I2C to the Portenta H7.
296
304
297
-
In the face detection process, some auxiliary functions are used to filter unwanted results including false positives. A brief explanation of these functions are listed below:
305
+
During the face detection process, several auxiliary functions filter unwanted results, including false positives. A brief explanation of these functions is listed below:
298
306
299
307
-`calculate_distance()`: it returns the distance between two rectangles bounding a possible face to avoid duplicates.
300
-
-`merge_rectangles()` and `merge_close_rectangles()`: if two or more bounding rectangles are too close they will be merged into one.
308
+
-`merge_rectangles()` and `merge_close_rectangles()`: Merges two or more close bounding rectangles into a single one if they are in proximity.
301
309
-`fomo_post_process()`: it returns the list of bounding boxes to be analyzed by the previously explained functions.
302
310
303
311
***You can download the complete example code for the Nicla Vision [here](assets/People_Count_Nicla_Vision.zip)***
304
312
305
-
If you want to test the Nicla Vision example code **standalone** you must comment out the `i2c.send(buf)` line of the sketch, this is because it will show an error if it couldn't find the Portenta H7 on the I2C bus.
313
+
If you want to test the Nicla Vision example code **standalone**, you must comment out the `i2c.send(buf)` line in the sketch, this is because it will show an error if it can't find the Portenta H7 on the I2C bus.
306
314
307
315
***For the Nicla Vision to run the sketch once is powered up you must put the code inside the `main.py` file in the file system.***
308
316
@@ -316,8 +324,8 @@ Within the Arduino Cloud's dashboard, the system variables can be monitored with
316
324
317
325
- System variable gauge showing relative humidity.
318
326
- Numeric state widgets to show IAQ, temperature, CO₂, ethanol and TVOC readings.
319
-
- Advanced charts showing historical record of CO₂, ethanol, temperature and humidity.
320
-
-People occupancy historical chart and current state.
327
+
- Advanced charts showing historical CO₂, ethanol, temperature and humidity records.
328
+
-A people occupancy chart displaying both historical data and the current count.
321
329
322
330
### Complete Project Sketch
323
331
@@ -330,16 +338,16 @@ The complete project sketches can be downloaded here:
330
338
331
339
## Conclusions
332
340
333
-
In this application note, we have learned how to implement an indoor air quality and occupancy monitoring system by turning a conventional elevator into a smart and monitored one.
341
+
In this application note, we have learned how to implement an indoor air quality and occupancy monitoring system by transforming a conventional elevator into a smart, monitored space.
334
342
335
-
This application shows how Arduino's environment simplifies the workflow for developing smart solutions to address real industrial needs. The Arduino PRO product line is a perfect fit for developing robust and reliable projects for the industry. We covered on-site sensor data sampling, Machine Vision, and real-time Cloud monitoring.
343
+
This application shows how Arduino's ecosystem simplifies the workflow for developing smart solutions to address real industrial needs. The Arduino PRO product line is a perfect fit for developing robust and reliable projects for the industry. We covered on-site sensor data sampling, machine vision, and real-time Cloud monitoring.
336
344
337
345
## Next Steps
338
346
339
347
Now that you know how to develop an indoor air quality and people counting system with the Portenta Proto Kit, it is time to continue exploring all the capabilities of the Arduino Pro environment. Integrate it with your professional setup and enhance it with powerful solutions.
340
348
341
349
You can take this solution even further by:
342
350
343
-
- Creating your own FOMO model using Edge Impulse to specifically detect persons instead of just faces.
344
-
- Adding the Modulino Buzzer to create a warning sound if the number of people in the elevator is exceeding the limit or the air quality is too bad.
345
-
- Integrating the Arduino 4G Module for deployments without Wi-Fi or Ethernet.
351
+
- Creating your own FOMO model using Edge Impulse to detect people particularly, rather than just faces.
352
+
- Adding a Modulino Buzzer to provide an alert if the elevator occupancy exceeds the limit or if air quality deteriorates.
353
+
- Integrating the Arduino 4G Module for deployments without Wi-Fi or Ethernet connectivity.
0 commit comments