Tuesday, 20 November 2018

Particulate meter - PPD42NS

One of my dreams was to measure particulate in the air and make this operation simple.
Thanks to the PPD42NS sensor this is possible. Obviously we have to use an Arduino (UNO in my case) to connect to and to abtain datas.

PPD42NS particulate meter.
The connection is very fast and simple (the following project was made by me using Fritzing IDE):
Connection schema between PPD42NS device and Arduino UNO

I opened the Arduino IDE to write the code, in reality I found this code online, I copied it and pasted on the IDE:
/*
 Interface to Shinyei Model PPD42NS Particle Sensor
 Program by Christopher Nafis 
 Written April 2012
 
 http://www.seeedstudio.com/depot/grove-dust-sensor-p-1050.html
 http://www.sca-shinyei.com/pdf/PPD42NS.pdf
 
 JST Pin 1 (Black Wire)  => Arduino GND
 JST Pin 3 (Red wire)    => Arduino 5VDC
 JST Pin 4 (Yellow wire) => Arduino Digital Pin 8
 */

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();
  }
}
 

I found the code here :
http://www.howmuchsnow.com/arduino/airquality/grovedust/

As you can see in the following pictures (and as written in the code) the yellow wire is connected to the pin 8: this wire contains the information about the  of particulate.

The particulate was positioned vertically.

Following the previous schema I connected Arduino to the sensor.

The project has brought out the following results.

Obsviously we need to calibrate everything not to having had a reference emission source.

Here you can see the related video on my personal YouTube channel:




Results:
Results on Arduino IDE monitor.


Concentration values were taken in the following unit of measurement:


pcs / 0.01 cf

where pcs stand for pieces and cf for cubic feet (0.01 cf = 283 ml).


Next steps: 
  • transform of the unit measure in ml;
  • sampling at the rythm of 5 mins;
  • export datas on an electronic sheet;
  • visualization in real time of the datas and graphic them;
  • comparison of data with those of the CNR (!!).
That's all folks! ...for the moment! 

No comments:

Post a Comment