Skip to content

Commit b27cf95

Browse files
committed
Taddy review added
1 parent 6b9060b commit b27cf95

File tree

1 file changed

+53
-45
lines changed
  • content/hardware/06.nicla/boards/nicla-sense-env/tutorials/03.elevator-monitoring-application-note

1 file changed

+53
-45
lines changed

content/hardware/06.nicla/boards/nicla-sense-env/tutorials/03.elevator-monitoring-application-note/content.md

Lines changed: 53 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,22 @@ software:
2222

2323
## Introduction
2424

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.
2626

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.
2828

2929
![ ](assets/thumb2.gif)
3030

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.
3232

3333
## Goals
3434

3535
The project showcased in this application note has the following objectives:
3636

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.
4141

4242
## Hardware and Software Requirements
4343

@@ -66,6 +66,15 @@ This project is meant to be developed with the **Portenta Proto Kit** that inclu
6666
- [Arduino Portenta Boards core](https://github.com/arduino/ArduinoCore-mbed) (required to work with the Portenta H7 board)
6767
- [Arduino Cloud](https://create.arduino.cc/iot/things). If you do not have an account, create one for free [here](https://cloud.arduino.cc/).
6868

69+
### Complete Project Sketch
70+
71+
![Project sketches](assets/ide.png)
72+
73+
The complete project sketches can be downloaded here:
74+
75+
- [Portenta H7 code](assets/Smart_elevator_Portenta_h7.zip)
76+
- [Nicla Vision code](assets/People_Count_Nicla_Vision.zip)
77+
6978
## Smart Elevator Monitoring System Setup
7079

7180
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:
7584
This diagram shows how the components are connected.
7685

7786
- 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.
8190

8291
### Powering Options
8392

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.
8594

8695
![Powering options](assets/power-options.png)
8796

8897
## Smart Elevator Monitoring System Overview
8998

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.
91100

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.
93102

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.
95104

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.
97106

98107
### Indoor Air Quality Sensor
99108

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 project is monitoring environmental variables, which is made possible by the **ZMOD4410** indoor air quality sensor featured within the **Nicla Sense Env**.
101110

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.
103112

104-
The sensor can output air quality in the following three ways:
113+
The sensor can provide air quality data in three ways:
105114

106115
- **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"
108117
- **Relative Air Quality**: 0 - 500 (being 0 the cleaner and healthier air)
109118

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:
111120

112121
![Relative Air Quality table](assets/AQI.png)
113122

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.
115124

116125
### Visual Air Quality Feedback
117126

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.
119128

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.
121130

122131
![Modulino Pixels feedback system](assets/led-feedback.gif)
123132

124133
### Machine Vision for People Counting
125134

126-
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.
128136
![Nicla Vision people counting](assets/nicla-count.png)
129137

130138
### Portenta H7 Code
131139

132140
Let's go through some important code sections to make this application fully operational, starting with the required libraries:
133141

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.
137145

138146
There is a header included in the project code for the Arduino Cloud configuration:
139147

140148
- `thingProperties.h` includes the Wi-Fi® credentials and Arduino Cloud configuration.
141149

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:
143151

144152
- `ArduinoIoTCloud.h` enables Arduino Cloud integration. Search for *ArduinoIoTCloud* in the Library Manager to install it.
145153
- `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() {
244252
}
245253
```
246254

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:
248256

249257
- Temperature (°C)
250258
- Relative Humidity (%)
@@ -255,17 +263,17 @@ One of the main functions in the `loop()` is the `readSensors()` one, here we us
255263

256264
We also control the Modulino Pixels color based on the IAQ and update the cloud variables.
257265

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.
259267

260268
***You can download the complete example code for the Portenta H7 [here](assets/Smart_elevator_Portenta_h7.zip)***
261269

262270
### Nicla Vision Code
263271

264272
The people counting feature of the project is achieved by the Nicla Vision running a FOMO face detection model.
265273

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).
267275

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:
269277

270278
```python
271279
if __name__ == "__main__":
@@ -290,19 +298,19 @@ if __name__ == "__main__":
290298
now = ticks_ms()
291299
```
292300

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.
294302

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.
296304

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:
298306

299307
- `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.
301309
- `fomo_post_process()`: it returns the list of bounding boxes to be analyzed by the previously explained functions.
302310

303311
***You can download the complete example code for the Nicla Vision [here](assets/People_Count_Nicla_Vision.zip)***
304312

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.
306314

307315
***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.***
308316

@@ -316,8 +324,8 @@ Within the Arduino Cloud's dashboard, the system variables can be monitored with
316324

317325
- System variable gauge showing relative humidity.
318326
- 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.
321329

322330
### Complete Project Sketch
323331

@@ -330,16 +338,16 @@ The complete project sketches can be downloaded here:
330338

331339
## Conclusions
332340

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.
334342

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.
336344

337345
## Next Steps
338346

339347
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.
340348

341349
You can take this solution even further by:
342350

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

Comments
 (0)