View
2
Download
0
Category
Preview:
Citation preview
IPSIA “R. FRAU”
A.S. 2019/2020
LABORATORIO DI FISICA CON ARDUINO Prof. Lorenzo Morresi
Classe 3EMT-MAT San Ginesio
Titolo progetto
Tester per la qualità dell’aria – PM10 e PM2.5 –
Scheda progetto n_21
Descrizione
Realizziamo un tester per la misura della qualità dell’aria (Air Test Quality) in grado di rilevare la materia particolata (Particulate Matter – PM) di diametro fino a 10 µm (PM10) e fino a 2.5 µm (PM2.5). Il sensore utilizzato è un PPD42ns della Shinyei che con le sue due uscite P1 e P2 permette di riconoscere e quantificare le due quantità di particelle presenti nell’aria. I valori ottenuti vengono mostrati sia sul monitor seriale che sul display lcd collegato alla base shield di Arduino mediante la porta I2C.
Materiale necessario
1 ARDUINO UNO board 1 Sensore PPD42ns - Shinyei 1 Display LCD – I2C 1 Grove Starter Kit per Arduino 1 Grove Base Shield
qui trovi i link
Sketch
#include <Wire.h> #include <rgb_lcd.h> rgb_lcd lcd; byte micr[8] = {B00000,B00000,B00000,B10010,B10010,B10010,B11110,B10000}; byte cubo[8] = {B11000,B00100,B11000,B00100,B11000,B00000,B00000,B00000}; unsigned long starttime; unsigned long triggerOnP1; unsigned long triggerOffP1; unsigned long pulseLengthP1; unsigned long durationP1; boolean valP1 = HIGH; boolean triggerP1 = false; unsigned long triggerOnP2; unsigned long triggerOffP2; unsigned long pulseLengthP2; unsigned long durationP2; boolean valP2 = HIGH; boolean triggerP2 = false; float ratioP1 = 0; float ratioP2 = 0; unsigned long sampletime_ms = 3000; float countP1; float countP2; void setup(){
lcd.begin(16,2); lcd.createChar(0,micr); lcd.createChar(1,cubo); lcd.clear(); lcd.setCursor(0, 0); lcd.print("LORENZO MORRESI"); lcd.setCursor(0, 1); lcd.print("Air Quality Test"); delay (6000); pinMode(8, INPUT); pinMode(9, INPUT); Serial.begin(9600); } void loop(){ valP1 = digitalRead(8); valP2 = digitalRead(9); if(valP1 == LOW && triggerP1 == false){ triggerP1 = true; triggerOnP1 = micros(); } if (valP1 == HIGH && triggerP1 == true){ triggerOffP1 = micros(); pulseLengthP1 = triggerOffP1 - triggerOnP1; durationP1 = durationP1 + pulseLengthP1; triggerP1 = false; } if(valP2 == LOW && triggerP2 == false){ triggerP2 = true; triggerOnP2 = micros(); } if (valP2 == HIGH && triggerP2 == true){ triggerOffP2 = micros(); pulseLengthP2 = triggerOffP2 - triggerOnP2; durationP2 = durationP2 + pulseLengthP2; triggerP2 = false; } if ((millis() - starttime) > sampletime_ms) { ratioP1 = durationP1/(sampletime_ms*10.0); // Integer percentage 0=>100 ratioP2 = durationP2/(sampletime_ms*10.0); countP1 = 1.1*pow(ratioP1,3)-3.8*pow(ratioP1,2)+520*ratioP1+0.62; countP2 = 1.1*pow(ratioP2,3)-3.8*pow(ratioP2,2)+520*ratioP2+0.62; float PM10count = countP2; float PM25count = countP1 - countP2; // first, PM10 count to mass concentration conversion double r10 = 2.6*pow(10,-6); double pi = 3.14159; double vol10 = (4/3)*pi*pow(r10,3); double density = 1.65*pow(10,12);
double mass10 = density*vol10; double K = 3531.5; float concLarge = (PM10count)*K*mass10; // next, PM2.5 count to mass concentration conversion double r25 = 0.44*pow(10,-6); double vol25 = (4/3)*pi*pow(r25,3); double mass25 = density*vol25; float concSmall = (PM25count)*K*mass25; //scrittura sul monitor seriale Serial.print("PM10 count ="); Serial.print(PM10count); Serial.println(" pt/cf"); Serial.print("PM2.5 count ="); Serial.print(PM25count); Serial.println(" pt/cf"); Serial.print("PM10 conc ="); Serial.print(concLarge); Serial.println(" ug/m3"); Serial.print("PM2.5 conc ="); Serial.print(concSmall); Serial.println(" ug/m3"); //scrittura su display lcd lcd.clear(); lcd.print("PM10 : "); lcd.print(concLarge); lcd.setCursor(11,0); lcd.write(byte(0)); lcd.print("g/m"); lcd.write(byte(1)); lcd.setCursor(0,1); lcd.print("PM2.5: "); lcd.print(concSmall); lcd.setCursor(11,1); lcd.write(byte(0)); lcd.print("g/m"); lcd.write(byte(1)); durationP1 = 0; durationP2 = 0; starttime = millis(); } }
Schema dei collegamenti
Dettaglio connessioni
sensore ppd42ns
P1 collegato a D8 di ARDUINO P2 collegato a D9 di ARDUINO
ARDUINO Board
GROVE Base Shield
Sensore PPD42ns
Porta D8
Porta I2C
LCD I2C
1 2 3 4 5
GND
P2 +5V P1
Se si usa la Grove Base Shield il connettore proveniente dal PPD42ns deve essere collegato alla sua porta D8.
Dettaglio connessioni display LCD
I2C
Dust sensor - PPN42ns
Vcc collegato a +5V di ARDUINO SDA collegato a A4 di ARDUINO SCL collegato a A5 di ARDUINO
Se si usa la Grove Base Shield il connettore proveniente dal display LCD deve essere collegato ad una delle sue porte I2C.
Risultato atteso
(esempio)
Prova a Inserire un allarme che si attivi quanto il PM10 e/o il PM2.5 supera un certo livello di soglia.
Nome e Cognome
VOTO:
This sensor is to create Digital (Lo Pulse) output to Particulate Matters(PM). Lo Pulse Occupancy time (LPO
time) is in proportion to PM concentration. The output from “P1” is for PM whose size is around 1 micro meter
or larger. “P1” Output characteristics is shown in the attached drawing Fig2.,when tested in standard
condition stipulated below.
Model PPD42NS
Detectable particle size approx. 1μm (minimum.)
Detectable range of concentration 0~28,000 pcs/liter (0~8,000pcs/0.01 CF=283ml)
Supply Voltage DC5V +/- 10% (CN1:Pin1=GND, Pin3=+5V)
Ripple Voltage within 30mV
Operating Temperature Range 0~45°C
Operating Humidity Range 95%rh or less (without dew condensation)
Power consumption 90mA
Storage temperature -30~60°C
Time for stabilization 1 minute after power turned on
Dimensions 59(W) × 45(H) × 22(D) [mm]
Weight 24g(approx.)
Output Method Negative Logic, Digital output,
Hi : over 4.0V(Rev.2) Lo : under 0.7V
(As Input impedance : 200kΩ) OP-Amp output, Pull-up resistor : 10kΩ
The configuration and connector pin allocation are shown in the attached drawing Fig1.
Specification sheet of PPD42NS
03-2010 (Page 1 of 3)
PPaarrttiiccllee SSeennssoorr
Model PPD42NS
Specification
Configuration and connector pin assignment
Rib (inside of housing)
An additional rib structured to inside of housing to hide RH1 lead wire from view. Following components replaced with
equivalent ones; OP-Amp,Volume and Al Electrolytic Cap.
CN : S5B-EH(JST)
1 : COMMON(GND)
2 : OUTPUT(P2)
3 : INPUT(5VDC 90mA)
4 : OUTPUT(P1)
5 : INPUT(T1)・・・FOR THRESHOLD FOR [P2]
Specification sheet of PPD42NS
03-2010 (Page 2 of 3)
Fig. 1
Connector
Hi : 4.0V
LO: 0.7V
PULSE WIDTH = 10ms~90ms
Lo Pulse Occupancy time / unit time (30sec) (%)
Shinyei Corporation of America
24 W 40th street, 4th floor
New York, NY 10018
TEL: 917-484-7884
FAX: 212-704-4206
E-mail : tony.tokuya@sca-shinyei.com
Specification sheet of PPD42NS
03-2010 (Page 3 of 3)
Fig. 2
0%
2%
4%
6%
8%
10%
12%
14%
16%
0 1000 2000 3000 4000 5000 6000 7000 8000
Lo P
uls
e O
ccu
pa
ncy
T
ime
Concentration (pcs/283ml=0.01cf) Particle Size :over 1µm
Smoke(Cigarette)-Output P1 Characteristics
Upper,Lower
Recommended