Introduction
As the most basic part of life, air is attracting more and more attention, and the related topics like haze and PM2.5 brings hot discussions in recent years. Keeping an eye on the quality of the air we breathe is becoming quite important. This time, DFRobot introduces this multifunction air quality monitor that can detect not only the concentration of PM10, PM2.5 and PM1.0 but also the environmental temperature and humidity in real time, and then output the data via UART port. It works well with devices like Arduino and STM32.
As the particle (PM10, PM2.5 & PM1.0) concentration sensor it can use laser scattering to continuously collect and calculate the number of multi-sized suspended particles per unit of air volume, i.e. particle concentration distribution, and then convert to mass concentration. Also, it embeds in it a one-chip sensor for accurate temperature and humidity measurements.
This monitor can be inserted into various instruments related to air quality detection or environmental improvement to provide correct environmental parameters in time.
Specification
- Operating Voltage: 5.0VDC
- Maximum Operating Current: 100 mA
- Standby Current: ≤200 uA
- Data Interface Level: L<0.8V, H>2.7V, Max 3.3V
- Particle Range of Measurement: 0.3~1.0μm; 1.0~2.5μm; 2.5~10μm
- Particle Counting Efficiency: 50%@0.3μm 98%@>=0.5μm
- Particle Effective Range (PM2.5 standard): 0~500μg/m³
- Particle Maximum Range (PM2.5 standard): 0~2000ug/m³
- Particle Resolution: 1ug/m³
- Particle Maximum Consistency Error (PM2.5 standard data):
- ±10%@100~500μg/m³
- ±10μg/m³@0~100μg/m³
- Standard Volume: 0.1 L
- Temperature Measuring Range: 0~99 ℃
- Temperature Measuring Resolution: 0.1 ℃
- Temperature Measuring Accuracy: ±0.5 ℃
- Humidity Measuring Range: 0~99%
- Humidity Measuring Resolution: 0.1%
- Humidity Measuring Accuracy: ±2%
- Single Response Time: ≤1s
- Total Response Time: ≤10s
- Serial Baud Rate: 9600bps
- Operating Temperature Range: -10~+50℃
- Storage Temperature Range: -40~+80℃
- Operating Humidity Range: 0~99%
- MTTF: ≥ 3 years
- Dimensions: 50x38x21mm/1.97x1.50x0.83"
Installation Precautions
- 1.The metal shell is connected to the internal power ground. Please note that don’t short-circuit it with other external board circuit or chassis shell.
- 2.The best installation method is to tight connect the plane of air inlet and outlet with the user machine's inner wall (where there are holes for airflow). If this method is impossible to use, make sure there is no obstacles within 2cm of the air outlet, and there should be a structure between the air inlet and the outlet to avoid airflow inside the user machine from the outlet back to the inlet.
- 3.The vent for air inlet on the user machine’s inner wall should not be smaller than air inlet.
- 4.When it's applied to purifiers or similar, try to avoid placing the sensor directly in the air duct of the purifier; if unavoidable, set up a separate structure for placing the sensor to isolate it from the air duct.
- 5.When used with purifiers or fixed detection equipment, the sensor should be placed 20cm higher than the ground. Otherwise, it may be impeded by large dust particles or even flocs near the ground and stop working.
- 6.When the sensor is applied to outdoor fixed equipment, the protection against sandstorms, rain, snow, catkins, etc. should be completed by the equipment.
- 7.The sensor is an integral component, so please don’t disassemble it even the metal shielding shell in case there are irreversible damages.
- 8.Fix the bottom of the sensor with 2mm self-tapping screws, and the length of the screws into the shell should be no more than 5mm.
Pinout
Num | Label | Description |
---|---|---|
PIN1 | VCC | + (+5V) |
PIN2 | GND | - |
PIN3 | SET | Set pin/TTL level @3.3V, high level or suspending is normal working status, while low level is sleeping mode. |
PIN4 | RXD | Serial port receiving pin/TTL level @3.3V |
PIN5 | TXD | Serial port transmitting pin/TTL level @3.3V |
PIN6 | RESET | Module reset signal /TTL level @3.3V, low reset |
PIN7 | NC | |
PIN8 | NC |
Tutorial
This tutorial provides two sample codes for easily obtaining PM2.5, temperature and humidity values.
Requirements
- Hardware
- DFRobot Leonardo & Xbee R3 Mainboard x 1
- Gravity IO Expansion Shield V7.1 x 1
- Air Quality Monitor x 1
- M-M/F-M/F-F Jumper wires
- Software
- Arduino IDE Click to Download Arduino IDE from Arduino®
Sample Code 1 - Arduino Leonardo
- This code uses Leonardo HardwareSerial1 as communication port.
/*!
* @file SEN0233.ino
* @brief Air Quality Monitor (PM 2.5, HCHO, Temperature & Humidity)
* @n Get the module here: https://www.dfrobot.com/product-1612.html
* @n This example is to detect formaldehyde, PM2.5, temperature and humidity in the environment.
* @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
* @license The MIT License (MIT)
* @author [lijun](ju.li@dfrobot.com)
* @version V1.0
* @date 2017-04-21
*/
char col;
unsigned int PMSa1 = 0, PMSa2_5 = 0, PMSa10 = 0, FMHDSa = 0, TPSa = 0, HDSa = 0, PMSb1 = 0, PMSb2_5 = 0, PMSb10 = 0, FMHDSb = 0, TPSb = 0, HDSb = 0;
unsigned int PMS1 = 0,PMS2_5 = 0,PMS10 = 0, FMHDS = 0, TPS = 0, HDS = 0, CR1 = 0, CR2 = 0;
unsigned char bufferRTT[32] = {}; //serial receive data
char tempStr[15];
void setup()
{
// put your setup code here, to run once:
Serial.begin(115200);
//Select serial port(Serial1,Serial2,Serial3)
Serial1.begin(9600);
}
void loop()
{
// put your main code here, to run repeatedly:
while (!Serial1.available());
while (Serial1.available() > 0) //Check whether there is any serial data
{
for (int i = 0; i < 32; i++)
{
col = Serial1.read();
bufferRTT[i] = (char)col;
delay(2);
}
Serial1.flush();
CR1 = (bufferRTT[30] << 8) + bufferRTT[31];
CR2 = 0;
for (int i = 0; i < 30; i++)
CR2 += bufferRTT[i];
if (CR1 == CR2) //Check
{
PMSa1 = bufferRTT[10]; //Read PM1 high 8-bit data
PMSb1 = bufferRTT[11]; //Read PM1 low 8-bit data
PMS1 = (PMSa1 << 8) + PMSb1; //PM1 data
PMSa2_5 = bufferRTT[12]; //Read PM2.5 high 8-bit data
PMSb2_5 = bufferRTT[13]; //Read PM2.5 low 8-bit data
PMS2_5 = (PMSa2_5 << 8) + PMSb2_5; //PM2.5 data
PMSa10 = bufferRTT[14]; //Read PM10 high 8-bit data
PMSb10 = bufferRTT[15]; //Read PM10 low 8-bit data
PMS10 = (PMSa10 << 8) + PMSb10; //PM10 data
TPSa = bufferRTT[24]; //Read temperature high 8-bit data
TPSb = bufferRTT[25]; //Read temperature low 8-bit data
TPS = (TPSa << 8) + TPSb; //Temperature data
HDSa = bufferRTT[26]; //Read humidity high 8-bit data
HDSb = bufferRTT[27]; //Read humidity low 8-bit data
HDS = (HDSa << 8) + HDSb; //Humidity data
}
else
{
PMS1 = 0;
PMS2_5 = 0;
PMS10 = 0;
TPS = 0;
HDS = 0;
}
}
Serial.println("-----------------------uart--------------------------");
Serial.print("Temp : ");
sprintf(tempStr, "%d%d.%d", TPS / 100, (TPS / 10) % 10, TPS % 10);
Serial.print(tempStr);
Serial.println(" C"); //Display temperature
Serial.print("RH : ");
sprintf(tempStr, "%d%d.%d", HDS / 100, (HDS / 10) % 10, HDS % 10);
Serial.print(tempStr); //Display humidity
Serial.println(" %"); //%
Serial.print("PM1.0: ");
Serial.print(PMS1);
Serial.println(" ug/m3"); //Display PM1.0 unit ug/m³
Serial.print("PM2.5: ");
Serial.print(PMS2_5);
Serial.println(" ug/m3"); //Display PM2.5 unit ug/m³
Serial.print("PM 10: ");
Serial.print(PMS10);
Serial.println(" ug/m3"); //Display PM 10 unit ug/m³
}
Sample Code 2 - Arduino UNO (Software Serial)
- Software serial port is used here to communicate with the senor because Arduino UNO has only one serial port and it's connected to USB.
Connections:
PM2.5 Sensor Adapter | UNO |
---|---|
VCC | 5V |
GND | GND |
TX | 10 |
RX | 11 |
/*!
* @file SEN0233.ino
* @brief Air Quality Monitor (PM 2.5, HCHO, Temperature & Humidity)
* @n Get the module here: https://www.dfrobot.com/product-1612.html
* @n This example is to detect formaldehyde, PM2.5, temperature and humidity in the environment.
* @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
* @license The MIT License (MIT)
* @author [lijun](ju.li@dfrobot.com)
* @version V1.0
* @date 2017-03-01
*/
#include <SoftwareSerial.h>
char col;
unsigned int PMSa1 = 0, PMSa2_5 = 0, PMSa10 = 0, FMHDSa = 0, TPSa = 0, HDSa = 0, PMSb1 = 0, PMSb2_5 = 0, PMSb10 = 0, FMHDSb = 0, TPSb = 0, HDSb = 0;
unsigned int PMS1 = 0,PMS2_5 = 0,PMS10 = 0, FMHDS = 0, TPS = 0, HDS = 0, CR1 = 0, CR2 = 0;
unsigned char bufferRTT[32] = {}; //serial receive data
char tempStr[15];
SoftwareSerial mySerial(10, 11); // RX, TX
void setup()
{
Serial.begin(115200);
mySerial.begin(9600);
}
void loop()
{
while (!mySerial.available());
while (mySerial.available() > 0) //Check whether there is any serial data
{
for (int i = 0; i < 32; i++)
{
col = mySerial.read();
bufferRTT[i] = (char)col;
delay(2);
}
mySerial.flush();
CR1 = (bufferRTT[30] << 8) + bufferRTT[31];
CR2 = 0;
for (int i = 0; i < 30; i++)
CR2 += bufferRTT[i];
if (CR1 == CR2) //Check
{
PMSa1 = bufferRTT[10]; //Read PM1 high 8-bit data
PMSb1 = bufferRTT[11]; //Read PM1 low 8-bit data
PMS1 = (PMSa1 << 8) + PMSb1; //PM1 data
PMSa2_5 = bufferRTT[12]; //Read PM2.5 high 8-bit data
PMSb2_5 = bufferRTT[13]; //Read PM2.5 low 8-bit data
PMS2_5 = (PMSa2_5 << 8) + PMSb2_5; //PM2.5 data
PMSa10 = bufferRTT[14]; //Read PM10 high 8-bit data
PMSb10 = bufferRTT[15]; //Read PM10 low 8-bit data
PMS10 = (PMSa10 << 8) + PMSb10; //PM10 data
TPSa = bufferRTT[24]; //Read temperature high 8-bit data
TPSb = bufferRTT[25]; //Read temperature low 8-bit data
TPS = (TPSa << 8) + TPSb; //Temperature data
HDSa = bufferRTT[26]; //Read humidity high 8-bit data
HDSb = bufferRTT[27]; //Read humidity low 8-bit data
HDS = (HDSa << 8) + HDSb; //Humidity data
}
else
{
PMS1 = 0;
PMS2_5 = 0;
PMS10 = 0;
TPS = 0;
HDS = 0;
}
}
Serial.println("-----------------------uart--------------------------");
Serial.print("Temp : ");
sprintf(tempStr, "%d%d.%d", TPS / 100, (TPS / 10) % 10, TPS % 10);
Serial.print(tempStr);
Serial.println(" C"); //Display temperature
Serial.print("RH : ");
sprintf(tempStr, "%d%d.%d", HDS / 100, (HDS / 10) % 10, HDS % 10);
Serial.print(tempStr); //Display humidity
Serial.println(" %"); //%
Serial.print("PM1.0: ");
Serial.print(PMS1);
Serial.println(" ug/m3"); //Display PM1.0 unit ug/m³
Serial.print("PM2.5: ");
Serial.print(PMS2_5);
Serial.println(" ug/m3"); //Display PM2.5 unit ug/m³
Serial.print("PM 10: ");
Serial.print(PMS10);
Serial.println(" ug/m3"); //Display PM 10 unit ug/m³
}
Result
Mind+ (Based on Scratch3.0) Graphical Programming (Arduino UNO Software Serial)
1.Download and install Mind+: https://www.mindplus.cc.
2.Switch to "Offline" mode.
3.Click "Extensions" and click "Board" to select Arduino UNO, and select "Software Serial" in "Function".
4.Edit a simple program as shown in the following figure.
5.After uploading the codes, open serial monitor to see output data.
Click here to see detailed tutorial.
Typical Application
Requirements
Hardware
- Arduino UNO or DFRobot Leonardo & Xbee R3 (require changing Serial to Serial1) x 1
- Gravity IO Expansion Shield V7.1 x 1
- Gravity LCD1602 RGB Backlight Module x 1
- Air Quality Monitor x 1
- Micro USB Cable x1
- M-M/F-M/F-F Jumper wires
Software
- Arduino IDE Click to Download Arduino IDE from Arduino®
Connection Diagram
Sample Code
- This sample code is for the connection diagram above
- Please download the LCD library: DFRobot RGB LCD.
/*!
* @file SEN0233.ino
* @brief Air Quality Monitor (PM 2.5, HCHO, Temperature & Humidity)
* @n Get the module here: https://www.dfrobot.com/product-1612.html
* @n This example is to detect formaldehyde, PM2.5, temperature and humidity in the environment.
* @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
* @license The MIT License (MIT)
* @author [lijun](ju.li@dfrobot.com)
* @version V1.0
* @date 2017-07-28
*/
#include <Wire.h>
#include <SoftwareSerial.h>
#include "DFRobot_RGBLCD1602.h"
char col;
unsigned int PMSa = 0, FMHDSa = 0, TPSa = 0, HDSa = 0, PMSb = 0, FMHDSb = 0, TPSb = 0,
HDSb = 0, PMS = 0, TPS = 0, HDS = 0, CR1 = 0, CR2 = 0, FMHDS = 0;
unsigned char bufferRTT[32] = {}; //serial receive data
char tempStr[15];
SoftwareSerial mySerial(10, 11); // RX, TX
/*
Change the RGBaddr value based on the hardware version
-----------------------------------------
Moudule | Version| RGBAddr|
-----------------------------------------
LCD1602 Module | V1.0 | 0x60 |
-----------------------------------------
LCD1602 Module | V1.1 | 0x6B |
-----------------------------------------
LCD1602 RGB Module | V1.0 | 0x60 |
-----------------------------------------
LCD1602 RGB Module | V1.1 | 0x2D |
-----------------------------------------
*/
DFRobot_RGBLCD1602 lcd(/*RGBAddr*/0x60 ,/*lcdCols*/16,/*lcdRows*/2); //16 characters and 2 lines of show
void setup()
{
Serial.begin(115200);
mySerial.begin(9600);
lcd.init();//Initialize LCD1602 RGB display
lcd.setRGB(0, 255, 0); //Set the initial backlight color of the display
lcd.setCursor(0, 0 ); //Set displaying from (0, 0)
lcd.print("T:");//Display T:
lcd.setCursor(9, 0 );
lcd.print("H:");
lcd.setCursor(0, 1 );
lcd.print("PM2.5:");
lcd.setCursor(9, 1 );
lcd.print("ug/m3");
}
void loop()
{
while (mySerial.available() > 0) //Check whether there is any serial data
{
for (int i = 0; i < 32; i++) //Read serial data
{
col = mySerial.read();
bufferRTT[i] = (char)col;
delay(2);
}
mySerial.flush();
CR1 = (bufferRTT[30] << 8) + bufferRTT[31];
CR2 = 0;
for (int i = 0; i < 30; i++)
CR2 += bufferRTT[i];
if (CR1 == CR2) //Check
{
PMSa = bufferRTT[12]; //Read PM2.5 high 8-bit data
PMSb = bufferRTT[13]; //Read PM2.5 low 8-bit data
PMS = (PMSa << 8) + PMSb; //PM2.5 data
TPSa = bufferRTT[24]; //Read temperature high 8-bit data
TPSb = bufferRTT[25]; //Read temperature low 8-bit data
TPS = (TPSa << 8) + TPSb; //Temperature data
HDSa = bufferRTT[26]; //Read humidity high 8-bit data
HDSb = bufferRTT[27]; //Read humidity low 8-bit data
HDS = (HDSa << 8) + HDSb; //Humidity data
}
else
{
PMS = 0;
FMHDS = 0;
TPS = 0;
HDS = 0;
}
}
lcd.setCursor(2, 0 );
sprintf(tempStr, "%d%d.%d", TPS / 100, (TPS / 10) % 10, TPS % 10); //Display temperature
lcd.print(tempStr);
lcd.write(0xdf); //Display °
lcd.print('C'); //Display C
lcd.setCursor(11, 0 );
sprintf(tempStr, "%d%d.%d", HDS / 100, (HDS / 10) % 10, HDS % 10); //Display humidity
lcd.print(tempStr);
lcd.print('%'); //Display %
lcd.setCursor(6, 1 );
sprintf(tempStr, "%d%d%d", PMS / 100, (PMS / 10) % 10, PMS % 10); //Display PM2.5 ones, tens, hundreds unit ug/m³
lcd.print(tempStr);
}
Result
The LCD shows the current measured temperature (T), humidity (H) and PM2.5 concentration (PM2.5).
FAQ
For any questions, advice or cool ideas to share, please visit the DFRobot Forum.