Gravity: PM2.5 Air Quality Sensor PM2.5/PM10 Particle Sensor Wiki - DFRobot

Introduction

As the most basic part of life, air is attracting more and more attention, for example, the most common PM2.5, PM1.0, PM10, etc. Keeping an eye on the quality of the air we breath is becoming quite important. This time, DFRobot brings you this Air Quality Sensor that can measure particulate matter like PM2.5, PM1.0, PM10. With easy-to-use Gravity interface, the air quality sensor works well with most main-controllers. And we provide you with relevant sample codes to help you quickly build up air quality monitoring projects.

Based on the principle of laser scattering, the PM2.5 air quality sensor employs a digital universal particle sensor that can continuously collect and calculate the number of suspended particles of different sizes in the air per unit volume, which is particle concentration distribution, and then convert to concentration and output via I2C interface. The sensor can be embedded in various instruments and meters or environmental improvement equipment related to the concentration of suspended particulate matter in the air to provide timely and accurate concentration data. It is typically suitable for smoking rooms, kitchens, hot springs, bathrooms and other environments.

How does the sensor work?

This sensor adopts the principle of laser scattering, that is, to make the laser irradiate the suspended particles in the air to produce scattering, and at the same time collect the scattered light at a certain angle, and obtain the curve of the intensity of the scattered light with time. Furthermore, the microprocessor, based on the MIE theory algorithm, obtains the equivalent particle size of the particles and the number of particles of different particle sizes per unit volume.

The block diagram of each functional part of the sensor is shown in Figure 1.

Feature

Specification

Precautions

Installation Note

  1. The metal shell is connected to the internal power ground. Be careful not to short-circuit it with other external board circuit or chassis shell.
  2. The best installation method is to connect the plane with air inlet and outlet holes with the user’s machine’s inner wall (where there are gas holes connect with the outside). If this method is impossible to use, make sure there is no obstacles within 2cm of the air outlets, and there should be a structure between the air inlet and the air outlet to isolate the airflow and avoid the airflow from the air outlet to the air inlet directly inside the user machine.
  3. The vent opening on the inner wall of the user machine for the air inlet should not be smaller than the size of the air inlet.
  4. When applied to purifier products, try to avoid placing the sensor directly in the air duct of the purifier. If it is unavoidable, set up a separate structural space and place the sensor in it to isolate it from the air duct of the purifier.
  5. When used with purifiers or fixed detection equipment, the sensor position should be more than 20cm above the ground. Otherwise, it may be contaminated by large dust particles or even flocs near the ground, causing the fan to wind and block rotation.
  6. When the sensor is applied to outdoor fixed equipment, the protection against sandstorms, rain and snow, and willow catkins, etc. should be completed by the equipment.
  7. The sensor should be an integral component, the user should not disassemble it, including the metal shielding shell, to prevent irreversible damage.
  8. The sensor can be fixed with M3 tapping screws.

Others

  1. This sensor data ensures the consistency between the factory individuals, and does not use third-party testing equipment or data as a comparison standard. If the user wants the final measurement result to be consistent with a third-party testing equipment, the user can perform data fitting based on the actual collected results.
  2. This sensor is suitable for ordinary indoor environment. If the user equipment is used in the following actual environments, corresponding protective measures should be added to the sensor, otherwise the data consistency may decrease due to excessive dust, oil, and water ingress:
    • Places where more than 50% of the time, the dust concentration is greater than 300mg/m^3 or more than 20% of the time, the dust concentration is greater than 500mg/m^3, for example a smoking room.
    • Oily fume environment, such as kitchen
    • High vapour environment, such as hot spring, bathroom
    • Outdoor

PM2.5 air quality international standard table

Country/Organization Annual average concentration(μg/m³) 24h average concentration(μg/m³)
WHO guideline value 10 25
WHO transitional goal 1 35 75
WHO transitional goal 2 25 50
WHO transitional goal 3 15 37.8
Australia 8 25
United States 15 35
Japan 15 35
European Union 25 None
China 35 75

Correspondence table of air pollution index (AQI) and PM1.0, PM2.5 pollutant concentration value

AQI index Air quality level Average PM1.0 concentration in 24 hours(μg/m³) Average PM2.5 concentration in 24 hours(μg/m³)
0~50 Excellent 0~50 0~35
51~100 Good 50~150 36~75
101~150 Light pollution 151~250 76~115
151~200 Moderate pollution 251~350 116~150
201~300 Heavy pollution 351~420 151~250
>300 Serious pollution 421~500 251~250

Overview

Serial number Screen printing Function description
1 VCC/+ Power positive
2 GND/- Power negative
3 SCL/C I2C clock line
4 SDA/D I2C data line

Tutorial for Arduino

The product uses the Gravity standard I2C interface, which is relatively simple to use. Connect the sensor to the uno (or other motherboard) as shown in the wiring diagram.

Preparation:

For how to install the library file, click the link

/*!
 *  @brief Get the concentration of the specified particle type
 *  @param type:PARTICLE_PM1_0_STANDARD  Particle concentration of PM1.0 in standard particle
                      PARTICLE_PM2_5_STANDARD  Particle concentration of PM2.5 in standard particle
                      PARTICLE_PM10_STANDARD   Particle concentration of PM10 in standard particle
                      PARTICLE_PM1_0_ATMOSPHERE Particulate matter concentration of PM1.0 in atmospheric environment
                      PARTICLE_PM2_5_ATMOSPHERE Particulate matter concentration of PM2.5 in atmospheric environment
                      PARTICLE_PM10_ATMOSPHERE  Particulate matter concentration of PM10 in atmospheric environment
 *  @return concentration(ug/m3)
 */
    uint16_t gainParticleConcentration_ugm3(uint8_t type);
/*!
 *  @brief Get the number of particles per 0.1 liter of air
 *  @param type:PARTICLENUM_0_3_UM_EVERY0_1L_AIR
                      PARTICLENUM_0_5_UM_EVERY0_1L_AIR
                      PARTICLENUM_1_0_UM_EVERY0_1L_AIR
                      PARTICLENUM_2_5_UM_EVERY0_1L_AIR
                      PARTICLENUM_5_0_UM_EVERY0_1L_AIR
                      PARTICLENUM_10_UM_EVERY0_1L_AIR 
 *  @return number
 */
    uint16_t gainParticleNum_Every0_1L(uint8_t type);

/*!
 *  @brief Writes data to the specified register of the sensor
 *  @param NULL
 *  @return No return value
 */
    uint8_t gainVersion();

Sample code-standard particle concentration

Function description: Get the standard particle concentration of PM2.5, PM1.0, PM10.

#include "DFRobot_AirQualitySensor.h"

#define I2C_ADDRESS    0x19
  DFRobot_AirQualitySensor particle(&Wire ,I2C_ADDRESS);

void setup() {
  Serial.begin(115200);
/**
  Sensor initialization is used to initialize IIC, which is determined by the communication mode used at this time.
*/
  while(!particle.begin())
  {
    Serial.println("NO Deivces !");
    delay(1000);
  }
  Serial.println("sensor begin success!");
  delay(1000);
/**
  Get sensor version number
*/
  uint8_t version = particle.gainVersion();
  Serial.print("version is : ");
  Serial.println(version);
  delay(1000);
}

void loop() {
/**
 *@brief : Get concentration of PM1.0 PM2.5 PM10
 *@param :PARTICLE_PM1_0_STANDARD  Standard particle  
          PARTICLE_PM2_5_STANDARD  Standard particle  
          PARTICLE_PM10_STANDARD   Standard particle 
          PARTICLE_PM1_0_ATMOSPHERE  In atmospheric environment
          PARTICLE_PM2_5_ATMOSPHERE  In atmospheric environment
          PARTICLE_PM10_ATMOSPHERE   In atmospheric environment
*/  
  uint16_t PM2_5 = particle.gainParticleConcentration_ugm3(PARTICLE_PM2_5_STANDARD);
  uint16_t PM1_0 = particle.gainParticleConcentration_ugm3(PARTICLE_PM1_0_STANDARD);
  uint16_t PM10 = particle.gainParticleConcentration_ugm3(PARTICLE_PM10_STANDARD);
  Serial.print("PM2.5 concentration:");
  Serial.print(PM2_5);
  Serial.println(" ug/m3");
  Serial.print("PM1.0 concentration:");
  Serial.print(PM1_0);
  Serial.println(" ug/m3");
  Serial.print("PM10 concentration:");
  Serial.print(PM10);
  Serial.println(" ug/m3");
  Serial.println();
  delay(1000);
}

Result

In the state of standard particulate matter, the concentration of PM2.5, PM1.0, PM10 read is: 45ug/m3, 31ug/m3, 49ug/m3.

Sample code-particulate matter concentration in atmospheric environment

Function description: Obtain the concentration of particulate matter in the atmospheric environment of PM2.5, PM1.0, PM10.

#include "DFRobot_AirQualitySensor.h"

#define I2C_ADDRESS    0x19
  DFRobot_AirQualitySensor particle(&Wire ,I2C_ADDRESS);

void setup() {
  Serial.begin(115200);
/**
  Sensor initialization is used to initialize IIC, which is determined by the communication mode used at this time.
*/
  while(!particle.begin())
  {
    Serial.println("NO Deivces !");
    delay(1000);
  }
  Serial.println("sensor begin success!");
  delay(1000);
/**
  Get sensor version number
*/
  uint8_t version = particle.gainVersion();
  Serial.print("version is : ");
  Serial.println(version);
  delay(1000);
}

void loop() {
/**
 *@brief : Get concentration of PM1.0 
 *@param :PARTICLE_PM1_0_STANDARD  Standard particle 
          PARTICLE_PM2_5_STANDARD  Standard particle
          PARTICLE_PM10_STANDARD   Standard particle  
          PARTICLE_PM1_0_ATMOSPHERE  In atmospheric environment
          PARTICLE_PM2_5_ATMOSPHERE  In atmospheric environment
          PARTICLE_PM10_ATMOSPHERE   In atmospheric environment
*/  
  uint16_t PM2_5 = particle.gainParticleConcentration_ugm3(PARTICLE_PM2_5_ATMOSPHERE );
  uint16_t PM1_0 = particle.gainParticleConcentration_ugm3(PARTICLE_PM1_0_ATMOSPHERE );
  uint16_t PM10 = particle.gainParticleConcentration_ugm3(PARTICLE_PM10_ATMOSPHERE);
  Serial.print("PM2.5 concentration:");
  Serial.print(PM2_5);
  Serial.println(" ug/m3");
  Serial.print("PM1.0 concentration:");
  Serial.print(PM1_0);
  Serial.println(" ug/m3");
  Serial.print("PM10 concentration:");
  Serial.print(PM10);
  Serial.println(" ug/m3");
  Serial.println();
  delay(1000);
}

Result

In the atmospheric environment, the particle concentration of PM2.5/PM1.0/PM10 is about: 38ug/m3, 23ug/m3, 46ug/m3.

Sample code-the number of particles per 0.1 liter of air

Function description: Read the number of particles above 0.3um/0.5um/1.0um/2.5um/5.0um/10um per 0.1 liter of air.


#include "DFRobot_AirQualitySensor.h"

#define I2C_ADDRESS    0x19
  DFRobot_AirQualitySensor particle(&Wire ,I2C_ADDRESS);

void setup() {
  Serial.begin(115200);
/**
  Sensor initialization is used to initialize IIC, which is determined by the communication mode used at this time.
*/
  while(!particle.begin())
  {
    Serial.println("NO Deivces !");
    delay(1000);
  }
  Serial.println("sensor begin success!");
  delay(1000);
/**
  Get sensor version number
*/
  uint8_t version = particle.gainVersion();
  Serial.print("version is : ");
  Serial.println(version);
  delay(1000);
}

void loop() {
/**
 *@brief : Get particle number of 0.3um/0.5um/1.0um/2.5um/5.0um/10um per 0.1L of air
 *@param :PARTICLENUM_0_3_UM_EVERY0_1L_AIR 
          PARTICLENUM_0_5_UM_EVERY0_1L_AIR 
          PARTICLENUM_1_0_UM_EVERY0_1L_AIR 
          PARTICLENUM_2_5_UM_EVERY0_1L_AIR 
          PARTICLENUM_5_0_UM_EVERY0_1L_AIR 
          PARTICLENUM_10_UM_EVERY0_1L_AIR   
*/  
  uint16_t um0_3 = particle.gainParticleNum_Every0_1L(PARTICLENUM_0_3_UM_EVERY0_1L_AIR);
  uint16_t um0_5= particle.gainParticleNum_Every0_1L(PARTICLENUM_0_5_UM_EVERY0_1L_AIR);
  uint16_t um1_0= particle.gainParticleNum_Every0_1L(PARTICLENUM_1_0_UM_EVERY0_1L_AIR);
  uint16_t um2_5= particle.gainParticleNum_Every0_1L(PARTICLENUM_2_5_UM_EVERY0_1L_AIR);
  uint16_t um5_0= particle.gainParticleNum_Every0_1L(PARTICLENUM_5_0_UM_EVERY0_1L_AIR);
  uint16_t um10= particle.gainParticleNum_Every0_1L(PARTICLENUM_10_UM_EVERY0_1L_AIR);
  Serial.print("The number of particles with a diameter of 0.3um per 0.1 in lift-off is: ");
  Serial.println(um0_3);
   Serial.print("The number of particles with a diameter of 0.5um per 0.1 in lift-off is: ");
  Serial.println(um0_5);
   Serial.print("The number of particles with a diameter of 1.0um per 0.1 in lift-off is: ");
  Serial.println(um1_0);
   Serial.print("The number of particles with a diameter of 2.5um per 0.1 in lift-off is: ");
  Serial.println(um2_5);
   Serial.print("The number of particles with a diameter of 5.0um per 0.1 in lift-off is: ");
  Serial.println(um5_0);
    Serial.print("The number of particles with a diameter of 10um per 0.1 in lift-off is: ");
  Serial.println(um10);
  Serial.println("");
  delay(1000);
}

Result

It is read that the number of 0.3um/0.5um/1.0um/2.5um/5.0um/10um particles per 0.1 liter of air is approximately: 1615, 1356, 233, 0, 0, 0.

Tutorial for micro:bit - MakeCode

The product uses the Gravity standard I2C interface, which is relatively simple to use. Connect the sensor to the micro:bit as shown in the wiring diagram.

Preparation:

How to use makecode software? MakeCode online graphical programming basic operation tutorial MakeCode basic operation tutorial

Sample code-standard particle concentration

Function description: Get the standard particle concentration of PM2.5, PM1.0, PM10. Program link: https://makecode.microbit.org/_9HRJ7VTsDaM2

Result

In the state of standard particulate matter, the concentration of PM2.5, PM1.0, PM10 read is: 37ug/m3, 26ug/m3, 41ug/m3. The data printed by the serial port is as follows:

Sample code-the number of particles per 0.1 liter of air

Function description: Read the number of particles above 0.3um/1.0um/10um per 0.1 liter of air. Program link: https://makecode.microbit.org/_JMxHs15fK29r

Result

It is read that the number of 0.3um/1.0um/10um particles per 0.1 liter of air is about 1115, 160, and 0 respectively.

FAQ

For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documents