This project is a
dust detector that use the GP2Y1010AU0F sensor.
Attached you can also find the GP2Y1010AU0F sensor library for AVR Atmega.
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.
Unfortunately the datasheet does not tell anything about the particle size detected, it just tell us that this sensor is for fine particle like cigarette smoke, that is to say about 0.5micron.
This sensor output a
pulse-driven wave form that we can read using the ADC of our microcontroller to convert it to usefull data.
Looking at the figure 2 of the GP2Y1010AU0F datasheet we can derive the method to convert the output data.
Note that the sample time should be 280us to perform the correct reading, and this delay should consider that ADC conversion takes 13 ADC clock cycles, so ADCtime(s) = (1/ADCclock)*13 = (1/FCPU/ADCprescaler)*13.
So to perform reading at correct time we have to subtract the time taken by ADC convertion to the suggested time.
As example lets consider a micro running at 8Mhz, with ADC prescaler set to 64
(1/(8000000/64))*13 = 0.000104s = 104us
280us - 104us = 176us
we have to delay 176us and then we can read the sensor output voltage.
Once we have obtained the sampling voltage, we can
convert it to mg/m^3 using the fig 3 of the GP2Y1010AU0F datasheet, that shows the dust density (mg/m^3) related to output voltage of the sensor (V).
Chris Nafis does some interesting consideration on this sensor in his
Air Quality Monitoring page. Also he does linear interpolation and find the graph obtained the slope and the base for the convertion function.
Code
Notes
- read risk disclaimer
- excuse my bad english