GP2Y1010AU0F Compact Optical Dust Sensor + Adapter  (GP2Y1010AU0F,DFR0280) [S065]



https://www.youtube.com/watch?v=539hINFrDHM


*GitHub : https://github.com/rdiot/rdiot-s065.git


* Specs

GP2Y1010AU0F is a dust sensor by optical sensing system An infrared emitting diode (IRED) and an phototransistor are diagonally arranged into this device It detects the reflected light of dust in air. Especially, it is effective to detect very fine particle like the cigarette smoke In addition it can distinguish smoke from house dust by pulse pattern of output voltage Compact, thin package (46.0 × 30.0 × 17.6 mm) Low consumption current (Icc: MAX. 20 mA) The presence of dust can be detected by the photometry of only one pulse Enable to distinguish smoke from house dust Lead-free and RoHS directive compliant Compliant with RoHS directive (2002/95/EC)


* Contents

- Refer Source : ttps://github.com/Trefex/arduino-airquality/blob/master/Module_Dust-Sensor/dustSensor/dustSensor.ino


- Connect

:Adapter

A ----- A0

VCC ----- V5

GND ----- GND

 

D ----- D2

VCC ----- X (One of Two)

GND ----- X (One of Two)


: Dust Sensor

1 (V-LED) ---(P150)--- 5V 

2 (LED_GND) --(220uF 1 Number)--- GND 

3 (LED) ----- D12

4 (S-GND) ----- GND

5 (V0) ----- A0

6 (Vcc) ----- 5V 



- Key Code

int measurePin = A0;

int ledPower = 2;

 

int samplingTime = 280;

int deltaTime = 40;

int sleepTime = 9680;

 

float voMeasured = 0;

float calcVoltage = 0;

float dustDensity = 0;

 

int B = 9; // OUTPUT PIN blue

int R = 11; // OUTPUT PIN red

int G = 10; // OUTPUT PIN green

 


void setup()

{

  lcd.init();  // initialize the lcd 

  lcd.backlight();

  lcd.print("start LCD2004");

  pinMode(ledPower,OUTPUT);

  pinMode(R, OUTPUT);

  pinMode(G, OUTPUT);

  pinMode(B, OUTPUT);

 

  delay(1000);

  lcd.clear();

}


void loop()

{

  lcd.setCursor(0,0);

  lcd.print("S065:Dust GP2Y1010AU0F");

 

  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 - 5.0V mapped to 0 - 1023 integer values 

  calcVoltage = voMeasured * (5.0 / 1024); 

  

  dustDensity = (0.17 * calcVoltage - 0.1)*1000; 

  

  lcd.setCursor(0,1);

  lcd.print("Signal=" + (String)voMeasured + " ");

  

  lcd.setCursor(0,2);

  lcd.print("Voltage=" + (String)calcVoltage + " ");

  

  lcd.setCursor(0,3);

  lcd.print("Density=" + (String)dustDensity + "ug/m3 ");

  

  if(dustDensity <= 40)

  {

   // GREEN

   digitalWrite(R, HIGH);

   digitalWrite(G, LOW);

   

  }

  else if(dustDensity <= 80)

  {

   // BLUE

   digitalWrite(G, HIGH);

   digitalWrite(B, LOW);

 

  }

  else if(dustDensity <= 120)

  {

    // RED + GREEN = YELLOW

    digitalWrite(B, HIGH);

    digitalWrite(R, LOW);

    digitalWrite(G, LOW);

  }

  else

  {

    // RED

    digitalWrite(R, LOW);

    digitalWrite(G, HIGH);

    digitalWrite(B, HIGH);   

  }

 

  delay(1000);

 

  // all off

  digitalWrite(B, HIGH);

  digitalWrite(R, HIGH);

  digitalWrite(G, HIGH);

}

Posted by RDIoT
|