You are on page 1of 6

We have decided to utilize a GP2Y1010AU0F dust sensor to measure PM2.5 particle concentration.

The
sensor works optically, using an infrared light (emitted by an infrared emitting diode) reflected off of the
dust or smoke particles to generate an output voltage which correlates linearly to particle concentration
up to approximately 0,5mg/m3 which is far more than we will (hopefully) measure, since that
concentration is associated with very serious pollution. The system setup is very simple, is it directly
connected to an Arduino board and uses a small amount of code to integrate with it and transform the
voltage measured to actual concentrations and outputting them as text to whatever output the Arduino
system is connected to. In our case, we will use the Arduino boards along with a GSM router to establish
an uplink with a dedicated server in order to receive and process the information from the whole
network, looking for patterns and trends in pollution and verifying the effectiveness of our project.

Links to sensor information:

Sensor manual: https://www.waveshare.com/w/upload/0/0a/Dust-Sensor-User-Manual-EN.pdf

Sensor code: https://www.waveshare.com/wiki/File:Dust-Sensor-code.7z

The code used is the following:

/************************************************************************************
*********************

* File : DustSensor

* Hardware Environment:

* Build Environment : Arduino

* Version : V1.0.5-r2

* By : WaveShare

* (c) Copyright 2005-2011, WaveShare

* http://www.waveshare.net

* http://www.waveshare.com

* All Rights Reserved

*************************************************************************************
********************/

#define COV_RATIO 0.2 //ug/mmm / mv


#define NO_DUST_VOLTAGE 400 //mv

#define SYS_VOLTAGE 5000

/*

I/O define

*/

const int iled = 7; //drive the led of sensor

const int vout = 0; //analog input

/*

variable

*/

float density, voltage;

int adcvalue;

/*

private function

*/

int Filter(int m)

static int flag_first = 0, _buff[10], sum;

const int _buff_max = 10;

int i;

if(flag_first == 0)

flag_first = 1;
for(i = 0, sum = 0; i < _buff_max; i++)

_buff[i] = m;

sum += _buff[i];

return m;

else

sum -= _buff[0];

for(i = 0; i < (_buff_max - 1); i++)

_buff[i] = _buff[i + 1];

_buff[9] = m;

sum += _buff[9];

i = sum / 10.0;

return i;

void setup(void)

pinMode(iled, OUTPUT);

digitalWrite(iled, LOW); //iled default closed

Serial.begin(9600); //send and receive at 9600 baud


Serial.print("*********************************** WaveShare
***********************************\n");

void loop(void)

/*

get adcvalue

*/

digitalWrite(iled, HIGH);

delayMicroseconds(280);

adcvalue = analogRead(vout);

digitalWrite(iled, LOW);

adcvalue = Filter(adcvalue);

/*

covert voltage (mv)

*/

voltage = (SYS_VOLTAGE / 1024.0) * adcvalue * 11;

/*

voltage to density

*/

if(voltage >= NO_DUST_VOLTAGE)

voltage -= NO_DUST_VOLTAGE;

density = voltage * COV_RATIO;


}

else

density = 0;

/*

display the result

*/

Serial.print("The current dust concentration is: ");

Serial.print(density);

Serial.print(" ug/m3\n");

delay(1000);

You might also like