You are on page 1of 21

A

PROJECT REPORT ON

“Air Quality Monitoring System”

Submitted by`
Omkar Vinchurkar (2018BIN032)

Rupesh Malu (2018BIN151)

Nilesh Nagalwar(2018BIN006)

FINAL YEAR (B.TECH)

UNDER THE GUIDANCE OF


Dr. V. G. Asutkar

Associate Professor

Year 2021-2022
Semester-1
Table of Content:

Sr.no. Content Page No


1 Certificate 3
2 Acknowledgement 4
3 Abstract 5
4 Components 5
5 Arduino Uno R3 development Board 6
6 MQ135 gas sensor module 7
7 MQ-7 gas Sensor module 8
8 DHT22 Temperature and humidity sensor 9
9 ESP-01 WiFi Module 10
10 Basic Circuit Diagram 11
11 Flowchart 12
12 Working 12
13 Arduino Program 13
14 Program Description 18
15 Future Work 19
16 Conclusion 20
17 References 20
CERTIFICATE

This is to certify that the project entitled “Air Quality Monitoring System” in the partial
fulfilment of the “Project- I, B. Tech” for Shri Guru Gobind Singhji Institute of Engineering and
Technology, Vishnupuri, Nanded. This Bonafide work carried and completed under guidance
and supervision of our guide Dr. V. G. Asutkar during academic schedule 2021-2022.

Submitted by:

Omkar Vinchurkar
Rupesh Malu
Nilesh Nagalwar

Dr. V. G. Asutkar Dr.Rajarshree Sarwadnya


Project Guide Head of
Instrumentation Engineering
ACKNOWLEDGMENT

We express our sincere gratitude to Dr.V. G. Asutkar, Associate Professor and guide of the project, for their
stimulating guidance, continuous encouragement, and supervision throughout the present work. We are
very thankful to Dr.R.S.Sarwadnya, Head of Instrumentation Engineering Department, for their guidance
and support. Lastly, we would like to thank all our friends and faculty whose encouragement and
suggestion helped us to complete our project. We are also thankful to all, who have contributed directly or
indirectly to the completion of the project.
Thank You!
Abstract:

This project deals with measuring Air Quality using MQ135 sensor along with Carbon Monoxide CO
using MQ7 sensor. Measuring Air Quality is an important element for bringing a lot of awareness in the
people to take care of the future generations a healthier life. Based on this, the Government of India has
already taken certain measures to ban ‘Single Stroke’ and ‘Two Stroke’ Engine based motorcycles which
are emitting high pollution comparatively. We are trying to implement the same system using IoT
platforms like Thingspeak, we can bring awareness to every individual about the harm we are doing to our
environment. Already, New Delhi is remarked as the most polluted city in the world recording Air Quality
above 300 PPM. We have used the easiest platform like Thingspeak and set the dashboard to the public
such that everyone can come to know the Air Quality at the location where the system is installed. Also, we
have made a project which is cost e ective.
It introduces aspects of instrumentation, computer, mechanical and electronics engineering, including
following primary areas:

1. Sensor Application
2. Hardware Applications
3. Software Application
4. Electronics Equipment Application
5. Arduino Programming
6. Presentation Skills
7. Project Planning

Components:
• Arduino Uno R3
• DHT22 Temperature and Humidity Sensor Module
• MQ135 Air Quality Gas Sensor
• MQ7 Gas Sensor Module for Carbon Monoxide
• ESP-01 WiFi Module
• LCD Display 16X2
• 10 ohm potentiometer
Arduino Uno R3 Development Board
• The Arduino Uno is an open-source microcontroller board based on the
Microchip ATmega328P microcontroller.
• The board is equipped with sets of digital and analog input/output (I/O) pins that may
be interfaced to various expansion boards (shields) and other circuits. The board has 14
digital I/O pins (six capable of PWM output), 6 analog I/O pins, and is programmable
with the Arduino IDE (Integrated Development Environment), via a type B USB cable.
•  It can be powered by the USB cable or by an external 9-volt battery, though it accepts
voltages between 7 and 20 volts. It is similar to the Arduino Nano and Leonardo. 

Arduino Uno R3 Development Board

OTHER SPECS:

● Arduino Uno R3 is microcontroller based on ATmega328


● Clock Speed -16Mhz
● EEPROM - 1KB(ATmega328)
● Flash Memory - 32KB
● Input Voltage - 7-12v
MQ-135 Air Quality Gas Sensor Module
• The gas sensor module consists of a steel exoskeleton under which a sensing element
is housed. This sensing element is subjected to current through connecting leads. This
current is known as heating current through it, the gases coming close to the sensing
element get ionized and are absorbed by the sensing element. This changes the
resistance of the sensing element which alters the value of the current going out of it.
• The MQ-135 Gas sensor can detect gases like Ammonia (NH3), sulfur (S), Benzene
(C6H6), CO2, and other harmful gases and smoke.

OTHER SPECS:

● OPERATING VOLTAGE : 2.5 - 5V


● DETECTING RANGES: ALCOHOL :10 -300ppm
BENZENE: 10 - 1000ppm
NH3: 10 - 300ppm
● ADJUSTABLE SENSITIVITY
● SIGNAL OUTPUT DETECTOR
MQ-7 Gas Sensor Module

• MQ-7 CO Carbon Monoxide Coal Gas Sensor Module detects the concentrations of CO in
the air and outputs its reading as an analog voltage. The sensor can measure
concentrations of 10 to 10,000 ppm.
• The sensor can operate at temperatures from -10 to 50°C and consumes less than
150 mA at 5 V.
• This module provides both digital and analog outputs. The threshold level for digital
output can be easily adjusted using the preset on the board. The MQ-7 sensor module
can be easily interfaced with Micro-controllers, Arduino etc.

MQ-7 Gas Sensor Module

OTHER SPECS:
● OPERATING VOLTAGE: 5V
● RANGE: CO: 10 -1000ppm
● SENSITIVITY: 3%
● HEATING RESISTANCE: 31 ohm
DHT22 Temperature and Humidity Sensor

• The DHT22 is a low-cost digital temperature and humidity sensor with a single wire
digital interface. It uses a capacitive humidity sensor and a thermistor to measure the
surrounding air and spits out a digital signal on the data pin (no analog input pins
needed).
• The sensor is calibrated and doesn’t require extra components so you can get the right
to measure relative humidity and temperature.
• It is quite simple to use but requires careful timing to grab data. You can only get new
data from it once every 2 seconds

DHT22 Temperature and Humidity Sensor

OTHER SPECS:
● OPERATING VOLTAGE : 3.5 -5V
● OUTPUT CURRENT: 0.3mA
● TEMP. RANGE: -40°C to 80°
● HUMIDITY RANGE :0% - 100%
● ±
ACCURACY: 5 ℃ & 1%
ESP8266-01 WiFi Transceiver Module

● ESP8266 has powerful onboard processing and storage capabilities allowing it to


integrate with sensors and other devices through GPIOs with minimal development
up-front and minimal loading during runtime.
● This module is a WiFi serial transceiver module, based on ESP8266 SoC with an
integrated TCP/IP protocol stack. As a TTL ‘Serial to Wireless Internet’ device, this
module easily interfaces with typical microcontrollers (MCU) to communicate via
TTL serial to instantly add Wi-Fi connectivity. It runs o 3.3V, and can draw almost
500mA of current for up to a really impressive +19.5dBm output power in 802.11b
mode! That gives this module a range over a hundred meters!

ESP8266-01 WiFi Transceiver Module

OTHERS SPECS:

● OPERATING VOLTAGE : 3.3V


● A SELF-CONTAINED SOC WITH INTEGRATED TCP/IP PROTOCOL STACK THAT CAN GIVE
ANY MICROCONTROLLER ACCESS TO YOUR WIFI NETWORK
● 1MB FLASH SIZE
● VERY SIMPLE AT COMMAND EASY TO USE.

.
Basic Circuit Diagram:

Circuit Diagram
Flow-Chart:
The flowchart for the AIR POLLUTION MONITORING is as shown in Figure 2.

Figure 2

Working:

● AS YOU START THE PROGRAM FIRSTLY THE ESP MODULE SEARCHING FOR THE
INTERNET NETWORK AS IT FIND THE NETWORK IS SEND THE AT COMMAND AND AFTER
RECEIVING OK COMMAND RECEIVED IT SET AS CLIENT THEN IT CONNECTED TO THE
NETWORK.

● AFTER SETTING UP THE NETWORK THE SENSOR STARTED DETECTING AIR QUALITY AND
TEMP , HUMIDITY.
● MQ135 GAS SENSOR DETECTS THE AIR QUALITY THAT IS GASES PRESENT IN AIR
WHICH INCLUDES NH3, BENZENE,ALCOHOLS ETC. AFTER DETECTING THE GASES THE
RESISTANCE CHANGES AND AND SENSOR GIVES THE OUTPUT.

● MQ7 GAS SENSOR DETECTED THE CARBON MONOXIDE GAS IN AIR & IT’S RESISTANCE
CHANGES AND SENSOR GIVE THE OUTPUT .

● DHT22 DETECTED TEMP & HUMIDITY IN DHT THERE IS NTC TYPE THERMISTOR
PRESENT WHOSE RESISTANCE DECREASES WITH INCREASING THE TEMP. FOR
HUMIDITY THE HUMIDITY SENSING ELEMENT SENSES THE HUMIDITY AND IT’S
CAPACITANCE CHANGES AND WE GET THE OUTPUT .

● AFTER COLLECTING ALL THE DATA THE ESP MODULE CONNECTED WITH THE THING
SPEAKS SERVER AND SEND THE ALL THE COLLECTED DATA TO THE SERVER .

● ON THINGSPEAK WE SEE ALL THE REAL TIME DATA IN GRAPHICAL MANNER WE CAN
STORE THIS DATA ALSO .

● IT TAKES 15 SECONDS TO SEND THE NEXT DATA TO THINGSPEAK SERVER.

● AFTER SENDING THE DATA IT CLOSES THE CONNECTION AND AGAIN AFTER COLLECTING
THE DATA FROM SENSOR ESP MODULE ESTABLISHED THE CONNECTION WITH
THINGSPEAK

ARDUINO PROGRAM:
#include <dht11.h>
#include "DHT.h"
#include <SoftwareSerial.h>
#define dhttype DHT22
#include <LiquidCrystal.h>
const int rs = 12, en = 11, d4 = 7, d5 = 8, d6 = 9, d7 =10;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
int gas_sensor = A2; //Sensor pin
float m = -0.3376; //Slope
float b = 0.7165; //Y-Intercept
float R0 = 2.82; //Sensor Resistance in fresh air from previous code
int CO_sensor = A3; //Sensor pin
float m1 = -0.6527; //Slope
float b1 = 1.30; //Y-Intercept
float R01 = 7.22; //Sensor Resistance
String agAdi = "honor"; // We write the name of our network here.
String agSifresi = "123456789";// We write the password of our network here.
int rxPin = 2; //ESP8266 RX pini
int txPin = 3; //ESP8266 TX pini
int dht11Pin = 5;
String ip = "184.106.153.149"; //Thingspeak ip adresi
float sicaklik, nem,hif,hic,f,ppm,ppml;
//dht11 DHT22;
DHT dht(dht11Pin,dhttype);
SoftwareSerial esp(rxPin, txPin);

void setup() {
{ lcd.begin(16, 1);
// Print a message to the LCD.
lcd.print("-----AQI-----");

Serial.begin(9600); // We are starting our communication with the serial port.


Serial.println("Started");
esp.begin(115200); // We are starting serial communication with ESP8266.
esp.println("AT"); // We do the module control with the AT command.
Serial.println("AT sent ");
while(!esp.find("OK")){ // We wait until the module is ready.
esp.println("AT");
Serial.println("ESP8266 Not Find.");
}
Serial.println("OK Command Received");
esp.println("AT+CWMODE=1"); // We set the ESP8266 module as a client.
while(!esp.find("OK")){ // We wait until the setting is done.
esp.println("AT+CWMODE=1");
Serial.println("Setting is ....");
}
Serial.println("Set as client");
Serial.println("Connecting to the Network ...");
esp.println("AT+CWJAP=\""+agAdi+"\",\""+agSifresi+"\""); // We are connecting to our network.
while(!esp.find("OK")); // We wait until it is connected to the network.
Serial.println("connected to the network.");
delay(1000);
}

// Serial.begin(9600);
Serial.println(F("DHTxx test!"));
Serial.begin(9600); // PC to Arduino Serial Monitor
// Serial.begin(115200); // Arduino to ESP01 Communication
// pinMode(gas_sensor, INPUT);
// pinMode(CO_sensor,INPUT);
// pinMode(A2,INPUT); //For dht Sensor
dht.begin();
lcd.begin(16, 2);
// Print a message to the LCD.
// lcd.print(" AIR POLLUTION MONITORING ");

}
void loop(){
{

delay(2000);
esp.println("AT+CIPSTART=\"TCP\",\""+ip+"\",80"); // We connect to Thingspeak.
if(esp.find("Error")){ // We check the connection error.
Serial.println("AT+CIPSTART Error");
}

float sicaklik = dht.readTemperature();


// Read temperature as Celsius (the default)
float nem = dht.readHumidity();
float f = dht.readTemperature(true);
float hif = dht.computeHeatIndex(f, nem);
// Compute heat index in Celsius (isFahreheit = false)
float hic = dht.computeHeatIndex(sicaklik, nem, false);
lcd.setCursor(0,0); // Sets the location at which subsequent text written to the LCD will be displayed
lcd.print("Temp.: "); // Prints string "Temp." on the LCD
lcd.print(sicaklik); // Prints the temperature value from the sensor
lcd.print(" C");
lcd.setCursor(0,1);
lcd.print("Humi.: ");
lcd.print(nem);
lcd.print(" %");
delay(2000);

float sensor_volt; //Define variable for sensor voltage


float RS_gas; //Define variable for sensor resistance
float ratio; //Define variable for ratio
float sensorValue = analogRead(gas_sensor); //Read analog values of sensor
sensor_volt = sensorValue*(5.0/1023.0); //Convert analog values to voltage
RS_gas = ((5.0*10.0)/sensor_volt)-10.0; //Get value of RS in a gas
ratio = RS_gas/R0; // Get ratio RS_gas/RS_air
double ppm_log = (log10(ratio)-b)/m; //Get ppm value in linear scale according to the the ratio value
double ppm = pow(10, ppm_log); //Convert ppm value to log scale
Serial.print("MQ135 PPM = ");
Serial.println(ppm);

float sensor_volt1; //Define variable for sensor voltage


float RS_gas1; //Define variable for sensor resistance
float ratio1; //Define variable for ratio
float sensorValue1 = analogRead(CO_sensor); //Read analog values of sensor
sensor_volt1 = sensorValue1*(5.0/1023.0); //Convert analog values to voltage
RS_gas1 = ((5.0*10.0)/sensor_volt1)-10.0; //Get value of RS in a gas
ratio1 = RS_gas1/R01; // Get ratio RS_gas/RS_air
double ppm_log1 = (log10(ratio1)-b1)/m1; //Get ppm value in linear scale according to the the ratio value
double ppm1 = pow(10, ppm_log1); //Convert ppm value to log scale
Serial.print("CO PPM = ");
Serial.println(ppm1);

Serial.print(F("Humidity: "));
Serial.print(nem);
Serial.print(F(" Temperature: "));
Serial.print(sicaklik);
Serial.print(F("°C "));
Serial.print(f);
Serial.print(F("°F Heat index: "));
Serial.print(hic);
Serial.print(F("°C "));
Serial.print(hif);
Serial.println(F("°F"));

// thingspeak communication
String veri = "GET https://api.thingspeak.com/update?api_key=NH9PJBNW0O563CGG"; // Thingspeak command. We write
our own api key in the key part.
veri += "&field1=";
veri += float(sicaklik);// The temperature variable we will send
veri += "&field2=";
veri += float(nem);// The moisture variable we will send
veri += "&field3=";
veri += float(ppm);
veri += "&field4=";
veri += float(ppm1);
veri += "\r\n\r\n";
esp.print("AT+CIPSEND="); // We give the length of data that we will send to ESP.
esp.println(veri.length()+2);
delay(2000);
if(esp.find(">")){ // The commands in it are running when ESP8266 is ready..
esp.print(veri); // We send the data.
Serial.println(veri);
Serial.println("Data sent.");
delay(1000);

Serial.println("Connection Closed.");
esp.println("AT+CIPCLOSE"); // we close the link
delay(1000); // We wait 1 minute for sending new data.
// lcd.clear();} }
Program Description:

● IN OUR PROJECT AS WE USE DIFFERENT TYPE OF SENSORS INCLUDE DHT22&


MQSERIES SENSOR ND WE ALSO USE THE ESP MODULE FOR COMMUNICATION SO IN
PROGRAM WE HAVE TO INCLUDE PARTICULAR SUITABLE LIBRARY .
● FOR DHT MODULE WE USE DHT SENSOR LIBRARY AND FOR ESP WE USE ESP LIBRARY.
● IN THE PROGRAM WE INCLUDE THE SoftwareSerial.h LIBRARY FOR COMMUNICATION
VIA ESP AND LiquidCrystal.h LIBRARY FOR LCD DISPLAY .
● HERE WE DEFINE THE ANALOG PINS TO THE SENSORS AND RESET, ENABLE,DIGITAL PINS
TO THE LCD AND RX,TX PINS FOR ESP MODULES., WE DEFINE DIGITAL PIN FOR DHT
SENSOR.
● AS WE CONNECTING THE ESP WE HAVE TO DEFINE THE NETWORK SO WE INCLUDE THE
NAME OF NETWORK AVAILABLE AND SSID OF THAT NETWORK.
● IN VOID SETUP WE SETUP THE CONNECTION OF ESP MODULE TO THE NETWORK BY
SEND THE AT COMMAND AND THEN RECEIVING THE OK COMMAND THE ESP MODULE
CONNECTED TO THE NETWORK. AND WE SET IT AS A CLIENT.
● IN VOID LOOP WE STARTED WITH THE EXECUTION OF THE SENSORS FUNCTION
● HERE WE INITIALIZE THE SENSORS FUNCTION FOR DHT MODULE AND FOR MQ SERIES
SENSOR WE CALCULATE IT BY FORMULAE I.E WE TAKE THE OUTPUT DATA FOR SENSOR
THEN CALCULATING PPM VALUES BY THE FORMULA TO PROPERLY GET CALIBRATE.
● AS WE HAVE TO SEND ALL THE DATA TO THE SERVER WE HAVE TO SETUP THE SERVER
ADDRESS.
● HERE WE USE EASIEST OPTIONS AVAILABLE THINGSPEAK SERVER WE INCLUDE THE
SERVER ADDRESS OF AND API KEY FOR THAT .
● IN PROGRAM WE INCLUDE THE FIELD THE FIELDS FOR EACH SENSOR TO DISPLAY THE
DATA ON THE THINGSPEAK
● AFTER SEND THE DATA TO THE THINGSPEAK THE CONNECTION GET CLOSED
● AFTER EACH 15 SECONDS THE ESP SENDS THE DATA TO THE THINGSPEAK.
RESULTS:
FUTURE WORK:

● USING PARTICULATE SENSOR


(OPTICAL AIR QUALITY SENSOR)

● MQ SERIES GAS SENSOR FOR SPECIFIC GASES


● MQ-2 - Methane, Butane, LPG, smoke
● MQ-3 - Alcohol, Ethanol, smoke
● MQ-4 - Methane, CNG Gas
● MQ-5 - Natural gas, LPG
● MQ-6 - LPG, butane gas
● MQ-8 - Hydrogen Gas
● MQ-9 - Carbon Monoxide, flammable gasses
● MQ131 - Ozone
● MQ136 - Hydrogen Sulfide gas
● MQ137 - Ammonia
● MQ138 - Benzene, Toluene, Alcohol, Acetone, Propane, Formaldehyde
gas, Hydrogen
● MQ214 - Methane, Natural gas
● THINGSPEAK HAVE LIMITATION THAT IT REQUIRE 15 SECOND TO PUSH VALUE .SO WE
CAN USE ANOTHER IOT PLATFORM CAYENNE WHICH IS VERY FAST AND COMES WITH
ANDROID/IOS APPLICATION. WORK WITH NODEMCU WHICH ALSO REDUCES THE COST.
Conclusion:
From all the above information provided, we are able to calculate AirQuality in
PPM. The problem with MQ135 sensor is that specifically it can’t tell the Carbon Monoxide or
Carbon Dioxide level in the atmosphere, but the pros of MQ135 is that it is able to detect
smoke, CO, CO2, NH4. So, just to tell the individual gases level particularly, we have used CO
(Carbon Monoxide) MQ7 sensor. This project can be used both for indoor as well as outdoor.
For indoor use, we can make this kit as a compact device such that if every home started
using the device, we can monitor the indoor air quality of a particular targeted area. Due to
increasing air pollution, there is a necessity to keep an eye on Indoor air quality too. But for
outdoor purposes, certainly one sensor is not su cient because one sensor has a sensitivity
range of around 1 meter, so a network of sensors has to be deployed to monitor the outdoor
air quality. Enough care is taken while calibrating the sensors.

REFERENCES:
https://www.instructables.com/Air-Pollution-Detector/

https://robu.in/mq-series-gas-sensor/

You might also like