Professional Documents
Culture Documents
Air Pollution Project Documentation Final (1)
Air Pollution Project Documentation Final (1)
Bachelor of Technology
In
ELECTRONICS & COMMUNICATION ENGINEERING
By
Nandini J 20A95A0409
Ravi Teja A 19A91A0466
Siva Kumar K 19A91A0489
Aravind K 20A95A0404
1
(Affiliated to JNTUK, Kakinada and Approved by AICTE, New Delhi)
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
Certificate
This is to certify that the project report entitled “IOT BASED AIR POLLUTION
MONITORING SYSTEM USING NODEMCU” being submitted by
Nandini J 20A95A0409
Ravi Teja A 19A91A0466
Siva Kumar K 19A91A0489
Aravind K 20A95A0404
for the partial fulfillment of the requirements for the award of the degree of Bachelor of
Technology in DEPARTMENT OF ELECTRONICS & COMMUNICATION
ENGINEERING to the Jawaharlal Nehru Technological University, Kakinada is a
record of bonafide work carried out by them under the guidance and supervision.
To the best of our knowledge, the results embodied in this project report have not
been submitted to any other University or Institute for the award of degree.
ACKNOWLEDGEMENT
2
I am thankful to my guide Mr. Shivam Singh, Assistant professor who has spared
his/her valuable time. I am indebted to him/her without whom I would not have
successfully completed the project.
We also thank all teaching and non-teaching staff of the Electronics and
Communication Engineering Department for their support in completion of the project
work. Finally, we thank everyone who directly or indirectly rendered their valuable
guidance and encouragement during any dissertation work.
Nandini J 20A95A0409
Ravi Teja A 19A91A0466
SivaKumar K 19A91A0489
Aravind K 20A95A0404
3
ABSTRACT
In today’s world, due to the fast growth in the number of motor vehicles and industrial
evolution, the surrounding environment is more polluted. The pollution majorly affects the
quality of air and causes major health issues to living beings. The major reason for atmosphere
contamination is due to the release of harmful gases like carbon dioxide, carbon monoxide etc.
from factories, vehicles and from combustion of fossil fuels. It is necessary to monitor the
percentage of pollutants present in the air which will lead to environmental issues. To overcome
this, we have designed a prototype using IoT technology. The air pollution monitoring tool
includes a Microcontroller and Sensors that provides the provision to monitor the quality of air
by detecting the harmful gases present in the atmosphere. The pollution level can be monitored
remotely using PC or smartphones. The data is stored in the cloud and can be accessed remotely.
Measuring Air Quality is an important element for bringing awareness to take care of the future
generations and for a healthier life. Based on this, the Government of India has already taken
4
certain measures to ban Single Stroke and Two-Stroke Engine based motorcycles, which emit
high pollution. We are trying to implement a system using IoT platforms like Thingspeak in
order to 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.
Machine Learning analysis brings us a lot of depth in understanding the information that we
obtained from the data. Moreover, we are providing an inducement of the cost of components
versus the state of the art.
Contents
List of Figures 8
5
List of Abbreviations 9
1. Introduction [10]
1.1 Motivation 10
1.2 Problem statement 10
1.3 Objective and Scope 10
2. Literature Survey [11]
3. Background [12-19]
3.1 Node MCU 12-13
3.2 MQ135 13
3.3 16X2 LCD 14
3.4 Breadboard 15
3.5 I2c Adapter 16
3.6 Arduino IDE 16-17
3.7 Thingspeak Cloud Platform 18
3.8 Jump Wires 18-19
4. Implementation [20-26]
4.1 Creating and setting up a Thingspeak account 20
4.2 Install ESP3266 Add-on in Arduino IDE 20-22
4.3 Circuit and Code 22-26
5. Results and Validations [27]
6 Conclusions [28]
6.1 Conclusion 28
References [29]
6 Appendix [31]
8.1 Prototype 31
Profile [32]
6
LIST OF FIGURES
LIST OF ABBREVIATIONS
Chapter 1
Introduction
1.1 Motivation
Air pollution occurs when toxic or harmful substances including gases, dust particles and
biological molecules are introduced into Earth’s atmosphere. It is caused by the rapid increase
and development in industrial revolution and transportation, air contamination has recently
become a serious problem for developing countries. It is one of the major issues in the
atmosphere. Air contamination should be controlled in order to overcome life threatening
diseases like cancer, respiratory diseases and much more which are faced by human beings.
Chapter 2
Literature Survey
In the traditional approach, readings of air pollution are checked using different digital air quality
detectors and moisture meters which have to be taken to different locations every time to check
the values. It is time consuming and the risk of traveling from one location to another is high.
Collection of data has to be done manually.
At times the appliances are kept on unknowingly which directly affects the energy consumption,
Storage of data is not safe in existing systems and data cannot be fetched on time whenever
required.
There are different air quality identifiable meters available in retail shops such as Am probe
meter and Liquid petroleum gas leakage sensor alarm etc. also we have Bluetooth oriented
transmitting devices which have a very limited user to find the contamination level in
atmosphere.
[1] Monitors the pollution level in terms of parts per million and also adapts general packet
radio service using Arduino Uno board. Low power wide area technology is implemented to find
out to machine to machine communications and air quality index is computed by using the
concentration of gases.
[2]. To monitor the air pollution buzzer is implemented, buzzer intimates when air impurity
10
goes beyond a certain level and it will be displayed on liquid crystal display.
[3] The REST protocol is adapted to find out air conditioning control as well as AC split devices
through the network using Wi-Fi connection, Infra-red LED to transmit Infrared commands.
[4] Author discussed and represented A novel IoT access architecture for vehicle monitoring
systems.
Chapter 3
Components and Modules
3.1 NodeMCU
NodeMCU is an open source firmware for which open source prototyping board designs are
available. The name "NodeMCU" combines "node" and "MCU" (micro-controller unit). The
term "NodeMCU" strictly speaking refers to the firmware rather than the associated development
kits. Both the firmware and prototyping board designs are open source.
The firmware uses the Lua scripting language. The firmware is based on the eLua project, and
built on the Espressif Non-OS SDK for ESP8266. It uses many open source projects, such as lua-
cjson and SPIFFS. Due to resource constraints, users need to select the modules relevant for their
project and build a firmware tailored to their needs. Support for the 32-bit ESP32 has also been
implemented.
11
fig 3.1: NodeMCU ESP8266 Pinout
The prototyping hardware typically used is a circuit board functioning as a dual in-line package
(DIP) which integrates a USB controller with a smaller surface-mounted board containing the
MCU and antenna. The choice of the DIP format allows for easy prototyping on breadboards.
The design was initially based on the ESP-12 module of the ESP8266, which is a Wi-Fi SoC
integrated with a Tensilica Xtensa LX106 core, widely used in IoT applications.
12
fig 3.2: MQ135 Air Pollution Sensor
The EPA maintains a repository of air quality data through the Air Quality System (AQS), where
it stores data from over 10,000 monitors in the United States.
While use of these sensors was expensive in the past, the 2010s saw a recent trend towards the
development of cheaper portable air-quality sensors that can be worn by individuals to monitor
local air quality levels. These sensors can then, in turn, help measure t he spatiotemporal
coverage and variety of chemical species, and empower individuals and communities to better
understand their exposure environments and risks from air pollution.
A research group led by William Griswold at UCSD handed out portable air pollution sensors to
16 commuters, and found "urban valleys" where buildings trapped pollution. The group also
found that passengers in buses have higher exposures compared to those in automobiles.
13
A 16x2 LCD means it can display 16 characters per line and there are 2 such lines. In this LCD
each character is displayed in a 5x7 pixel matrix. The 16 x 2 intelligent alphanumeric dot matrix
display is capable of displaying 224 different characters and symbols. This LCD has two
registers, namely, Command and Data.
Command register stores various commands given to the display. Data register stores data to be
displayed. The process of controlling the display involves putting the data that form the image of
what you want to display into the data registers, then putting instructions in the instruction
register.
In your arduino project Liquid Crystal Library simplifies this for you so you don't need to know
the low-level instructions. Contrast of the display can be adjusted by adjusting the potentiometer
to be connected across the VEE pin.
3.4 Breadboard
A breadboard, or protoboard, is a construction base for prototyping of electronics. Originally the
word referred to a literal bread board, a polished piece of wood used when slicing bread.In the
1970s the solderless breadboard (a.k.a. plugboard, a terminal array board) became available and
nowadays the term "breadboard" is commonly used to refer to these.
14
fig 3.4: Breadboard
Because the solderless breadboard does not require soldering, it is reusable. This makes it easy to
use for creating temporary prototypes and experimenting with circuit design. For this reason,
solderless breadboards are also popular with students and in technological education. Older
breadboard types did not have this property.
A stripboard (Veroboard) and similar prototyping printed circuit boards, which are used to build
semi-permanent soldered prototypes or one-offs, cannot easily be reused. A variety of electronic
systems may be prototyped by using breadboards, from small analog and digital circuits to
complete central processing units (CPUs).
15
fig 3.5: I2C LCD Adapter
If there are 3 sets of pads labeled A0, A1, & A2 then the default address will be 0x3F. If there
are no pads the default address will be 0x27. The module has a contrast adjustment pot on the
underside of the display. This may require adjusting for the screen to display text correctly.
The source code for the IDE is released under the GNU General Public License, version 2. The
Arduino IDE supports the languages C and C++ using special rules of code structuring. The
Arduino IDE supplies a software library from the Wiring project, which provides many common
input and output procedures.
User-written code only requires two basic functions, for starting the sketch and the main
program loop, that are compiled and linked with a program stub main() into an executable cyclic
executive program with the GNU toolchain, also included with the IDE distribution.
16
fig 3.6: Arduino IDE interface
The Arduino IDE employs the program avrdude to convert the executable code into a text file in
hexadecimal encoding that is loaded into the Arduino board by a loader program in the board's
firmware. By default, avrdude is used as the uploading tool to flash the user code onto official
Arduino boards.
ThingSpeak has integrated support from the numerical computing software MATLAB from
MathWorks, allowing ThingSpeak users to analyze and visualize uploaded data using MATLAB
without requiring the purchase of a MATLAB license from MathWorks.
18
fig 3.8: Jump Wires
Individual jump wires are fitted by inserting their "end connectors" into the slots provided in a
breadboard, the header connector of a circuit board, or a piece of test equipment.
Chapter 4
19
Implementation
4.1 Creating and setting up a Thingspeak account
1. Visit www.thingspeak.com.
2. Click "Sign Up".
3. Fill the following mandatory fields: User ID, E-mail, Time Zone, Password.
4. Click "Create Account".
5. Click "Create New Channel".
6. Click the "Channel Settings" tab.
7. Fill Fields 1 and 2 with the following values: Percentage, Date.
8. Click "Update Channel".
9. Click the "API Key" tab to get the API key required by the installer.
3. Open the Boards Manager. Go to Tools > Board > Boards Manager…
4. Search for ESP8266 and press install button for the “ESP8266 by ESP8266
Community“:
21
5. That’s it. It should be installed after a few seconds.
22
fig 4.1: Circuit Diagram of Prototype
The circuit is self-explanatory just wire the circuit as shown in the above schematic. In this
circuit also will be using an I2C adapter module for LCD display to reduce the number of wire
connections.
NodeMCU’s I2C pins are D1 which is SCL and D2 which is SDA are connected to I2C adapter
module.The MQ135 sensor need 5V supply, you can connect its Vcc pin to “VU” pin of
NodeMCU which outputs 5V. If you have a NodeMCU from a different manufacturer you can
connect the Vcc of MQ135 to “Vin” pin of NodeMCU which can supply 5V.
4.3.2 Code
How to upload code to NodeMCU?
●Connect the NodeMCU to your computer using USB cable
●Go to Tools > Board > NodeMCU 1.0
●Go to Tools > Upload speed > 115200.
●Press and hold the on-board flash button.
●Press the reset button once and release it.
●After releasing the reset button, release the flash button.
●Click upload.
23
// -----------(c) Electronics-project-hub ----------//
#include <LiquidCrystal_I2C.h>
#include "ThingSpeak.h"
#include <ESP8266WiFi.h>
#include <Wire.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
24
lcd.setCursor(0, 0);
lcd.print("MQ135 sensor");
lcd.setCursor(0, 1);
lcd.print("is heating up...");
for (int i = 0; i < 3; i++)
{
delay(20000);
delay(20000);
delay(20000);
}
}
void loop()
{
get_value();
upload();
}
void get_value()
{
float sensor_volt;
float RS_air;
float R0;
float sensorValue;
for(int x = 0 ; x < 500 ; x++)
{
sensorValue = sensorValue + analogRead(A0);
}
sensorValue = sensorValue/500.0;
sensor_volt = sensorValue*(5.0/1023.0);
RS_air = ((5.0*10.0)/sensor_volt)-10.0;
R0 = RS_air/4.4;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Air Pollution(%)");
lcd.setCursor(0, 1);
//raw = (analogRead(A0)/1024.0)*100.0;
25
value = map(R0, 0, 1024, 1, 100);
lcd.print(value);
lcd.print(" %");
delay(5000);
}
void internet()
{
if (WiFi.status() == WL_CONNECTED)
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Connected to");
lcd.setCursor(0, 1);
lcd.print("internet!");
delay(2000);
}
if (WiFi.status() != WL_CONNECTED)
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Connecting to");
lcd.setCursor(0, 1);
lcd.print(ssid);
lcd.print(" SSID...");
for (int i = 0; i < 5; i++)
{
WiFi.begin(ssid, pass);
delay(5000);
}
if (WiFi.status() != WL_CONNECTED)
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("No internet");
lcd.setCursor(0, 1);
lcd.print("connection !");
26
delay(3000);
}
else if (WiFi.status() == WL_CONNECTED)
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Connected to");
lcd.setCursor(0, 1);
lcd.print("internet!");
delay(2000);
}
}
}
void upload()
{
ThingSpeak.writeField(Channel_ID, Field_number, value, WriteAPIKey);
}
//—--------------- end of program —---------------//
Note: We need to install two libraries to do this prototype. They are Thingspeak and LCD I2C
libraries into Arduino IDE.
Chapter 5
Result and Validations
27
This is the output as a result in the Thingspeak cloud platform. The analysis we get from it is
everyday analysis.
Chapter 6
Conclusion
28
The System is integrated with other modern tools such as Air Quality Sensors, Gas Sensors,
Node microcontroller unit Boards for making the process of automation more interactive. By placing
our equipment in different locations we can collect the readings of different gases present in the air and
updated on cloud.
This tool displays the details of polluted air in the developed mobile app and the same
information is updated to the cloud. The data stored in the cloud can be further analyzed to know the
air quality according to the recorded region. This helps in knowing the major cause and pollutants
contributing to the polluted air and suitable precautionary measures can be taken to overcome and
minimize the air pollution.
Chapter 7
References
29
1. https://en.wikipedia.org/wiki/NodeMCU
2. https://en.m.wikipedia.org/wiki/Breadboard
3. https://en.m.wikipedia.org/wiki/ThingSpeak
4. https://www.thingbits.in/products/standard-lcd-16x2-display
5. https://nodemcu.readthedocs.io/en/release/modules/i2c/
6. https://en.wikipedia.org/wiki/Arduino_IDE
7. https://www.roboticapp.com/thingspeakaccountcreation.html
Chapter 8
Appendix
Prototype
30
Fig: 8.1: Prototype
Chapter 9
Profile
Nandini Jami
20A95A0409
31
20A95A0409@aec.edu.in
Ph.no: 8309371491
Aravind kocherla
20A95A0404
20A95A0404@aec.edu.in
Ph.no: 8106416979
32