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
- avr_dustmeter01.zip (complete project)
- avr_lib_gp2y1010au0f_01.zip (sensor library with sample)
Notes
- read risk disclaimer
- excuse my bad english
Excellent! Thank you for sharing!
ReplyDeleteHello Davide, cool job! My name is Trent. I am installing the same sensor for my project. I have no idea where 'LED' terminal goes (I cannot find it in the manual). My project kinda stuck at the stage. Can you please tell me what is 'PB0-ICP' and where it goes? Thank you :)
ReplyDeletehello,
Deletelook at the image posted above (the one with the sensor with numbers on plug, you can see pin from 1 to 6)
then look at the schmatics image, you can find the same pin numbers for wiring it to sensor. so PB0 goest to pin3 of sensor.
Hey there. I want to buy this sensor but I have some questions and I was wondering if you could help me. First of all I would like to know what is the lowest sensitivity this sensor has. Is it some ugr/m3 or is it mgr/m3?
ReplyDeleteSecondly, I saw that you are measuring ugr/m3!!! Is this measurement real???Can this sensor measure this low? How did you calibrated it?
It would be great if you could answer me these things above.
Kind regards,
Tony
hello,
Deletein sensor datasheet, you should find a "Output Voltage vs. Dust Density" figure, you can use this to estimate mg/m^3.
If you want to calibrate this sensor (or any sensor) you must have a calibrated information too, then correlate the information you get from the sensor you would like to calibrate with the calibrated data, Chris Nafis does this consideration, read his article.
Datasheet does not states nothing about the lowest sensitivity, it just tell us "Output voltage at no dust", you should correlate this with "Output Voltage vs. Dust Density" figure to obtain the lowest sensitivity, unfortunatelly they tell us voltage at no dust can vary from 0v to 1.5v, that is to say from 0mg/m^3 to ~1.6mg/m^3.
And how did you calibrated it?
Deleteno, unfortunatelly i does not have any calibration source, any calibrated dust meter.
DeleteOk. One last question. How much off from reality would you be assuming that you are using the datasheet that shows that Output Voltage vs. Dust Density graph to get some measurements?
Deletehaving nothing to refer to, i do not know, Chris show us this sensor does pretty good metering, but you can not expect this to be precise more than +-10ug/m^3, imho.
DeleteThank you very much.
DeleteYou can check my blog http://hedproject.wordpress.com/
I'll come back with an air quality project too.
Thanx again
Tony
i will check it!
Deletegood work!
hello mr.davide, can i ask sourcecode for basic compiler.?
ReplyDeletehello, my code it's for avrgcc compiler, but you can easly rewrite it for a basic compiler.
DeleteHello Davide Sir,
ReplyDeleteKindly let me know how to test that value coming on LCD is right and sensor is working fine without using a fan???
Thanks !!!!
Hello, you have to test against a calibrated device. You can also search for your local area PM value, which maybe some state entity release for free.
DeleteIt is better to use a fan to get vehiculated air, but the sensor even work without it.
Hi. Where can I find the eagle library for this dust sensor?
ReplyDeleteHello, I've just use a pin header, haven't found any eagle library.
DeleteSalve,
ReplyDeleteper un progetto scolastico sto usando questo sensore con Arduino.
Sono partito da uno sketch che si trova in rete, sto utilizzando il sensore in montagna all'esterno e in uscita ho dei valori che mi sembrano elevati (80/90 μg/cm^3).
I valori che escono da questo sensore si riferiscono a quale tipo, PM10,PM 2.5 o altro??
Daniele
Ciao, purtroppo il datasheet non specifica l'intervallo di valore letto da questo sensore. Tuttavia, la correlazione eseguita da Chris Nafis sembrerebbe dimostrare che questo sensore le lettura sono correlabili a quelle seguite con un Dylos DC1100 Pro impostato in Small Count Reading, ossia > 0.5 micron (ref. http://www.howmuchsnow.com/arduino/airquality/)
Deletehello,I just want to know if I will be able to interface the dust sensor with atmega128 or atmega16u2..which is better?
ReplyDeleteHello, both are the same. ATmega family is pretty similar, you can port code easly.
DeleteI can't solve this: #error "no definitions available for this AVR"
ReplyDeleteHello, you are using a not supported AVR. It may be supported but not tested or listed. You have to try and check where and if register changes by the one used in the library.
Delete