First Sketch

Post date: Nov 03, 2015 3:25:36 AM

I first want to make a small sketch on my breadboard to check how this Sharp dust sensor work and to display the data on my PC via serial monitor or processing.

Check attached pdf file for the Sharp GP2Y1010AU dust sensor datasheet.

Diagram from the datasheet:

Output Voltage / Dust density graph (from sharp “GP2Y1010AU0F datasheet)

How to measure and calculate the dust density:

In order to be able to achieve any output reading from the sensor, the sensor LED must be driven with the following pulse.

The Output voltage of the sensor must be read 0.28ms after the start of the pulse.

The following come from the Sharp dust sensor datasheet:

"The output voltage Vo of this sensor is the sum of output voltage at no dust Voc and output proportional to dust density ΔV. Output proportional to dust density ΔV is shown as follows. ΔV = Vo - Voc (Vo : monitor value) ・Output voltage at no dust Voc is caused by the stray light occurring in this sensor. This sensor makes Voc voltage even at dust density 0mg/m3 . If dust attached within this sensor increases, Voc becomes bigger. On the other hand, if dust attached within this sensor decreases, Voc becomes smaller.

To store Voc in the memory of application is necessary to calculate ΔV from monitor value Vo. If monitor value Vo lower than the memorized Voc appears, this monitor value Vo should be stored in the memory of application as a new Voc.

If monitor value Vo maintains a bigger value than the memorized Voc for a certain period of time, this monitor value Vo should be stored in the memory of application as a new Voc."

Hmm Hmmm..... That's going to be a problem...

That's mean that the sensor is going to give accurately the difference of dust density ΔV from from the Voc reference which can be variable according to the stray light occurring in this sensor.

in other word, the sensor is going to give the dust density from an ambient dust density which is assume to be the no dust value and not the real no dust value.

And in top of that i don't have any reference reading to kind of calibrate the sensor.

Anyway, let plug everything together and start some coding to check what's happen.

Components:

  • Sharp GP2Y1010AU

  • 220uF capacitor

  • 150 Ohm 1/4w resistor

  • arduino uno

  • Breadboard

Schematic:

Breadboard:

Code:

/*

Standalone Sketch to use with a Arduino uno and a

Sharp Optical Dust Sensor GP2Y1010AU0F

*/

int measurePin = 0;

int ledPower = 2;

int samplingTime = 280;

int deltaTime = 40;

int sleepTime = 9680;

float voMeasured = 0;

float calcVoltage = 0;

float dustDensity = 0;

void setup(){

Serial.begin(9600);

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 / 1024);

// linear eqaution taken from http://www.howmuchsnow.com/arduino/airquality/

// Chris Nafis (c) 2012

dustDensity = 0.17 * calcVoltage - 0.1;

Serial.print("Raw Signal Value (0-1023): ");

Serial.print(voMeasured);

Serial.print(" - Voltage: ");

Serial.print(calcVoltage);

Serial.print(" - Dust Density: ");

Serial.println(dustDensity);

delay(1000);

}

I collect the serial printed data in a txt file that i have imported in excel to draw a graph ΔV/Sample and Dust Density / Sample

I chose the VOC according to the Data sheet at Voc=0.76V This is Voc is totally arbitrary and depend on my sensor an the local conditions. The graph will help me to determine a proper VOC value for my sensor in my environment.

From the data and the graph i can calculate the Voc value of my sensor. New Voc= 0.53 V

After setting the new Voc variable in the code i obtain the following graph:

Conclusion:

The sensor is very sensitive to dust and smoke and the measured range of dust density is from 10μg/m3 to 500μg/m3

I do a useless 500ms pause in between sample. i will remove it for the next code and make an average of 100 samples.

I will remove as well all the negative values.

The sensor got some erratic reading that will be remove by making an average of the read value. i'm interesting in the trend of the dust density and not by an instant reading on it.

Now it's time to develop my outdoor dust density sensor.

Project Description <<<<Previous-------- Next>>>>>> Outdoor dust density sensor