Sensor de pó PM2.5 p/ Arduino Keyestudio
Características
Potência elétrica: 5-7V
Temperatura de funcionamento: -10-65 ℃
Consumo: Max 20mA
Valor mínimo de deteção de partículas: 0.8μ
Sensibilidade: 0.5V/(0.1mg/m3)
Tensão da limpeza de ar: 0.9V (habitual)
Temperatura de armazenamento:-20~80℃
Tempo de funcionamento: 5 anos
Tamanho: 62mm × 32mm × 20mm
Project 1: The following are sample codes shown by official; when using it, just make a little change in the codes.
//pressing nothing to display value of analog revolving potentiometer
#include
#include
LiquidCrystal_I2C lcd(0x27,20,4); // set the LCD address to 0x27 for a 16 chars and 2 line display
int measurePin = 0; //Connect dust sensor to Arduino A0 pin
int ledPower = 2; //Connect 3 led driver pins of dust sensor to Arduino D2
int samplingTime = 280;
int deltaTime = 40;
int sleepTime = 9680;
float voMeasured = 0;
float calcVoltage = 0;
float dustDensity = 0;
void setup(){
lcd.init(); // initialize the lcd
lcd.init();
// Print a message to the LCD.
lcd.backlight();
lcd.setCursor(0,0);
lcd.print("Raw Signal Value: ");
lcd.setCursor(0,2);
lcd.print("Voltage:");
lcd.setCursor(0,3);
lcd.print("Dust Density:");
pinMode(ledPower,OUTPUT);
}
void loop(){
digitalWrite(ledPower,LOW); // power on the LED
delayMicroseconds(samplingTime);
voMeasured = analogRead(measurePin); // read the dust value
delayMicroseconds(deltaTime);
digitalWrite(ledPower,HIGH); // turn the LED off
delayMicroseconds(sleepTime);
// 0 - 5V mapped to 0 - 1023 integer values
// recover voltage
calcVoltage = voMeasured * (5.0 / 1024.0);
// linear eqaution taken from http://www.howmuchsnow.com/arduino/airquality/
// Chris Nafis (c) 2012
dustDensity = 0.17 * calcVoltage - 0.1;
lcd.setCursor(1,1);
lcd.print(voMeasured);
lcd.setCursor(9,2);
lcd.print(calcVoltage);
lcd.setCursor(14,3);
lcd.print(dustDensity);
delay(1000);
}
Project 2: Now, use testing codes.
int dustPin=0;
float dustVal=0;
int ledPower=2;
int delayTime=280;
int delayTime2=40;
float offTime=9680;
void setup(){
Serial.begin(9600);
pinMode(ledPower,OUTPUT);
pinMode(dustPin, INPUT);
}
void loop(){
// ledPower is any digital pin on the arduino connected to Pin 2 on the sensor
digitalWrite(ledPower,LOW);
delayMicroseconds(delayTime);
dustVal=analogRead(dustPin);
delayMicroseconds(delayTime2);
digitalWrite(ledPower,HIGH);
delayMicroseconds(offTime);
delay(1000);
if (dustVal>36.455)
Serial.println((float(dustVal/1024)-0.0356)*120000*0.035);
}
Projetos
Abaixo, poderá ver os diagramas de conexão e os resultados de dois projetos diferentes.
Projeto 1
Diagrama de Conexão
Resultado
Projeto 2
Diagrama de Conexão
Resultado