Skip to content

Commit 4fcf68f

Browse files
committed
Content update (remove PM)
1 parent 97a7a1a commit 4fcf68f

File tree

1 file changed

+40
-83
lines changed
  • content/hardware/06.nicla/boards/nicla-sense-env/tutorials/environmental-monitor-application-note

1 file changed

+40
-83
lines changed

content/hardware/06.nicla/boards/nicla-sense-env/tutorials/environmental-monitor-application-note/content.md

Lines changed: 40 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -91,23 +91,18 @@ The complete example sketch is shown below.
9191

9292
```arduino
9393
/**
94-
Outdoor Air Quality Monitoring with Arduin
94+
Outdoor Air Quality Monitoring with Arduino
9595
Name: outdoor_air_quality_monitor.ino
96-
Purpose: This sketch reads temperature, humidity, outdoor air quality,
97-
and particulate matter (PM 2.5 and PM 10) from the Nicla Sense Env
98-
and a PMS7003 sensor from Plantower connected to the Portenta C33 board.
99-
The data is reported Arduino IDE's Serial Monitor every 10 seconds.
96+
Purpose: This sketch reads temperature, humidity, and outdoor air quality
97+
from the Nicla Sense Env connected to the Portenta C33 board.
98+
The data is reported to the Arduino IDE's Serial Monitor every 10 seconds.
10099
101100
@version 1.0 01/09/24
102101
@author Arduino Product Experience Team
103102
*/
104103
105-
// Include the necessary libraries for Nicla Sense Env and PMS7003 sensors
104+
// Include the necessary libraries for Nicla Sense Env sensors
106105
#include "Arduino_NiclaSenseEnv.h"
107-
#include "PMS.h"
108-
109-
// PMS sensor object for particle matter measurements
110-
PMS pms(Serial);
111106
112107
// Time interval (in milliseconds) for sensor readings of 10 seconds
113108
static const uint32_t READ_INTERVAL = 10000;
@@ -145,10 +140,6 @@ void setup() {
145140
// Error message if the Nicla Sense Env is not found
146141
Serial.println("- ERROR: Nicla Sense Env device not found!");
147142
}
148-
149-
// Initialize PMS7003 sensor in passive mode
150-
pms.passiveMode();
151-
pms.wakeUp();
152143
}
153144
154145
/**
@@ -170,42 +161,30 @@ void loop() {
170161
}
171162
172163
/**
173-
Displays temperature, humidity, air quality, and particulate matter data.
174-
Reads data from the Nicla Sense Env and PMS7003 sensors and prints it in a single line format.
164+
Displays temperature, humidity, and air quality data.
165+
Reads data from the Nicla Sense Env and prints it in a single line format.
175166
*/
176167
void displayAllData() {
177168
// Check if both temperature/humidity and air quality sensors are enabled
178169
if (tempHumSensor->enabled() && airQualitySensor->enabled()) {
179170
// Read data from the Nicla Sense Env sensors
180171
float temperature = tempHumSensor->temperature();
181172
float humidity = tempHumSensor->humidity();
182-
int airQualityIndex = airQualitySensor->airQualityIndex();
183173
float NO2 = airQualitySensor->NO2();
184174
float O3 = airQualitySensor->O3();
175+
int airQualityIndex = airQualitySensor->airQualityIndex();
185176
186-
// Read data from the PMS7003 sensor
187-
PMS::DATA data;
188-
pms.requestRead();
189-
if (pms.readUntil(data)) {
190-
// Print all sensor data in a single line, separated by commas
191-
Serial.print("- Temperature: ");
192-
Serial.print(temperature, 2);
193-
Serial.print(" °C, Humidity: ");
194-
Serial.print(humidity, 2);
195-
Serial.print(" %, Air Quality Index: ");
196-
Serial.print(airQualityIndex);
197-
Serial.print(", NO2: ");
198-
Serial.print(NO2, 2);
199-
Serial.print(" ppb, O3: ");
200-
Serial.print(O3, 2);
201-
Serial.print(" ppb, PM 2.5: ");
202-
Serial.print(data.PM_AE_UG_2_5);
203-
Serial.print(" µg/m³, PM 10: ");
204-
Serial.println(data.PM_AE_UG_10_0);
205-
} else {
206-
// Error message if PMS7003 data is not available
207-
Serial.println("- ERROR: No data from PMS sensor!");
208-
}
177+
// Print all sensor data in a single line, with AQI at the end
178+
Serial.print("- Temperature: ");
179+
Serial.print(temperature, 2);
180+
Serial.print(" °C, Humidity: ");
181+
Serial.print(humidity, 2);
182+
Serial.print(" %, NO2: ");
183+
Serial.print(NO2, 2);
184+
Serial.print(" ppb, O3: ");
185+
Serial.print(O3, 2);
186+
Serial.print(" ppb, Air Quality Index: ");
187+
Serial.println(airQualityIndex);
209188
} else {
210189
// Error message if one or more sensors are disabled
211190
Serial.println("- ERROR: One or more sensors are disabled!");
@@ -222,15 +201,11 @@ The following sections will help you to understand the main parts of the example
222201

223202
### Library Imports
224203

225-
The first step is to ensure that all necessary libraries are included to control the Nicla Sense Env board and the PMS7003 sensor. These libraries provide all the functionality to communicate with and extract sensor data.
204+
The first step is to ensure that all necessary libraries are included to control the Nicla Sense Env board. These libraries provide all the functionality to communicate with and extract sensor data.
226205

227206
```arduino
228-
// Include the necessary libraries for Nicla Sense Env and PMS7003 sensors
207+
// Include the necessary libraries for Nicla Sense Env sensors
229208
#include "Arduino_NiclaSenseEnv.h"
230-
#include "PMS.h"
231-
232-
// PMS sensor object for particle matter measurements
233-
PMS pms(Serial);
234209
235210
// Time interval (in milliseconds) for sensor readings of 10 seconds
236211
static const uint32_t READ_INTERVAL = 10000;
@@ -242,7 +217,7 @@ TemperatureHumiditySensor* tempHumSensor;
242217
OutdoorAirQualitySensor* airQualitySensor;
243218
```
244219

245-
The Nicla Sense Env library handles data such as temperature, humidity, and outdoor air quality, while the PMS7003 library enables the measurement of airborne particulate matter.
220+
The Nicla Sense Env library handles data such as temperature, humidity, and outdoor air quality, including also the NO2 and O3 gas concentrations.
246221

247222
### Sensors Initialization
248223

@@ -270,18 +245,13 @@ void setup() {
270245
// Error message if the Nicla Sense Env is not found
271246
Serial.println("- ERROR: Nicla Sense Env device not found!");
272247
}
273-
274-
// Initialize PMS7003 sensor in passive mode
275-
pms.passiveMode();
276-
pms.wakeUp();
277248
}
278249
```
279250

280251
In the code snippet shown before:
281252

282253
- Serial communication is initialized to allow data transmission.
283-
- The Nicla Sense Env board is initialized to read temperature, humidity, and outdoor air quality.
284-
- The PMS7003 sensor is configured in passive mode, which means it will only take readings when specifically requested.
254+
- The Nicla Sense Env board is initialized to read temperature, humidity and the outdoor air quality index (AQI).
285255

286256
### Data Collection
287257

@@ -318,33 +288,21 @@ void displayAllData() {
318288
// Read data from the Nicla Sense Env sensors
319289
float temperature = tempHumSensor->temperature();
320290
float humidity = tempHumSensor->humidity();
321-
int airQualityIndex = airQualitySensor->airQualityIndex();
322291
float NO2 = airQualitySensor->NO2();
323292
float O3 = airQualitySensor->O3();
293+
int airQualityIndex = airQualitySensor->airQualityIndex();
324294
325-
// Read data from the PMS7003 sensor
326-
PMS::DATA data;
327-
pms.requestRead();
328-
if (pms.readUntil(data)) {
329-
// Print all sensor data in a single line, separated by commas
330-
Serial.print("- Temperature: ");
331-
Serial.print(temperature, 2);
332-
Serial.print(" °C, Humidity: ");
333-
Serial.print(humidity, 2);
334-
Serial.print(" %, Air Quality Index: ");
335-
Serial.print(airQualityIndex);
336-
Serial.print(", NO2: ");
337-
Serial.print(NO2, 2);
338-
Serial.print(" ppb, O3: ");
339-
Serial.print(O3, 2);
340-
Serial.print(" ppb, PM 2.5: ");
341-
Serial.print(data.PM_AE_UG_2_5);
342-
Serial.print(" µg/m³, PM 10: ");
343-
Serial.println(data.PM_AE_UG_10_0);
344-
} else {
345-
// Error message if PMS7003 data is not available
346-
Serial.println("- ERROR: No data from PMS sensor!");
347-
}
295+
// Print all sensor data in a single line, with AQI at the end
296+
Serial.print("- Temperature: ");
297+
Serial.print(temperature, 2);
298+
Serial.print(" °C, Humidity: ");
299+
Serial.print(humidity, 2);
300+
Serial.print(" %, NO2: ");
301+
Serial.print(NO2, 2);
302+
Serial.print(" ppb, O3: ");
303+
Serial.print(O3, 2);
304+
Serial.print(" ppb, Air Quality Index: ");
305+
Serial.println(airQualityIndex);
348306
} else {
349307
// Error message if one or more sensors are disabled
350308
Serial.println("- ERROR: One or more sensors are disabled!");
@@ -355,23 +313,22 @@ void displayAllData() {
355313
In the code snippet shown before:
356314

357315
- The function first checks that the temperature/humidity sensor and the air quality sensor are enabled.
358-
- The function retrieves temperature, humidity, air quality index, and gas concentrations (NO2 and O3) from the Nicla Sense Env board.
359-
- The function also fetches PM2.5 and PM10 particulate readings from the PMS7003 sensor.
360-
- Finally, the data is printed in a single line on the IDE's Serial Monitor.
316+
- The function retrieves temperature, humidity, gas concentrations (NO2 and O3), and the air quality index (AQI) from the Nicla Sense Env board.
317+
- Finally, the data is printed in a single line on the IDE's Serial Monitor, with the AQI displayed at the end.
361318

362319
### Complete Example Sketch
363320

364321
The complete example sketch can be downloaded here.
365322

366323
## Conclusions
367324

368-
The development of this outdoor air quality monitor demonstrates the effectiveness of using affordable and accessible sensors to measure key environmental parameters in real-time. Integrating the Nicla Sense Env and the PMS7003 sensor with the Portenta C33 allows the system to track temperature, humidity, airborne particulate matter (PM2.5 and PM10), NO2, and O3 levels. The ability to monitor these pollutants, combined with the outdoor AQI, provides valuable insights for understanding air quality in urban and rural areas. Furthermore, the system's connection to the Arduino Cloud allows for remote monitoring and analysis, making it versatile for various applications, from personal use to environmental research.
325+
The development of this outdoor air quality monitor demonstrates the effectiveness of using affordable and accessible sensors to measure key environmental parameters in real-time. Integrating the Nicla Sense Env with the Portenta C33 allows the system to track temperature, humidity, NO2, and O3 levels. The ability to monitor these pollutants, combined with the outdoor AQI, provides valuable insights for understanding air quality in urban and rural areas. Furthermore, the system's connection to the Arduino Cloud allows for remote monitoring and analysis, making it versatile for various applications, from personal use to environmental research.
369326

370327
## Next Steps
371328

372-
Several improvements can be considered to extend the functionality of the environmental monitor:
329+
Several improvements can be considered to extend the functionality of the outdoor air quality monitor:
373330

374-
- Add sensors to measure pollutants such as carbon monoxide (CO) or sulfur dioxide (SO2).
331+
- Add more sensors to the monitor to measure pollutants such as carbon monoxide (CO) or sulfur dioxide (SO2).
375332
- Improve the monitor's energy efficiency for long-term deployment in remote or outdoor environments.
376333
- Build a custom dashboard on Arduino Cloud to visualize trends over time and allow for more detailed analysis of air quality data.
377334
- Implement an alert system that notifies users when pollutant levels exceed safe thresholds.

0 commit comments

Comments
 (0)