Arduino Powered Pollution Sensor System

by jjamwal in Circuits > Arduino

360 Views, 0 Favorites, 0 Comments

Arduino Powered Pollution Sensor System

Adruino-pollution-sensor-project.jpg

This project uses two different sensors, a simple MQ135 and a Sharp GP2Y1010. Data sheets are easily available on internet, but for quick reading here are short descriptions:

BASICS:

1. POWER SUPPLY: As of now, Adruino is powered by a USB cable connected to PC. I also have a 9V compatible power supply which can be used once it’s disconnected from PC. I have a old powered USB hub which I plan to use in order to supply a 5V supply later to some components which will be added later. This may be necessary as some components seem to require a bit more power than what is good for accurate readings.

2. ADRUINO : A basic Adruino Uno board.

3. BASE: As of now, I am using breadboard for prototyping stage. If everything goes well, I may rebuild it in a more permanent way.

4. OUTPUT: All the output is being sent to Serial Monitor of Arduino programming interface. A LCD screen and an internet server interface will be added later.

Sharp GP2Y1010 Configuration

  • Pin 1 – Connected to +ve of 220 microF capacitor. -ve of capacitor connected to ground.
  • A 150 Ohm resistor connected to 5 V.
  • Pin 2 – Connected to -ve of capacitor
  • Pin 3 – Connected to D11 on Adruino
  • Pin 4 – Connected to ground.Pin 5 – Connected to A0 on Adruino
  • Pin 6 – Connected to 5V

MQ135 Pollution Sensor Configuration

  • Vcc – To 5 V
  • GND – To Ground
  • A – To A1
  • D – Not connected

Supplies

MQ135: It is a simple sensor used to measure presence of some common pollutants like NH3, NOx, Alcohol, Benzene, Smoke, CO2. It has 4 pins, two for power supply and 2 for analog and digital readings.

Sharp GP2Y1010: is an optical dust sensor which measures the volume of suspended dust particles in air by using a LED and phototransistor. It has 6 pins.

CODE & OUTPUT

MQ135 sesnor.jpg
Sharp GP2Y1010  sesnor.jpg

Sharp GP2Y1010 Code

<p>int measurePin = 0; // Connected to pin 3<br>int ledPower = 11;  // Connected to pin 5<br> <br>int samplingTime = 280;<br>int deltaTime = 40;<br>int sleepTime = 9680;<br> <br>float voMeasured = 0;<br>float calcVoltage = 0;<br>float dustDensity = 0;<br> <br>void setup(){<br>  Serial.begin(9600);<br>  pinMode(ledPower,OUTPUT);<br>}<br> <br>void loop(){<br>  digitalWrite(ledPower,LOW); // power on the LED<br>  delayMicroseconds(samplingTime);<br> <br>  voMeasured = analogRead(measurePin); // read the dust value<br> <br>  delayMicroseconds(deltaTime);<br>  digitalWrite(ledPower,HIGH); // turn the LED off<br>  delayMicroseconds(sleepTime);<br> <br>  // 0 – 5V mapped to 0 – 1023 integer values<br>  // recover voltage<br>  calcVoltage = voMeasured * (5.0 / 1024);<br> <br>  // linear eqaution taken from <a href="http://www.howmuchsnow.com/arduino/airquality/" rel="nofollow">http://www.howmuchsnow.com/arduino/airquality/</a><br>  dustDensity = 0.17 * calcVoltage – 0.1;<br> <br>  Serial.print(“Raw Signal Value (0-1023): “);<br>  Serial.print(voMeasured);<br> <br>  Serial.print(” – Voltage: “);<br>  Serial.print(calcVoltage);<br> <br>  Serial.print(” – Dust Density: “);<br>  Serial.println(dustDensity);<br> <br>  delay(1000);<br>}</p><br>

Sharp GP2Y1010 Output

NORMAL

  • 20:41:58.934 -> Raw Signal Value (0-1023): 180.00 – Voltage: 0.88 – Dust Density: 0.05
  • 20:41:59.950 -> Raw Signal Value (0-1023): 190.00 – Voltage: 0.93 – Dust Density: 0.06
  • 20:42:00.967 -> Raw Signal Value (0-1023): 175.00 – Voltage: 0.85 – Dust Density: 0.05
  • 20:42:01.981 -> Raw Signal Value (0-1023): 182.00 – Voltage: 0.89 – Dust Density: 0.05
  • 20:42:02.996 -> Raw Signal Value (0-1023): 175.00 – Voltage: 0.85 – Dust Density: 0.05


As the voltage level fluctuates the dust density readings change accordingly. I burnt a small piece of paper to see if readings change and they did.

To get maximum values, I inserted a piece of rolled paper to block the sensor. Voltage readings jump to their maximum value, 3.69 volts and output dust reading is 0.53 at it’s maximum corresponding value.

  • 20:43:33.582 -> Raw Signal Value (0-1023): 755.00 – Voltage: 3.69 – Dust Density: 0.53
  • 20:43:34.598 -> Raw Signal Value (0-1023): 756.00 – Voltage: 3.69 – Dust Density: 0.53
  • 20:43:35.645 -> Raw Signal Value (0-1023): 755.00 – Voltage: 3.69 – Dust Density: 0.53
  • 20:43:36.659 -> Raw Signal Value (0-1023): 755.00 – Voltage: 3.69 – Dust Density: 0.53

MQ135 CODE

int sensorValue;<br>int digitalValue;<br>void setup()<br>{<br><br>Serial.begin(9600); // sets the serial port to 9600<br>}<br>void loop()<br>{<br>sensorValue = analogRead(1); // read analog input pin 1<br>Serial.println(sensorValue, DEC); // prints the value read<br>Serial.println(digitalValue, DEC);<br>delay(1000); // wait 100ms for next reading<br>}<br>

RESULTS:
By themselves, both sensors work fine. The readings seem to be consistent with environmental conditions and change with changing level of pollutants like smoke.

TO BE DONE:

Attach a LCD screen and output the reading directly to it without use of PC.Adding and configuring a WiFi module to upload data to an online monitoring application.

PROBLEMS TO BE SOLVED:

  1. There is a noticeable change in readings if both sensors are used at same time. Adruino doesn’t seem to be able to supply same amount of voltage to multiple components. It will affect readings adversely when more components like LCD screen are added. Perhaps use of a separate power source, like a powered USB hub supplying 5 V will help.
  2. I don’t know of any way to properly calibrate the sensors. These are just the raw readings and may not be entirely accurate. I have not figured out a way to address this issue yet.

LINK: http://jjamwal.in/yayavar/adruino-project-pollution-sensor-system-initial-setup/

NOTE: I didn't write all the code, just copied it from other projects and modified it a bit to suit my needs. Images of sensors are not mine