Dust sensor

Nova PM sensor SDS011 can measure fine dust and smoke = particulate matter (MP) concentrations in two categories:

  • Ultrafine dust particles with a diameter of 0 – 2.5 micrometres (μm/m3). Output PM2.5
  • Fine dust particles with a diameter 2.5 – 10 micrometres (μm/m3). Output PM10

The sensor is designed with a built-in fan to ensure sample air circulation to a chamber with a laser diode, where the size and amount of PMis determined. The scattered light is transformed into electrical signals and with further analysis, on the signal waveform, the digital output of the component is the particle concentration of PM2.5 andPM10 (from counts of particles with diameters from 0.3 to 10μm). The working principle is based on light scattering, where a light source illuminates the particles and the scattered light is transformed into a signal by a photodetector, the amplitude of which depends on the light wavelength, scattering angle, particle size and relative index of refraction between medium and particle. (3)

SDS011 layout

Hardware

SDS011 package includes sensor, cable and serial adapter module (USB to TTL). I got mine here: https://www.digitspace.com/sds011-air-quality-sensor-module?2e40f3ca70399010

And I use ESP8266 (Wemos D1 mini) to connect to sensor.

Sensor input voltage 5V. ESP8266 uses 3.3V. Sensor RX and TX pins are 3.3V tolerant.

Sensor have UART (Serial) output.

Its service life is up to 8000 hours. It is less than a year. So it’s better when sensor will not work all the time. And you make measurement from time to time. Like every ten minutes.

The sensor have more pins but we only need RX, TX, 5V and GND. Other can be left disconnected.

Simple SDS011 and ESP8266 circuit

We have to disconnect sensor TX and RX pins to upload new firmware. So maybe is better to add toggle switches between these pins.

Software

I use Nova Fitness SDS dust sensors arduino library. It works well with ESP8266 and uses Software serial.

I chose D3 and D4 pins to connect to sensor.

#include <Arduino.h>
#include <SdsDustSensor.h>

/* SDS011 Dust Sensor */
const int SDS_RX_PIN = D3; // D3 -> SDS011 TX pin
const int SDS_TX_PIN = D4; // D4 -> SDS011 TX pin
SoftwareSerial softwareSerial(SDS_RX_PIN, SDS_TX_PIN);
SdsDustSensor sds(softwareSerial); //  additional parameters: retryDelayMs and maxRetriesNotAvailable

const int MINUTE = 60000;
const int WAKEUP_WORKING_TIME = 30000; // 30 seconds.
const int MEASUREMENT_INTERVAL = 5 * MINUTE;

void setup() {
  Serial.begin(115200);

  Serial.println("SDS011 dust sensor");
  delay(MINUTE);

  /* SDS011 Dust Sensor */
  sds.begin();
  // Prints SDS011 firmware version:
  Serial.print("SDS011 ");
  Serial.println(sds.queryFirmwareVersion().toString()); 
  // Ensures SDS011 is in 'query' reporting mode:
  Serial.println(sds.setQueryReportingMode().toString()); 
}

void loop() {

  // Wake up SDS011
  sds.wakeup();
  delay(WAKEUP_WORKING_TIME);

  // Get data from SDS011
  PmResult pm = sds.queryPm();
  if (pm.isOk()) {
    Serial.print("PM2.5 = ");
    Serial.print(pm.pm25); // float, μg/m3

    Serial.print(", PM10 = ");
    Serial.println(pm.pm10);

  } else {
    Serial.print("Could not read values from sensor, reason: ");
    Serial.println(pm.statusToString());
  }

  // Put SDS011 back to sleep
  WorkingStateResult state = sds.sleep();
  if (state.isWorking()) {
    Serial.println("Problem with sleeping the SDS011 sensor.");
  } else {
    Serial.println("SDS011 sensor is sleeping");
    delay(MEASUREMENT_INTERVAL);
  }
}

And my sensor output:

Sensor output on my screen

Links:

  1. SDS011 Air Quality Sensor Module
  2. What is PM2.5 and Why You Should Care
  3. https://www.researchgate.net/publication/324176004_Development_and_On-Field_Testing_of_Low-Cost_Portable_System_for_Monitoring_PM25_Concentrations
  4. https://github.com/lewapek/sds-dust-sensors-arduino-library

24-Hour PM2.5 Levels

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.