Original Group
Original Group
A mini project report submitted in partial fulfillment of the requirements for the award
of the degree of
BACHELOR OF TECHNOLOGY
in
Mr.K.VIJAY KUMAR
Associate Professor
2024-25
Department of Electronics & Communication Engineering
VAAGESWARI COLLEGE OF ENGINNERING
UGC AUTONOMOUS
Accredited by NAAC with A+ Grade
Approved by AICTE New Delhi, Affiliated to JNTUH Hyderabad Ramakrishna Colony,
Karimnagar-505527
CERTIFICATE
This is to certify that the mini-project report entitled “Air Pollution Monitoring
System” submitted by the following students in partial fulfillment of the requirements
for the award of the Degree of Bachelor of Technology in ECE and is a bonafide record
of the work performed by
2
DECLARATION
We hereby declare that the mini project titled “Air Pollution Monitoring
System” submitted to Vaageswari College of Engineering, affiliated to Jawaharlal Nehru
Technological University Hyderabad (JNTUH) for the award of the Degree of Bachelor
of Technology in ECE is a result of the original research carried out in this work. It is
further declared that the report or any part thereof has not been previously submitted to
any University or Institute for the award of a degree.
Date:
3
ACKNOWLEDGEMENT
We wish to pay our sincere gratitude to Dr. Ch. Srinivas, Principal, Vaageswari
College of Engineering, Karimnagar, for providing all the required facilities and his
support throughout the journey.
Our heartiest and sincere gratitude to Dr. A. Venkata Reddy, Professor & Head,
Department of Electronics and Communication Engineering, Vaageswari College of
Engineering for providing us with all possible facilities for carrying out the project work
in the department.
PROJECT ASSOCIATES
4
ABSTRACT
Air quality monitoring is a critical aspect of environmental assessment,
particularly in urban areas where pollutants can reach harmful levels. This project aims
to develop a robust air quality monitoring system using MQ135 gas sensor, along with
an Arduino microcontroller and an LCD display. The MQ135 sensor detects multiple
gases including ammonia, benzene, and smoke. By integrating these sensors with an
Arduino, real-time data on air quality parameters can be collected and displayed on the
LCD screen. This system provides an affordable and efficient solution for monitoring air
quality in indoor and outdoor environments, enabling users to take proactive measures
to mitigate potential health risks associated with poor air quality.
5
TABLE OF CONTENTS
6
LIST OF FIGURES
7
LIST OF TABLES
Table 4 Operators 37
ABBREVIATIONS
TX Transmitter
RX Receiver
8
CHAPTER 1
INTRODUCTION TO EMBEDDED SYSTEM
9
Consumer appliances:
At home we use a number of embedded systems which include digital
camera,digital diary, DVD player, electronic toys, microwave oven, remote controls for
TV and airconditioner,VCO player, video game consoles, video recorders etc. Today’s
high-tech car has about 20 embedded systems for transmission control, engine spark
control,air-conditioning, navigation etc.
Even wristwatches are now becoming embedded systems. The palmtops are
powerful embedded systems using which we can carry out many general-purpose tasks
such as playing games and word processing.
Office Automation:
The office automation products using embedded systems are copying machine, fax
Industrial Automation:
Today a lot of industries use embedded systems for process control. These include
pharmaceutical, cement, sugar, oil exploration, nuclear energy, electricity generation and
transmission. The embedded systems for industrial use are designed to carry out specific
tasks such as monitoring the temperature, pressure, humidity, voltage, current etc., and
then take appropriate action based on the monitored levels to control other devices or to
send information to a centralized monitoring station. In hazardous industrial environment,
where human presence has to be avoided, robots are used, which are programmed to do
specific jobs. The robots are now becoming very powerful and carry out many interesting
and complicated tasks such as hardware assembly.
Medical Electronics:
Almost every medical equipment in the hospital is an embedded system. These
equipments include diagnostic aids such as ECG, EEG, blood pressure measuring devices,
X-ray scanners; equipment used in blood analysis, radiation, colonoscopy, endoscopy etc.
Developments in medical electronics have paved way for more accurate diagnosis
of diseases.
10
Computer Networking:
Computer networking products such as bridges, routers, Integrated Services
Digital Networks (ISDN), Asynchronous Transfer Mode (ATM), X.25 and frame relay
switches are embedded systems which implement the necessary data communication
protocols. For example, a router interconnects two networks. The two networks may be
running different protocol stacks. The router’s function is to obtain the data packets from
incoming pores, analyze the packets and send them towards the destination after doing
necessary protocol conversion. Most networking equipments, other than the end systems
Telecommunications:
In the field of telecommunications, the embedded systems can be categorized as
subscriber terminals and network equipment. The subscriber terminals such as key
telephones, ISDN phones, terminal adapters, web cameras are embedded systems. The
network equipment includes multiplexers, multiple access systems, Packet Assemblers
Dissemblers (PADs), sate11ite modems etc. IP phone, IP gateway, IP gatekeeper etc. are
the latest embedded systems that provide very low-cost voice communication over the
Internet.
Wireless Technologies:
Advances in mobile communications are paving way for many interesting
applications using embedded systems. The mobile phone is one of the marvels of the last
decade of the 20’h century. It is a very powerful embedded system that provides voice
communication while we are on the move. The Personal Digital Assistants and the
palmtops can now be used to access multimedia service over the Internet. Mobile
communication infrastructure such as base station controllers, mobile switching centers
are also powerful embedded systems.
Insemination:
Testing and measurement are the fundamental requirements in all scientific and
engineering activities. The measuring equipment we use in laboratories to measure
parameters such as weight, temperature, pressure, humidity, voltage, current etc. are all
11
embedded systems. Test equipment such as oscilloscope, spectrum analyzer, logic
analyzer, protocol analyzer, radio communication test set etc. are embedded systems built
around powerful processors. Thank to miniaturization, the test and measuring equipment
are now becoming portable facilitating easy testing and measurement in the field by field-
personnel.
Security:
Security of persons and information has always been a major issue. We need
to protect our homes and offices; and also the information we transmit and store.
Developing embedded systems for security applications is one of the most lucrative
businesses nowadays. Security devices at homes, offices, airports etc. for authentication
and verification are embedded systems. Encryption devices are nearly 99 per cent of
the processors that are manufactured end up in~ embedded systems. Embedded systems
find applications in every industrial segment- consumer electronics, transportation,
avionics, biomedical engineering, manufacturing, process control and industrial
automation, data communication, telecommunication, defense, security etc. Used to
encrypt the data/voice being transmitted on communication links such as telephone
lines. Biometric systems using fingerprint and face recognition are now being
extensively used for user authentication in banking applications as well as for access
control in high security buildings.
Finance:
Financial dealing through cash and cheques are now slowly paving way for
transactions using smart cards and ATM (Automatic Teller Machine, also expanded as
Any Time Money) machines. Smart card, of the size of a credit card, has a small micro-
controller and memory; and it interacts with the smart card reader! ATM machine and
acts as an electronic wallet. Smart card technology has the capability of ushering in a
cashless society. Well, the list goes on. It is no exaggeration to say that eyes wherever
you go, you can see, or at least feel, the work of an embedded system.
12
1.3 Overview of Embedded System Architecture
Every embedded system consists of custom-built hardware built around a
Central Processing Unit (CPU). This hardware also contains memory chips onto which
The software residing on the memory chip is also called the ‘firmware’. The
embedded system architecture can be represented as a layered architecture as shown in
Fig. The operating system runs above the hardware, and the application software runs
above the operating system. The same architecture is applicable to any computer
including a desktop computer. However, there are significant differences. It is not
compulsory to have an operating system in every embedded system. For small
appliances such as remote control units, air conditioners, toys etc., there is no need for
an operating system and you can write only the software specific to that application.
For applications involving complex processing, it is advisable to have an operating
system. In such a case, you need to integrate the application software with the operating
system and then transfer the entire software on to the memory chip. Once the software
is transferred to the memory chip, the software will continue to run for a long time you
don’t need to reload new software.
13
Now, let us see the details of the various building blocks of the hardware of an
• Output devices
• Communication interfaces
• Application-specific circuitry
14
microprocessors are more powerful, but you need to use many external components
with them. D5P is used mainly for applications in which signal processing is involved
such as audio and video processing.
Memory:
The memory is categorized as Random Access 11emory (RAM) and Read
Only Memory
(ROM). The contents of the RAM will be erased if power is switched off to the chip,
whereas
ROM retains the contents even if the power is switched off. So, the firmware is stored
in the ROM. When power is switched on, the processor reads the ROM; the program is
program is executed.
Input Devices:
Unlike the desktops, the input devices to an embedded system have very
limited capability. There will be no keyboard or a mouse, and hence interacting with
the embedded system is no easy task. Many embedded systems will have a small
keypad-you press one key to give a specific command. A keypad may be used to input
only the digits. Many embedded systems used in process control do not have any input
device for user interaction; they take inputs from sensors or transducers 1’fnd produce
electrical signals that are in turn fed to other systems.
Output Devices:
The output devices of the embedded systems also have very limited
capability. Some embedded systems will have a few Light Emitting Diodes (LEDs) to
indicate the health status of the system modules, or for visual indication of alarms. A
small Liquid Crystal Display (LCD) may also be used to display some important
parameters.
Communication Interfaces:
The embedded systems may need to, interact with other embedded systems at
they may have to transmit data to a desktop. To facilitate this, the embedded systems
15
are provided with one or a few communication interfaces such as RS232, RS422,
RS485, Universal Serial Bus (USB), IEEE 1394, Ethernet etc.
Application-Specific Circuitry:
Sensors, transducers, special processing and control circuitry may be
required fat an embedded system, depending on its application. This circuitry interacts
with the processor to carry out the necessary work. The entire hardware has to be given
power supply either through the 230 volts main supply or through a battery. The
hardware has to design in such a way that the power consumption is minimized.
1.4 Microprocessor
A microprocessor is a sophisticated electronic component at the heart of
modern computing and digital systems. Functioning as a central processing unit (CPU),
this integrated circuit serves as the brain of a computer or electronic device,
orchestrating a myriad of complex operations with remarkable speed and precision.
At its core, a microprocessor comprises several key elements, including the arithmetic
logic unit (ALU), control unit, and a set of registers. The ALU is responsible for
executing arithmetic and logical operations, while the control unit coordinates the flow
of data within the processor and manages the execution of instructions.
16
computer's memory, decodes them, and then executes the corresponding operations.
This seamless orchestration allows the microprocessor to perform diverse tasks, from
basic arithmetic calculations to complex computations required for running software
applications.Microprocessors are versatile and found in an array of electronic devices,
ranging from personal computers and laptops to smartphones, tablets, and embedded
systems. Their widespread use is a testament to their efficiency, scalability, and
adaptability to various applications.
In addition to their role in computation, microprocessors play a crucial part in managing
input and output operations. They interface with peripheral devices, facilitating
communication between the computer and external components such as keyboards,
displays, printers, and storage devices.The advancement of microprocessor technology
has been a driving force behind the exponential growth of computing power and the
miniaturization of electronic devices. Moore's Law, a principle that observes the
doubling of transistor density on integrated circuits approximately every two years, has
fueled this progress, leading to increasingly powerful and energy-efficient
microprocessors.
As technology evolves, microprocessors continue to be a focal point of innovation, with
improvements in architecture, fabrication processes, and the integration of specialized
features such as multiple cores, on-chip memory, and enhanced security measures. This
relentless pursuit of advancement ensures that microprocessors remain at the forefront
of computing, powering the digital landscape and enabling the development of
increasingly sophisticated and capable electronic systems.
1.5 Microcontroller
A microcontroller is a compact, integrated circuit that amalgamates a cental
processing unit (CPU), memory (RAM and ROM/Flash), input/output peripherals, and
various essential components like timers, counters, and often communication
interfaces, all on a single chip. This highly integrated design aims to provide a versatile
and self-contained computing platform tailored for embedded systems. Unlike general-
purpose microprocessors, microcontrollers are purpose-built for specific applications,
17
facilitating the control and operation of devices and systems in diverse domains such
as automation, robotics, consumer electronics, and more
18
underscores their pivotal role in the advancement of technology, influencing innovations
across industries and contributing to the seamless integration of computing capabilities
into various aspects of our daily lives.
1.6 CONCLUSION
In conclusion, embedded systems represent a transformative force in modern
technology, seamlessly integrating computing capabilities into the fabric of our daily lives.
These systems, often powered by microcontrollers or microprocessors, play a pivotal role
in a myriad of applications, ranging from consumer electronics to critical infrastructure.
The efficiency, compactness, and dedicated functionality of embedded systems have
revolutionized industries, enabling innovations in areas such as healthcare, automotive,
communication, and beyond.The future of embedded systems holds the promise of even
greater integration, intelligence, and adaptability. With ongoing developments in artificial
intelligence, machine learning, and edge computing, embedded systems are poised to
become more autonomous and capable of making intelligent decisions in real-time.
However, these advancements also bring challenges, including the need for robust
cybersecurity measures and ethical considerations in the deployment of intelligent
embedded technologies.
19
CHAPTER 2
ARDUINO UNO
Arduino UNO Architecture:
Arduino is an open-source electronics platform based on simple software and
hardware that enables users to create interactive projects. It consists of a
microcontroller, which is essentially a small computer on a single integrated circuit,
and a set of input/output pins that allow the user to connect sensors, motors, LEDs, and
other electronic components to the board. Arduino boards are programmed using a
simple programming language and an integrated development environment (IDE),
making it accessible to anyone with basic programming skills.
Arduino UNO is based on an ATmega328P microcontroller. It is easy to use to other
boards, such as the Arduino Mega board, etc. The board consists of digital and analog
Input/Output pins (I/O), shields, and other circuits. The Arduino UNO includes 6
analog pin inputs, 14 digital pins, a USB connector, power jack, and an ICSP (In-
Integrated Development Environment.It can run both online and offline platforms.
20
Let's discuss each component in detail:
Flash), Analog to Digital Converter, SPI serial ports, I/O lines, registers, timer, external
and internal interrupts, and oscillator.
ICSP pin - The In-Circuit Serial Programming pin allows the user to program using the
Power LED Indicator- The ON status of LED shows the power is activated. When the
Digital I/O pins- The digital pins have the value HIGH or LOW. The pins numbered
TX and RX LED's- The successful flow of data i.e., transmitting and receiving of
AREF- The Analog Reference (AREF) pin is used to feed a reference voltage to the
USB- It allows the board to connect to the computer. It is essential for the programming
21
Crystal Oscillator- The Crystal oscillator has a frequency of 16MHz, which makes the
Voltage Regulator- The voltage regulator converts the input voltage to 5V.
GND- Ground pins. The ground pin acts as a pin with zero voltage.
Step 1 − First you must have your Arduino board (you can choose your favorite board)
and a USB cable. In case you use Arduino UNO, Arduino Duemilanove, Nano, Arduino
Mega 2560, or Diecimila, you will need a standard USB cable (A plug to B plug), the
kind you would connect to a USB printer as shown in the following image.
Step 2 − You can get different versions of Arduino IDE from the Download page on the
Arduino Official website. You must select your software, which is compatible with your
operating system (Wind
22
ows,
IOS, or Linux). After your file download is complete, unzip the file.
The Arduino Uno, Mega, Duemilanove and Arduino Nano automatically draw power
from either, the USB connection to the computer or an external power supply. If you
are using an Arduino Diecimila, you have to make sure that the board is configured to
draw power from the USB connection.
The power source is selected with a jumper, a small piece of plastic that fits onto two
of the three pins between the USB and power jacks. Check that it is on the two pins
closest to the USB port.
Connect the Arduino board to your computer using the USB cable. The green power
23
Step 4 − Launch Arduino IDE.
After your Arduino IDE software is downloaded, you need to unzip the folder. Inside
the folder, you can find the application icon with an infinity label (application.exe).
24
To open an existing project example, select File → Example → Basics → Blink.
Here, we are selecting just one of the examples with the name Blink. It turns the LED
on and off with some time delay. You can select any other example from the list.
To avoid any error while uploading your program to the board, you must select the
correct Arduino board name, which matches with the board connected to your
computer.
25
Here, we have selected Arduino Uno board according to our tutorial, but you must select
Select the serial device of the Arduino board. Go to Tools → Serial Port menu. This is
likely to be COM3 or higher (COM1 and COM2 are usually reserved for hardware
serial ports). To find out, you can disconnect your Arduino board and re-open the menu,
26
the entry that disappears should be of the Arduino board. Reconnect the board and select
that serial port.
Step 8 − Upload the program to your board.
Before explaining how we can upload our program to the board, we must demonstrate
F − Serial monitor used to receive serial data from the board and send the serial data to
the board.
27
Now, simply click the "Upload" button in the environment. Wait a few seconds; you
will see the RX and TX LEDs on the board, flashing. If the upload is successful, the
Arduino Libraries
The Arduino environment can be extended through the use of libraries, just like most
programming platforms. Libraries provide extra functionality for use in sketches,
e.g. working with hardware or manipulating data. To use a library in a sketch, select it
from Sketch > Import Library. A number of libraries come installed with the IDE,
but you can also download or create your own. Libraries for controlling servo and
stepper motors.
Servo - for controlling servo motors
Stepper - for controlling stepper motors. Libraries
SPI - for communicating with devices using the Serial Peripheral Interface (SPI)
Bus.
Wire - Two Wire Interface (TWI/I2C) for sending and receiving data over a net
of devices or sensors.
28
MKRGSM - library for MKR GSM 1400, for connecting to GSM/GPRS
networks.
MKRNB - library for MKR NB 1500, for connecting to NB-IoT / Cat M1
networks.
SigFox - library for MKR FOX 1200, for connecting to the Sigfox network.
WiFi - library for the Wi-Fi shield, for Internet connections via Wi-Fi.
WiFi101 - library for the MKR 1000 Wi-Fi and WiFi101 shield, for Internet
connections via Wi-Fi.
WiFiNINA - library for boards with a Wi-Fi NINA module, for Internet
Audio - allows playing audio files from an SD card. For Arduino DUE only.
I2S - library for using the I2S protocol on SAMD21 (included in SAMD
platform).
Other Libraries
Firmata - for communicating with applications on the computer using a standard serial
protocol.
29
Basics of Embedded C Programming for Arduino
A microcontroller can interact with other hardware components or devices only through
1. Digital Input. This may be received in digital LOW or HIGH from other devices. These
will be TTL logic levels or voltages converted to TTL logic levels before being applied
to the GPIO.
2. Digital Output. This may be output that’s digital LOW or HIGH compared to other
3. Analog Input. It may “sense” analog voltage from other devices. The sensed voltage is
4. Analog Output. It may output analog voltage to other devices. This analog output is
not analog voltage but a PWM signal that approximates analog voltage levels.
5. Serial Communication. It may transmit, receive, or transceive data with other devices
in serial, according to a standard serial data protocol such as UART, USART, I2C, SPI,
microwire, 1-wire, and CAN, etc. The serial communication with other devices can be
peerto-peer (UART/USART), half- duplex (I2C), or full-duplex (SPI).
An Arduino program or any microcontroller program must first have code for
initialization.
• Setting up pinModes
30
and control output. Unlike desktop applications, µc programs are not designed to
terminate. These programs keep iterating for an infinite number of times until the
system is shut down or it meets failure.
After a power shutdown, Arduino or any microcontroller resets on the “power
resume” and begins execution of its program from the beginning. The
program includes code to handle failures when possible. So, any Arduino
• Initialization
• Input
• Processing
• Output Arduino C data
types
31
Table.1 Arduino C Data Types
It’s worth noting that “string” and “string objects” are different. The string data type
defines a simple character array while the string data type defines a string object.
32
Arduino C supports these built-in functions for manipulation of string objects:
Identifiers
Identifiers are names given to variables, functions, constants, classes, methods, and
other objects in a program. In Arduino C, identifiers should contain only alphanumeric
characters, dash (-), or underscore(_). An identifier can only start from an underscore
or a letter.
Keywords
33
Table.3 Arduino C Keywords
Variables
Variables are references in a program with values that can change during the execution
For example, in Arduino C, each variable must be explicitly defined with a specified
• If, in a code statement, a variable has been instantiated by a data type but there’s no
value assigned to it, the variable is said to be defined but not declared.
• If it’s also assigned a value in the same statement or another statement, it’s said to
be declared.
The memory location where the value of a variable is stored at runtime is called its
34
“lvalue” or location value. The value stored in the memory location of the variable is
called its
A defined variable has a lvalue but no rvalue. A declared variable has a lvalue and
rvalue.
int num1 = 0;
Constants
Constants are references in a program with a value that does not change during the
execution of the program. The integer and floating-point constants can be declared
RXPIN = 0;
#define LEDPin 3
Operators
35
1. Arithmetic – addition (+), multiplication (*), subtraction (-), division (/), and
2. Assignment (=)
3. Comparison – equal to (==), not equal to (!=), less than (<), greater than (>), less
4. Bitwise – bitwise and (&), bitwise or (|), bitwise xor (^), bitwise not (~), left
subtraction (-
=), compound multiplication (*=), compound division (/=), compound bitwise and
7. Cast – These operators translate current type of a variable to another type. Type
casting can be applied to a variable by indicating the new data type in parenthesis,
For example: i
= (int) f
8. sizeof – The sizeof operator returns the size of an array in the number of bytes.
9. Ternary (:?)
A statement is a complete C instruction for the processor. All C statements end with a
semicolon (;). A block of statements is a group of statements enclosed within braces
36
({, }). A block of statement is also viewed as a single statement by the compiler.
Operator precedence
Table.4 Operators
Control Structures
• if
• if …else…
• for
• switch case
• while
37
• do… while…
• break
function_name(arguments){ function_body
}
• The type of a function can be any data type including void. The function is
expected to return a value of the same type via a return statement. This statement
should be the last one in a function body (any statements made after a return
statement will fail to execute).
• The function exits after the return statement. If the type of a function is void, it
should not return any value. The function name can be any identifier, and may
or may not need arguments. The arguments are variables that are bound to the
function.
• return
38
Build in functions
8. Serial.begin(speed): Sets the data rate in bits per second (baud rate) for serial
communication.
39
Interfacing Sensors
A sensor is a device that transforms physical quantities like temperature, humidity,
pressure, etc., to an electrical signal. Moreover, this signal is often fed to a
microcontroller like the Arduino for further processing, displaying or recording. This
data from the sensor is often analog in nature, i.e., they vary over time and not simple
on-off (digital). The Arduino sensor system uses an analog to digital converter circuit to
process sensor signals.
To interface sensors with an Arduino board, you will typically follow these steps:
1.Select the appropriate sensor: Identify the sensor you want to interface with your
Arduino. This could be a temperature sensor, humidity sensor, light sensor, motion sensor,
etc.
2.Gather the necessary components: In addition to the Arduino board and the sensor, you
may need additional components such as jumper wires, resistors, capacitors, and
breadboards, depending on the specific sensor and your project requirements.
3.Understand the sensor specifications: Read the datasheet or documentation for your
4,Connect the sensor to the Arduino: Connect the sensor to the appropriate pins on the
Arduino board. This may involve connecting power (VCC and GND), data lines (analog
5.Write the code: Open the Arduino IDE (Integrated Development Environment) or your
preferred coding environment. Write the code to read data from the sensor using the
appropriate communication protocol (analogRead, digitalWrite, etc.). You can find
libraries and example code for many sensors online to help you get started.
6.Upload the code: Connect your Arduino board to your computer using a USB cable.
Compile the code and upload it to the Arduino board using the Arduino IDE or your
preferred method.
40
7.Monitor the sensor output: Open the serial monitor in the Arduino IDE to view the sensor
readings. Depending on the sensor, you may need to perform some additional calculations
8.Test and troubleshoot: Verify that the sensor is working as expected by observing the
sensor readings in the serial monitor or by integrating it into your larger project. If you
encounter any issues, double-check your connections, code, and sensor specifications.
41
CHAPTER 3
METHODOLOGY
3.1 BLOCK DIAGRAM
By following this methodology, we can develop a robust air quality
monitoring system capable of providing valuable insights into ambient air quality
conditions.
• Power supply
• PCB board
• DHT 11
• MQ 135 sensor
• Jumper wires
42
Component Setup: Begin by setting up the hardware components.
Connect the MQ135 gas sensors to the Arduino board. Ensure proper wiring,
Utilize appropriate libraries and functions to interface with the sensors and extract
relevant data. Implement error handling and data processing techniques to ensure
reliable operation.
Data Integration: Combine data from MQ135 sensors to create a comprehensive air
quality assessment. Consider weighting factors or algorithms to account for the different
pollutants detected by each sensor and generate a composite air quality index.
LCD Display: Set up the LCD display to present real-time air quality data to the user.
Program Arduino to update the display with current sensor readings at regular
intervals.
DHT11 Sensor
The DHT11 is a low-cost, digital temperature and humidity sensor that utilizes a capacitive
43
Key Characteristics:
• Low Cost:
The DHT11 is an affordable option for temperature and humidity sensing, making it suitable
• Digital Output:
It provides a digital signal output, which eliminates the need for analog-to-digital conversion,
• Simple Interfacing:
The DHT11 can be easily interfaced with microcontrollers like Arduino and Raspberry
Pi.
Applications:
• Home Automation:
Controlling HVAC systems and other environmental controls based on temperature and
humidity data.
• Weather Stations:
Building DIY weather stations for remote monitoring of temperature and humidity.
• Environmental Monitoring:
• DIY Projects:
Integrating temperature and humidity readings into various DIY electronics projects.
Working Principle:
The DHT11 uses a capacitive humidity sensing element and a thermistor to measure humidity
44
1. Humidity Sensing:
A change in humidity levels causes a change in the capacitance value of the sensor, which is
2. Temperature Sensing:
A thermistor's resistance changes with temperature, and this change is also processed by the
In summary, the DHT11 is a versatile, cost-effective, and easy-to-use sensor for measuring
temperature and humidity, suitable for a wide range of applications, particularly in DIY and hobbyist
projects, and where high precision is not critical.
MQ 135 sensor
The MQ-135 gas sensor stands as a versatile and widely-used component
renowned for its capability to detect a range of harmful gases in the atmosphere.
Developed by Hanwei Electronics, this sensor has become instrumental in various
industries and applications due to its sensitivity, reliability, and adaptability. In this
comprehensive analysis, we delve into the operational principles, notable
characteristics, and diverse applications of the MQ-135 gas sensor, shedding light on
its pivotal role in gas detection and environmental monitoring.
Operation Principle:
The MQ-135 gas sensor operates based on the principle of conductivity changes in a
tin dioxide (SnO2) semiconductor material when exposed to specific gases present
45
in the air. The sensor comprises a sensing element composed of SnO2 powder, which
is heated by an integrated heating element. When target gases, such as ammonia
(NH3), benzene (C6H6), carbon dioxide (CO2), and various volatile organic
compounds (VOCs), come into contact with the sensor's surface, they undergo
chemical reactions with the SnO2 material, resulting in alterations in its resistance.
This change in resistance is directly correlated with the concentration of the target
gases in the surrounding environment. By measuring the sensor's resistance, the
presence and concentration of hazardous gases can be detected, enabling timely gas
monitoring and safety measures.
Characteristics:
The MQ-135 gas sensor exhibits several notable characteristics that contribute to its
gases, including ammonia, benzene, carbon dioxide, and various volatile organic
46
High Sensitivity: With high sensitivity to target gases, the sensor enables the detection
Response Time: The sensor features a rapid response time, typically within seconds,
allowing for real-time detection of gas concentrations and prompt action to mitigate
potential risks.
Longevity: With proper handling and maintenance, the sensor can maintain its
performance and reliability over an extended period, providing continuous gas
detection capabilities for prolonged use.
Applications:
The MQ-135 gas sensor finds widespread use across various industries and sectors,
owing to its versatility and effectiveness in gas detection and environmental
monitoring:
Indoor Air Quality Monitoring: Integrated into air quality monitoring systems, the
MQ135 sensor helps assess indoor air quality by detecting and measuring
concentrations of harmful gases, such as ammonia and volatile organic compounds,
thereby promoting healthy living and occupational safety.
47
urban and industrial areas, to assess the impact of pollutants on public health and the
environment, guiding pollution control and mitigation efforts.
Gas Leak Detection: Integrated into gas leak detection systems, the sensor aids in the
early detection of gas leaks from pipelines, storage tanks, and industrial equipment,
enabling timely intervention to prevent accidents, minimize environmental damage, and
ensure workplace safety.
LCD Display:
LCD (Liquid Crystal Display) screen is an electronic display module and find
a wide range of applications. A 16x2 LCD display is very basic module and is
very commonly used in various devices and circuits. These modules are preferred
over seven segments and other multi segment LEDs. The reasons being: LCDs are
economical; easily programmable; have no limitation of displaying special & even
custom characters (unlike in seven segments), animations and so on.
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 5x7 pixel matrix. This LCD has two registers, namely,
The command register stores the command instructions given to the LCD. A command
is an instruction given to LCD to do a predefined task like initializing it, clearing its
screen, setting the cursor position, controlling display etc. The data register stores the
data to be displayed on the LCD. The data is the ASCII value of the character to be
displayed on the LCD. Click to learn more about internal structure of a LCD.
48
Table.5 Pin details of LCD Display Interfacing
The LiquidCrystal library allows you to control LCD displays that are compatible
with the Hitachi HD44780 driver. There are many of them out there, and you can
usually tell them by the 16-pin interface. The LCDs have a parallel interface, meaning
that the microcontroller has to manipulate several interface pins at once to control
the display.
The interface consists of the following pins:
A register select (RS) pin that controls where in the LCD's memory you're writing data
to. You can select either the data register, which holds what goes on the screen, or an
instruction register, which is where the LCD's controller looks for instructions on what to
do next.
There's also a display constrast pin (Vo), power supply pins (+5V and
Gnd) and LED Backlight (Bklt+ and BKlt-) pins that you can use to power the
LCD, control the display contrast, and turn on and off the LED backlight,
respectively.
49
Fig . 3.4 Interface of LCD Display with Arduino Uno
The process of controlling the display involves putting the data that form the image of what
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. The LiquidCrystal Library simplifies this for you so you don't
need to know the low-level instructions.
The Hitachi-compatible LCDs can be controlled in two modes: 4-bit or 8-bit. The
4-bit mode requires seven I/O pins from the Arduino, while the 8-bit mode
requires 11 pins. For displaying text on the screen, you can do most everything in
4-bit mode, so example shows how to control a 2x16 LCD in 4-bit mode.
50
CHAPTER 4
SOFTWARE IMPLEMENTATION
4.1 Introduction:
In this chapter we are going to study about the software used in this project in detail.
1. Arduino IDE
• setup(): a function that runs once at the start of a program and that can initialize
settings.
Sample program:
51
Most Arduino boards contain an LED and a load resistor connected between pin 13 and
4.3 Structure :
The setup() function is called when a sketch starts. Use it to initialize variables,
pin modes, start using libraries, etc. The setup function will only run once, after
After creating a setup() function, which initializes and sets the initial values, the
loop() function does precisely what its name suggests, and loops consecutively,
allowing your program to change and respond. Use it to actively control the Arduino
board.
4.3.1 Functions:
Digital I/O: pinMode: Configures the specified pin to behave either as an input or an
output. See the description of digital pins for details on the functionality of the pins.
Syntax: pinMode(pin, mode) digitalWrite(): If the pin has been configured as an
OUTPUT with pinMode(), its voltage will be set to the corresponding value: 5V (or
3.3V on 3.3V boards) for HIGH, 0V (ground) for LOW.
52
Syntax: digitalWrite(pin, value) digitalRead(pin): Reads the value from the
specified analog pin. The Arduino board contains a 6 channel (8 channels on the
Mini and Nano, 16 on the Mega), 10-bit
analog to digital converter. This means that it will map input voltages between 0 and
5 volts into integer values between 0 and 1023. This yields a resolution between
readings of: 5 volts / 1024 units or, .0049 volts (4.9 mV) per unit. The input range
and resolution can be changed using analogReference(). It takes about 100
microseconds (0.0001 s) to read an analog input, so the maximum reading rate is
about 10,000 times a second. Syntax: analogRead(pin) millis(): Returns the number
of milliseconds since the Arduino board began running the current program. This
number will overflow (go back to zero), after approximately 50 days. micros():
Returns the number of microseconds since the Arduino board began running the
current program. This number will overflow (go back to zero), after approximately
70 minutes. On 16 MHz Arduino boards (e.g. Duemilanove and Nano), this function
has a resolution of four microseconds (i.e. the value returned is always a multiple of
four). On 8 MHzArduino boards (e.g. the LilyPad), this function has a resolution of
eight microseconds.
4.3.2 Utilities:
sizeof: The sizeof operator returns the number of bytes in a variable type, or the
Syntax: sizeof(variable)
53
4.3.4 External Interrupts:
attachInterrupt():
The first parameter to attachInterrupt is an interrupt number. Normally you
should use digitalPinToInterrupt(pin) to translate the actual digital pin to the
specific interrupt number. For example, if you connect to pin 3, use
digitalPinToInterrupt(3) as the first parameter to attachInterrupt.
Interrupts are useful for making things happen automatically in microcontroller programs,
and can help solve timing problems. Good tasks for using an interrupt may include reading a
If you wanted to insure that a program always caught the pulses from a rotary
encoder, so that it never misses a pulse, it would make it very tricky to write a program
to do anything else, because the program would need to constantly poll the sensor lines
for the encoder, in order to catch pulses when they occurred. Other sensors have a
similar interface dynamic too, such as trying to read a sound sensor that is trying to
catch a click, or an infrared slot sensor (photo-interrupter) trying to catch a coin drop.
In all of these situations, using an interrupt can free the microcontroller to get some
other work done while not missing the input.
54
CHAPTER 5
ADVANTAGES & APPLICATIONS
Advantages:
Health Impact Awareness: Air quality monitoring provides real-time data on
pollutants such as particulate matter (PM), nitrogen dioxide (NO2), ozone (O3), and
others. This data helps raise public awareness about the quality of the air they breathe,
enabling individuals to take preventive measures to protect their health. Early
Warning System: Continuous air quality monitoring serves as an early warning
system for potential environmental hazards. By detecting increased pollutant levels
promptly, authorities can implement timely interventions, such as issuing health
advisories, regulating traffic, or recommending changes in industrial practices to
mitigate the impact on air quality.
Policy Development: Data collected from air quality monitoring stations aids
policymakers in formulating effective environmental policies. By understanding
the sources and patterns of air pollution, governments can implement targeted
regulations and incentives to reduce emissions and improve overall air quality.
Environmental Research: Air quality monitoring contributes valuable data for
scientific research on the long-term impact of air pollution on ecosystems and
human health. Researchers can analyze trends, identify emerging pollutants, and
assess the effectiveness of pollution control measures.
Community Engagement: Providing real-time air quality information to the public
fosters community engagement. Citizens can actively participate in environmental
stewardship by adjusting their activities based on air quality alerts, contributing to
a collective effort to improve air quality.
Applications:
Urban Planning: Air quality monitoring is crucial for urban planners to develop
sustainable cities. By understanding the dynamics of air pollution, planners can
design green spaces, regulate traffic flow, and establish emission control zones to
create healthier urban environments.
Industrial Emission Control: Industries can use air quality monitoring to track and
control their emissions, ensuring compliance with environmental regulations.
55
Continuous monitoring allows industries to identify and rectify sources of pollution promptly,
Healthcare Management: Hospitals and healthcare facilities can use air quality data to
manage respiratory conditions and plan for potential increases in patients with respiratory
issues during periods of poor air quality. This proactive approach helps healthcare
providers allocate resources effectively.
Smart Buildings and Homes: Integrated air quality monitoring systems in smart
buildings and homes enable automatic adjustments to ventilation and air filtration
systems based on real-time air quality data. This promotes a healthier indoor
environment and reduces energy consumption.
56
CHAPTER 6
CONCLUSION & FUTURE SCOPE
Conclusion:
By following the outlined methodology, a robust air quality monitoring system can
be developed, providing valuable insights into ambient air quality conditions. The
project involves setting up hardware components, calibrating sensors, programming
Arduino for data collection and processing, integrating sensor data, displaying real-
time information on an LCD display, and conducting thorough testing and
calibration.
The implementation of this project enables users to monitor multiple air pollutants
simultaneously, offering a comprehensive understanding of air quality. The system's
realtime data presentation enhances awareness of air quality conditions, aiding in making
informed decisions to mitigate health risks associated with poor air quality.
Future Scope:
There are several avenues for future enhancements and expansions of this project:
Wireless Connectivity: Integrate Wi-Fi or Bluetooth modules to enable remote
monitoring and data logging, allowing users to access air quality information through
mobile applications or web interfaces.
Data Analytics: Implement advanced data analytics techniques to analyze historical data
trends, identify patterns, and predict future air quality conditions. This could involve
Sensor Fusion: Explore the integration of additional sensors to detect a wider range of pollutants
or environmental parameters, such as particulate matter (PM2.5/PM10), temperature, humidity,
to map air quality data spatially, providing insights into localized pollution hotspots
Energy Efficiency: Optimize power consumption to prolong battery life in portable applications
57
Community Engagement: Develop features for community engagement, such as
Overall, continual innovation and integration of emerging technologies can enhance the
58
REFERENCES
1.Grover, Ashok, et al. "Design and Implementation of an IoT Based Air Pollution
Monitoring System." International Journal of Scientific Research in Computer
Science, Engineering and Information Technology, vol. 4, no. 3, 2019, pp. 1-6.
Using Arduino and MQ Sensors." Sensors, vol. 19, no. 6, 2019, pp. 1-15.
9.Choudhary, Yogesh, et al. "Air Quality Monitoring System Using Arduino and
11.Di Filippo, Paolo, et al. "An IoT-Based Wireless Sensor Network for Urban Air
59
12.Kamal, Muhammad Arif, et al. "Development of an Air Quality Monitoring
System Using IoT and Cloud Computing." IEEE Access, vol. 9, 2021, pp.
3898438996.
14.Hoang, Phu T., et al. "A Low-Cost Air Pollution Monitoring System for
60
APPENDIX
#include<dht11,h>
#define DHT11PIN 8
dht11 DHT11;
void setup ()
{
pinMode (5, INPUT);
Serial.begin(9600);
}
Void loop ()
{
Serial.println();
int chk=DHT11.read (DHT11PIN);
Serial. print (“humidity (%):”);
Serail.println((float)DHT11, humidity,2);
Serial. print(“temperature©:”);
Serial.println((float)DHT11.temperature,2);
delay (2000);
int x;
x=digitalRead(5);
if (x==1)
{
Serial.println(“gas detected”);
Serial.println(x); delay(500);
}
else
Serial.println(“gas not detected”);
Serial.println(x);
delay(500);
}
61