Electorials Electronics
Published © GPL3+

Project 010: Arduino Grove - Dust Sensor (PPD42NS) Project

This simple yet sophisticated project is ideal for weather stations as this Grove dust sensor provides accurate data, alongside an Arduino.

EasyProtip12 minutes14
Project 010: Arduino Grove - Dust Sensor (PPD42NS) Project

Things used in this project

Hardware components

Grove - Dust Sensor(PPD42NS)
Seeed Grove - Dust Sensor(PPD42NS)
×1
Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
You could use any other Arduino board as well. The Seeeduino v4.2 is used in this example.
×1
Jumper wires (generic)
Jumper wires (generic)
3 Male to Male Jumper Wires
×3
USB-A to B Cable
USB-A to B Cable
Depends on the Arduino.
×1
PCBWay Custom PCB
PCBWay Custom PCB
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Circuit Diagram

Capture 1 vdn2lzkzpl

Schematics

Schematics 2 wbmvopqcsf

Code

Arduino Grove - Dust Sensor (PPD42NS) Project Code

C/C++
int pin = 8;
unsigned long duration;
unsigned long starttime;
unsigned long sampletime_ms = 2000; 
unsigned long lowpulseoccupancy = 0;
float ratio = 0;
float concentration = 0;

void setup() {
  Serial.begin(9600);
  pinMode(8,INPUT);
  starttime = millis(); 
}

void loop() {
  duration = pulseIn(pin, LOW);
  lowpulseoccupancy = lowpulseoccupancy+duration;
  if ((millis()-starttime) >= sampletime_ms) //if the sampel time = = 30s
  {
    ratio = lowpulseoccupancy/(sampletime_ms*10.0);  
    concentration = 1.1*pow(ratio,3)-3.8*pow(ratio,2)+520*ratio+0.62; 
    Serial.print("Concentration = ");
    Serial.print(concentration);
    Serial.println(" pcs/0.01cf");
    Serial.println("\n");
    lowpulseoccupancy = 0;
    starttime = millis();
  }
}

Credits

Electorials Electronics

Electorials Electronics

14 projects • 1 follower
I'm an electronic hobbyist interested in anything, from Arduino to drones. I plan to educate people with the content on my website.

Comments

Add projectSign up / Login