0% found this document useful (0 votes)
13 views89 pages

Batch 08 PDF

Uploaded by

Bhavya Reddy A
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views89 pages

Batch 08 PDF

Uploaded by

Bhavya Reddy A
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 89

A PROJECT REPORT

ON

IOT BASED AIR QUALITY MONITORING AND


ALERTING SYSTEM
Submitted in partial fulfillment for the award of the degree of

BACHELOR OF TECHNOLOGY

IN
ELECTRONICS AND COMMUNICATION ENGINEERING
BY
A. BHAVYA SREE - 209L1A0404

C. KAMESWAR REDDY - 209L1A0424

A. UDAY KUMAR - 209L1A0402

K. SAI VIGNESH - 209L1A0447

G. LAHARI - 209L1A0438

Under the esteemed guidance of

Mrs. P. SANDHYA RANI, M. Tech,


Assistant Professor Department of ECE

SIDDARTHA EDUCATIONAL ACADEMY GROUP OF INSTITUIONS


DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING
(Approved by AICTE, New Delhi& Affiliated to JNTUA, Ananthapuramu)
An ISO 9001:2015 & ISO 14001:2015 Certified Institution
Near C. Gollapalli, Tirupati-517505
2020-2024
SIDDARTHA EDUCATIONAL ACADEMY GROUP OF INSTITUIONS
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

Near C. Gollapalli, Tirupati-517505

CERTIFICATE
This is to certify that the project report entitled “IOT BASED AIR QUALITY
MONITORING ANDALERTING SYSTEM” is a bonafide work carried out by
A. BHAVYA SREE - 209L1A0404

C. KAMESWAR REDDY - 209L1A0424

A. UDAY KUMAR - 209L1A0402

K. SAI VIGNESH - 209L1A0447

G. LAHARI - 209L1A0438

B. Tech students of Siddartha Educational Academy Group of Institutions,


Affiliated to JNTUA, Ananthapuramu in partial fulfillment of the
requirements for the award of the degree of BACHELOR OF
TECHNOLOGY with the specialization in ELECTRONICS AND
COMMUNICATION ENGINEERING during the Academic year 2020-
2024.

Project guide Head of the department


Mrs. P. SANDHYA RANI, M. Tech. Mr. P.SAI PRASAD, M. Tech, (Ph. D)
Assistant Professor, Dept. of ECE, Professor, Dept. of ECE,
SEAGI, Tirupati – 517505. SEAGI, Tirupati – 517505.

Viva-voice conducted on

INTERNAL EXAMINER EXTERNALEXAMINER


SIDDARTHA EDUCATIONAL ACADEMY GROUP OF INSTITUIONS
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING
Near C. Gollapalli, Tirupati-517505

DECLARATION

We hereby declare that the project report work entitled “IOT BASED AIR QUALITY
MONITORING AND ALERTING SYSTEM” is entirely our original work carried out under
the guidance of Mrs. P. SANDHYA RANI, Assistant Professor Department of Electronics and
Communication Engineering, Siddartha Educational Academy Group Of Institutions, C.
Gollapalli, Tirupati, Affiliated to JNTUA, Anantapuramu, for the award of the Degree of
BACHELOR OF TECHNOLOGY with the specialization in ELECTRONICS AND
COMMUNICATION ENGINEERING. The project report has not been submitted in a part or
full for the award of any degree of diploma of this or any other university or institutions.

A. BHAVYA SREE -209L1A0404

C. KAMESWAR REDDY -209L1A0424

A. UDAY KUMAR -209L1A0402

K. SAI VIGNESH -209L1A0447

G. LAHARI -209L1A0438
ACKNOWLEDGEMENT

All endeavours over a long period can be successful only with the advice and
support of many well-wishers. We take this opportunity to express our gratitude and
appreciation to all of them.
We wish to express deep sense of gratitude to our beloved and respected guide
Mrs. P. SANDHYA RANI, Assistant Professor Department of Electronics and
Communication Engineering, Siddartha Educational Academy Group of Institutions,
Tirupati, for her valuable guidance, given to us for the successful completion of work.
Our sincere thanks to Mr. P.SAI PRASAD, Head, Department of Electronics and
Communication Engineering for his valuable advice, guidance and encouragement given
to us for the successful completion of work.
We extend sincere thanks to the Dr. K. RAJASEKHAR, Principal for his kind
co-operation in completing and making the project a success.
We would like to thank the Management for their kind co-operation and for
providing infrastructure facilities.
We extend our thanks to all the Teaching staff and non-teaching staff of the
Department of Electronics and Communication Engineering for their support and
encouragement during the course of our project work.
We also thank our parents for being helpful in many ways in successful
completion of our work. Finally, we thank all these who helped us directly or indirectly
in successful completion of this project work.

A. BHAVYA SREE -209L1A0404

C. KAMESWAR REDDY -209L1A0424

A. UDAY KUMAR -209L1A0402

K. SAI VIGNESH -209L1A0447

G. LAHARI -209L1A0438
ABSTRACT

In this project we are going to make an IOT Based Air Pollution

Monitoring System in which we will monitor the Air Quality over a web server using

internet and will trigger an alarm when the air quality goes down beyond a certain

level, means when there are sufficient amount of harmful gases are present in the air

like CO2, smoke, alcohol, benzene and NH3. It will show the air quality in PPM on

the LCD and as well as on webpage so that we can monitor it very easily. Previously

we have built the LPG detector using MQ6 sensor and Smoke detector using MQ2

sensor but this time we have used MQ135 sensor which is the best choice for

monitoring Air Quality index as it can detects most harmful gases and can measure

their amount accurately. In this IOT project, you can monitor the pollution level from

anywhere using your computer or mobile. We can install this system anywhere and

can also trigger some device when pollution goes beyond some level, like we can

switch on the Exhaust fan or can send alert to the user using Buzzer.

i
INDEX

CHAPTER NUMBER TITLE PAGE NO

CERTIFICATION

DECLARATION

ACKNOWLEDGEMENT
i
ABSTRACT
ii
CONTENTS
v
LIST OF FIGURES
vii
LIST OF TABLES
viii
LIST OF ACRONYMS

CHAPTER 1 INTRODUCTION (1-7)

1.1 Introduction 2
1.2 Aim of the project 2
1.3 Proposed Methodology 5

CHAPTER 2 EMBEDDED SYSTEM (8-11)

2.1 Introduction to Embedded systems 9


2.2 Characteristics of Embedded systems 10
2.3 Applications of Embedded system 10
2.4 Microcontroller versus Microprocessor 10
2.5 Microcontroller for embedded systems 11

ii
CHAPTER 3 ARDUINO UNO (12-21)

3.1 Introduction 13
3.2 Arduino UNO Microcontroller 13
3.3 Arduino uno board 16

CHAPTER 4 SOFTWARE IMPLEMENTATION (22-35)

4.1 Introduction to Arduino ID 23


4.2 Arduino Data types 23
4.3 Arduino Programming 34

CHAPTER 5 HARDWARE COMPONENTS (36-57)

5.1 Power supply unit 37


5.2 Rectifier 39
5.3 Introduction to LCD 41
5.4 Potentiometer 45
5.5 Gas sensor 46
5.6 MQ3 Alcohol sensor 48
5.7 Arduino code 55

5.8 DHT11 57

CHAPTER 6 INTERNET OOF THINGS (58-66)


6.1 Introduction 59
6.2 The Three causes of IOT 61

iii
6.3 How to get started 62
6.4 Advantages of IOT 64
6.5 Applications of IOT 65
6.6 Buzzer 65

CHAPTER 7 RESULT AND ANALYSIS (67-71)

CHAPTER 8 CONCLUSION AND FUTURE SCOPE (72-74)

8.1 Conclusion 73
8.2 Future Scope 73

REFERENCES 75

iv
LIST OF FIGURES

Fig No Name of the Figure Page No.

1.1 Architecture Diagram 6

1.2 Block Diagram 6


3.1 Arduino UNO board 15
3.2 Pin Diagram of At mega 18
4.1 USB Cable 26

4.2 Download Arduino UNO Software 26

4.3 Arduino IDE Launch folder 27

4.4 Opening the new file 28

4.5 File drop menu Arduino IDE 29

4.6 Selecting Arduino board 30

4.7 Selecting serial port 31

4.8 Toolbar in Arduino IDE 32

4.9 Default functions in IDE 33

5.1 Power supply 35

5.2 Transformers 36

5.3 Diode symbol 36

5.4 Half wave rectifier 37

5.5 Half wave rectification 38

5.6 Full wave rectifier 38

5.7 Full wave rectification 39

5.8 2x16 LCD Display 40


5.9 Pin Diagram of LCD 41

v
5.10 Variable resistor 42

5.11 Potentiometer symbol 43

5.12 Preset symbol 43

5.13 MQ3 alcohol sensor 48

5.14 MQ3 Sensor configuration 48

5.15 MQ3 sensor structure 49

5.16 Pin configuration of MQ3 module 49

5.17 Interfacing MQ3 with Arduino 51


5.18 DHT11 sensor 54

vi
LIST OF TABLES

Table No. Name Page No.


Table 3.1 Arduino UNO Specifications 16

vii
LIST OF ACRONYMS

Symbol Name
API APPLICATION PROGRAMMING INTERFACE

CPU CENTRAL PROCESSING UNIT

DHT11 DIGITAL TEMPERATURE AND HUMIDITY SENSOR

EEPROM ELECTRICALLY ERASABLE PROGRAMMABLE READ-

ONLYMEMORY

EPROM ERASABLE PROGRAMMABLE ROM

GND GROUND

GPRS GENERAL PACKET RADIO SERVICE

GSM GLOBAL SYSTEM MOBILE COMMUNICATION

HTTP HYPERTEXT TRANSFER PROTOCOL

I2C INTER-INTEGRATED CIRCUIT

IDE INTEGRATED DEVELOPMENT ENVIRONMENT

IE INTERRUPT ENABLE CONTROL

IP INTERRUPT PRIORITY CONTROL

LCD LIQUID CRYSTAL DISPLAY

LED LIGHT EMITTING DIODE

MQ METHANE QUALITY SENSOR

PORT0
P0
PORT1
P1
PORT2
P2
PORT3
P3
PULSE WIDTH MODULATION
PWM
RAM RANDOM ACCESS MEMORY

viii
ROM READ ONLY MEMORY

RFID RADIO-FREQUENCY IDENTIFICATION

SPI SERIAL PERIPHERAL INTERFACE

TCON TIMER/COUNTER CONTROL

TMOD TIMER/COUNTER MODE CONTROL

TTL TRANSISTOR-TRANSISTOR LOGIC


TWI TWO WIRE INTERFACE

ix
IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

CHAPTER – 1
INTRODUCTION

Dept. OF ECE, SEAGI, TIRUPATI 1


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

1.1. INTRODUCTION
The causes of pollution measure carbon dioxide gas, carbon monoxide gas,
pollutant, Particulate Matter, Ground Level gas. The Internet of things permits objects to
be detected or in dominant. Things in the IoT refers to the creation of devices like vehicles
with intrinsic sensors, etc. Development of pollution observance system will facilitate to
control and live pollution connected parameters.

Variety of the ways that to controls pollution parameters measure. We have a tendency
to measure reaching to implement pollution detection in vehicles if pollution is high or
low owing to combustion of fuel in vehicle. We tend to measure reaching to build it up
and implement it using Node MCU and different elements. This methodology is
becoming more and more important in pollution detection in vehicles. The Vehicles end
up carbonic acid gas (CO2), monoxide gas (CO).

We tend to activity pattern electronic text Transfer protocol (HTTP) for act and
transferring data and to boot assures. Here to make an IOT Based Air Pollution
Monitoring System in which we will monitor the Air quality over a web server using
internet and will trigger an alarm when the air quality goes down beyond a certain level,
means when there are sufficient number of harmful gases are present in the 1 air like
CO2, smoke, alcohol benzene and NH3. It will show the air quality in PPM on the LCD
and as well as on webpage so that we can monitor it very easily.

1.2. AIM OF THE PROJECT

Air pollution occurs when harmful substances including particulates and biological
molecules are introduced into Earth’s atmosphere. The levels of the gases and the
temperature is displayed in an LCD display panel, which continuously shows the real
time output values of the gas sensors, temperature and humidity sensor which will help

Dept. OF ECE, SEAGI, TIRUPATI 2


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

us to know the quality of air.

Literature Review:
Monika Singh Et al. in August 2019 proposed an Air Pollution Monitoring System.
This system uses an Arduino microcontroller connected with MQ135 and MQ6 gas
sensor which senses the different types of gases present in the environment. It was then
connected to the Wi-Fi module which connects to the internet and LCD is used to display
the output to the user and buzzer alerts when the ppm crosses certain limit. Their
applications were industrial perimeter monitoring, indoor air quality monitoring, site
selection for reference monitoring stations, making data available to users Yamuna
Thangam in November 2018 used IoT by measuring the concentration of gas using
various sensors which were observed through serial monitor of Arduino. This data is
collected in Thing speak channels by means of Ethernet shield which is available in live
for further processing. These analysed results were viewed through thing speak in a
graphical format. Then the average pollution level was calculated using MATLAB
analysis and the time-controlled results were viewed through an android app. Further
based on the location, the air quality index value was obtained through the android app.
Along with this, the health effects were also displayed in this app, so that the users can
stay aware of the pollution levels.

K. S. E. Phala Et al. in November 2014 presented an air quality monitoring system


that consists of air quality monitoring station, communication links, a sink node module
and a data server. They developed the GSM module-based sink node with data server PC.
The real-time data were saved in a micro-SD card in text format and saved in the data
server (PC). For the data base they chose MySQL as the DBMS. Electrochemical and
infrared sensors were used to measure the concentrations of CO, CO2, SO2 and NO2.
GSM modules have been used for the wireless communication between the base station
and remote sensor node. The GSM modules communicate over cellular networks and a
MCU was used to control all the processes on the sensor node. The MCU samples the
sensor outputs using an internal ADC, it then calculates the gas concentrations and
transmits the computed data as packets using the GSM. A test incubator was designed

Dept. OF ECE, SEAGI, TIRUPATI 3


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

and constructed to evaluate the performance of the sensor node. The sensor node was
tested by placing it inside the incubator; pumping gas into the incubator and observing
the measurements taken by the sensor node. The base station comprises a sink node
serially connected to a computer which runs the GUI software. The sink or receiving node
captures the data transmitted by the remote sensor node and serially forwards it to the
computer. The data was then plotted on the GUI and stored in text files.

Nitin Sadashiv Desai Et al. in 2017 proposed a system that consists of Beagle bone
Interfaced with air pollution measure sensors such as carbon dioxide [CO2], carbon
monoxide [CO] and noise sensor. Analog output from sensor was read from Analog Pin
of Beagle bone black which reads the input signal in the range 0 v to 1.8v. Data from
sensor was uploaded on Azure Cloud with the help of python SQL. Reserved data base
was created in the beagle bone itself in the form of .CSV file. At the end of each day,
same data present in the .CSV file is uploaded in the cloud data base. Old data in the
beagle bone have been deleted with the help of automated shell script. Data from different
sensor was stored in the Azure data base. This data from database has been fetched as
input for machine learning service. Machine learning service was used to train the module
with the help of previous data. Power BI have been used to represent sensor data fetched
by beagle bone black.

Harsh Gupta Et al.in 2019 presented an IOT based Air Pollution Monitoring System
which consists of sensors that were to constantly monitor the Temperature, Humidity,
Carbon Monoxide, Smoke, LPG, PM2.5 and PM10 levels in the atmosphere. In their
work, a one-way communication between Thing Speak, an open-source cloud platform,
and an Android Application has been developed. Raspberry Pi has been used as a gateway
to interface the hardware system. Once the firebase API was included in Android or iOS
App, firebase features like Analytics, Authentication, Storage, Messaging, Hosting,
Crash reporting, Real-time Database etc. were used. The Graphs were plotted in Thing
Speak according to the sensors data received and the same were visualized in an Android
App in a tabular format. Rajat Sankhe Et al. in 2017 used carbon sensor for sensing the

Dept. OF ECE, SEAGI, TIRUPATI 4


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

pollutants or the carbon particles in the air and it also detects the level of pollutants in air
and gives the output in form of analogy signal. The microcontroller takes input in digital
form, so ADC was used to convert the analogy output of the sensor into digital form and
gives it as input to the micro controller. These values are continuously displayed on the
LCD. A switch pad was used for entering the critical value. If the value of pollutants in
air exceeds the critical value entered, then the buzzer beeps and also a notification will be
sent to the webpage on the mobile phone by the micro controller through the GPRS
module. This information is continuously being updated on the webpage which can be
accessed globally. A notification was also received on the webpage when the level of
pollutants rises above critical value. Mobile phone receives the signal from modem which
it forward to server to the internet. Server analysis of the data received from the
smartphone. It concludes the output from the data received and sends the output over the
internet. Poonam Pal Et al. in October 2017 developed a system to monitor the air using
an Arduino microcontroller. They used MQ135 gas sensor to sense the different types of
dangerous gas and Arduino to control the entire process. MQ135 gas sensor gives the
output in the form of voltage levels and needs to be converted into PPM. A Wi-Fi module
was used to connect the whole process to the internet and LCD was used for the visual
output. When the value is less than 1000 PPM, the LCD and webpage will display “Fresh
Air” and when the PPM exceeds the limit then the buzzer starts beeping and the LCD and
webpage will display “Poor Air, Open Windows”. If it will increase 2000 then the buzzer
will keep beeping and the LCD and webpage will display “Danger! Move to fresh Air”.

1.3. PROPOSED METHODOLOGY

The methodology required for quantifying the health effects of air pollution is
derived from the WHO. Study of joint initiative from the Health Research Council, the
Ministry for the Environment and the Ministry of Transport (Fisher et al, 2007). This
study represents the most comprehensive analysis of air pollution, its health implications,
and the resulting societal costs conducted in New Zealand. The research evaluated the

Dept. OF ECE, SEAGI, TIRUPATI 5


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

effects of specific source and categories of emissions from vehicles (including private
petrol cars, diesel cars, and diesel trucks), industry, domestic and total sources in New
Zealand. The research encompassed five interconnected components: 1. Air quality,
meteorology and emissions data analysis 2. Air pollution exposure assessment 3. Health
impact assessment 3 4. Economic impact assessment 5.
Preventative policy assessment.

Figure 1.1: Architecture diagram

Dept. OF ECE, SEAGI, TIRUPATI 6


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

BLOCK DIAGRAM

Supply

MQ2
Buzzer

MQ3
IoT

Figure 1.2: Block diagram of air quality monitoring system

Dept. OF ECE, SEAGI, TIRUPATI 7


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

CHAPTER 2
EMBEDDED SYSTEMS

Dept. OF ECE, SEAGI, TIRUPATI 8


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

2.1. INTRODUCTION TO EMBEDDED SYSTEMS


An embedded system is a special-purpose computer system designed to perform
one or a few dedicated functions, sometimes with real-time computing constraints. It is
usually embedded as part of a complete device including hardware and mechanical parts.
In contrast, a general-purpose computer, such as a personal computer, can do many
different tasks depending on programming. Embedded systems have become very
important today as they control many of the common devices we use.
Since the embedded system is dedicated to specific tasks, design engineers can
optimize it, reducing the size and cost of the product, or increasing the reliability and
performance. Some embedded systems are mass-produced, benefiting from economies of
scale.
Physically embedded systems range from portable devices such as digital watches
and MP3 players, to large stationary installations like traffic lights, factory controllers, or
the systems controlling nuclear power plants. Complexity varies from low, with a single
microcontroller chip, to very high with multiple units, peripherals and networks mounted
inside a large chassis or enclosure.
In general, "embedded system" is not an exactly defined term, as many systems
have some element of programmability. For example, Handheld computers share some
elements with embedded systems — such as the operating systems and microprocessors
which power them — but are not truly embedded systems, because they allow different
applications to be load and peripherals to be connected.
An embedded system is some combination of computer hardware and software,
either fixed in capability or programmable, that is specifically designed for a particular
kind of application device. Industrial machines, automobiles, medical equipment,
cameras, household appliances, airplanes, vending machines, and toys are among the
myriad possible hosts of an embedded system. Embedded systems that are programmable
are provided with a programming interface, and embedded systems programming is a
specialized occupation. Certain operating systems or language platforms are tailored for
the embedded market, such as Embedded Java and Windows XP Embedded. However,
some low-end consumer products use very inexpensive microprocessors and limited

Dept. OF ECE, SEAGI, TIRUPATI 9


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

storage, with the application and operating system both part of a single program. The
program is written permanently into the system's memory in this case, rather than being
loaded into RAM (random access memory), as programs on a personal computer.

2.2. CHARACTERISTIC OF EMBEDDED SYSTEM


• Speed (bytes/sec): Should be high speed.
• Power (watts): Low power dissipation.
• Size and weight: As far possible small in size and low weight.
• Accuracy (error): Must be very accurate.
• Adaptability: High adaptability and accessibility.
• Reliability: Must be reliable over a long period of time.

2.3. APPLICATIONS OF EMBEDDED SYSTEMS


We are living in the Embedded World. You are surrounded with many embedded
products and your daily life largely depends on the proper functioning of these gadgets.
Television, Radio, CD player of your living room, Washing Machine or Microwave Oven
in your kitchen, Card readers, Access Controllers, Palm devices of your workspace enable
you to do many of your tasks very effectively.

• Robotics: industrial robots, machine tools, Robocop soccer robots.


• Automotive: cars, trucks, trains.
• Aviation: airplanes, helicopters.
• Home and Building Automation.
• Aerospace: rockets, satellites.
• Energy systems: windmills, nuclear plants.
• Medical systems: prostheses, revalidation machine.

2.4. MICROCOPROCESSOR VERSUS MICROCONTROLLER

What is the difference between a Microprocessor and Microcontroller? By


microprocessor means the general-purpose Microprocessors such as Intel's X86 family

Dept. OF ECE, SEAGI, TIRUPATI 10


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

(8080,8086, 80286, 80386, 80486, and the Pentium) or Motorola's 680X0 family (68000,
68010, 68020, 68030, 68040, etc.). These microprocessors contain no RAM, no ROM,
and no I/O ports on the chip itself. For this reason, they are commonly referred to as
general-purpose Microprocessors.

A system designer using a general-purpose microprocessor such as the Pentium


or the 68040 must add RAM, ROM, I/O ports, and timers externally to make them
functional. Although the addition of external RAM, ROM, and I/O ports makes these
systems bulkier and much more expensive, they have the advantage of versatility such
that the designer can decide on the amount of RAM, ROM and I/O ports needed to fit the
task at hand. This is not the case with Microcontrollers. A Microcontroller has a CPU (a
microprocessor) in addition to a fixed amount of RAM, ROM, I/O ports, and a timer all
on a single chip. In other words, the processor, the RAM, ROM, I/O ports and the timer
are all embedded together on one chip; therefore, the designer cannot add any external
memory, I/O ports, or timer to it. The fixed amount of on-chip ROM, RAM, and number
of I/O ports in Microcontrollers makes them ideal for many applications in which cost
and space are critical. In many applications, for example a TV remote control, there is no
need for the computing power of a 486 or even an 8086 microprocessor.

2.5. MICROCONTROLLERS FOR EMBEDDED SYSTEMS


In the Literature discussing microprocessors, we often see the term Embedded
System. Microprocessors and Microcontrollers are widely used in embedded system
products. An embedded system product uses a microprocessor (or Microcontroller) to do
one task only. A printer is an example of an embedded system since the processor inside
it performs one task only; namely getting the data and printing it. Contrast this with a
Pentium based PC. A PC can be used for any number of applications such as word
processor, print-server, bank teller terminal, Video game, network server, or Internet
terminal. Software for a variety of applications can be loaded and run. Of course, the
reason a pc can perform myriad tasks is that it has RAM memory and an operating system
that loads the application software into RAM and lets the CPU run it.

Dept. OF ECE, SEAGI, TIRUPATI 11


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

CHAPTER 3
ARDUINO UNO

Dept. OF ECE, SEAGI, TIRUPATI 12


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

3.1. INTRODUCTION
Microcontroller as the name suggests, a small controller. They are like single chip
computers that are often embedded into other systems to function as
processing/controlling units. For example, the control you are using probably has
microcontrollers inside that do decoding and other controlling functions. They are also
used in automobiles, washing machines, microwaves ovens, toys…. etc., where
automation is needed.

3.2. Arduino Uno Microcontroller:


The Arduino Uno is a microcontroller board based on the ATmega328
(datasheet). It has 14 digital input/output pins (of which 6 can be used as PWM outputs),
6 analog inputs, a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP
header, and a reset button. It contains everything needed to support the microcontroller;
simply connect it to a computer with a USB cable or power it with an AC-to-DC adapter
or battery to get started.
The Uno differs from all preceding boards in that it does not use the FTDI USB-
to-serial driver chip. Instead, it features the Atmega8U2 programmed as a USB-to-serial
converter. "Uno" means "One" in Italian and is named to mark the upcoming release of
Arduino 1.0. The Uno and version 1.0 will be the reference versions of Arduino, moving
forward. The Uno is the latest in a series of USB Arduino boards, and the reference model
for the Arduino platform; for a comparison with previous versions, see the index of
Arduino boards.
The Arduino Uno can be powered via a USB connection or with an external power
supply. The power source is selected automatically. External (non-USB) power can come
either from an AC-to-DC adapter (wall-wart) or battery. The adapter can be connected by
plugging a 2.1mm center-positive plug into the board's power jack. Leads from a battery
can be inserted in the Gnd and Vin pin headers of the POWER connector. The board can
operate on an external supply of 6 to 20 volts. If supplied with less than 7V, however, the
5Vpin may supply less than five volts and the board may be unstable. If using more than
12V, the voltage regulator may overheat and damage the board. The recommended range
is 7 to 12 volts

Dept. OF ECE, SEAGI, TIRUPATI 13


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

The power pins are as follows:


• VIN. The input voltage to the Arduino board when it's using an external power source (as
opposed to5 volts from the USB connection or other regulated power source). You can
supply voltage through this pin, or, if supplying voltage via the power jack, access it
through this pin.
• 5V. The regulated power supply is used to power the microcontroller and other
components on the board. This can come either from VIN via an on-board regulator or
be supplied by USB or another regulated 5V supply.
• 3.3V.A 3.3-volt supply generated by the on-board regulator. Maximum current draw is
50 mA.
• GND. Ground pins.
Memory:
The Atmega328 has 32 KB of flash memory for storing code (of which 0,5 KB is
used for the bootloader); It has also 2 KB of SRAM and 1 KB of EEPROM (which can
be read and written with the EEPROM library).

Input and Output:


Each of the 14 digital pins on the Uno can be used as an input or output, using
pin Mode (), digital Write (), and digital Read () functions. They operate at 5 volts. Each
pin can provide or receive a maximum of 40 mA and has an internal pull-up resistor
(disconnected by default) of 20-50 Kohm's. In addition, some pins have specialized
functions:
• Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data.
These pins are connected to the corresponding pins of the ATmega8U2 USB-to-TTL
Serial chip.
• External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a
low value, a rising or falling edge, or a change in value. See the attached Interrupt ()
function for details.
• PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analog Write () function.

Dept. OF ECE, SEAGI, TIRUPATI 14


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

• SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI


communication, which although provided by the underlying hardware, is not currently
included in the Arduino language.
• LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH
value, the LED is on, when the pin is LOW, it's off.
The Uno has 6 analog inputs, each of which provide 10 bits of resolution (i.e. 1024
different values). By default, they measure from ground to 5 volts, though is it possible
to change the upper end of their range using the AREF pin and the analog Reference ()
function. Additionally, some pins have specialized functionality:
• I2C: 4 (SDA) and 5 (SCL). Support I2C (TWI) communication using the Wire library.
There are a couple of other pins on the board:
• AREF. Reference voltage for the analog inputs. Used with analog Reference ().
• Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset
button to shields which block the one on the board.

Communication:
The Arduino Uno has several facilities for communicating with a computer,
another Arduino, or other microcontrollers. The ATmega328 provides UART TTL (5V)
serial communication, which is available on digital pins 0 (RX) and 1 (TX). An
ATmega8U2 on the board channels this serial communication over USB and appears as
a virtual com port to software on the computer. The '8U2' firmware uses the standard
USBCOM drivers, and no external driver is needed. However, on Windows, an *.inf file
is required. The Arduino software includes a serial monitor which allows simple textual
data to be sent to and from the Arduino board. The RX and TX LEDs on the board will
flash when data is being transmitted via the USB-to-serial chip and USB connection to
the computer (but not for serial communication on pins 0 and 1). A Software Serial library
allows for serial communication on any of Uno's digital pins. The ATmega328 also
supports I2C (TWI) and SPI communication. The Arduino software includes a Wire
library to simplify use of the I2C bus

Dept. OF ECE, SEAGI, TIRUPATI 15


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

3.3. ARDUINO UNO BOARD:


The Arduino Uno is a microcontroller board based on the ATmega328. It has 14
digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16
MHz ceramic resonator, a USB connection, a power jack, an ICSP header, and a reset
button. It contains everything needed to support the microcontroller; simply connect it to
a computer with a USB cable or power it with an AC-to-DC adapter or battery to get
started.

Figure 3.1: Arduino Uno board

Dept. OF ECE, SEAGI, TIRUPATI 16


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

The Uno differs from all preceding boards in that it does not use the FTDI USB-
to-serial driver chip. Instead, it features the Atmega16U2 (Atmega8U2 up to version R2)
programmed as a USB-to-serial converters.
Technical Specifications:

Table3.1: Arduino Uno specifications


The Arduino Uno can be powered via a USB connection or with an external
power supply. The power source is selected automatically. External (non-USB) power
can come either from an AC-to-DC adapter (wall-wart) or battery. The adapter can be
connected by plugging a 2.1mm center-positive plug into the board's power jack. Leads
from a battery can be inserted in the Gnd and Vin pin headers of the POWER connector.
The board can operate on an external supply of 6 to 20 volts. If supplied with less than
7V, however, the 5V pin may supply less than five volts and the board may be unstable.
If using more than 12V, the voltage regulator may overheat and damage the board. The
recommended range is 7 to 12 volts.

1. USB Interface:
Arduino board can be powered by using the USB cable from your computer. All
you need to do is connect the USB cable to the USB connection
2. External power supply:

Dept. OF ECE, SEAGI, TIRUPATI 17


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

Arduino boards can be powered directly from the AC mains power supply by
connecting it to the power supply (Barrel Jack)
3. Voltage Regulator:
The function of the voltage regulator is to control the voltage given to the Arduino
board and stabilize the DC voltages used by the processor and other elements.
4. Crystal Oscillator:
The crystal oscillator helps Arduino in dealing with time issues. How does
Arduino calculate time? The answer is, by using the crystal oscillator. The number printed
on top of the Arduino crystal is 16.000H9H. It tells us that the frequency is 16,000,000
Hertz or 16 MHz’s
5-17. Arduino Reset:
It can reset your Arduino board, i.e., start your program from the beginning. It can
reset the UNO board in two ways. First, by using the reset button (17) on the board.
Second, you can connect an external reset button to the Arduino pin labelled RESET (5).
6-9. Pins (3.3, 5, GND, Vin):
• 3.3V (6): Supply 3.3 output volt
• 5V (7): Supply 5 output volt
• Most of the components used with Arduino board works fine with 3.3 volt
and 5 volts.
• GND (8) (Ground): There are several GND pins on the Arduino, any of which can
be used to ground your circuit.
• Vin (9): This pin also can be used to power the Arduino board from an
external power source, like AC mains power supply.

10. Analog pins:


The Arduino UNO board has five analog input pins A0 through A5. These pins
can read the signal from an analog sensor like the humidity sensor or temperature sensor
and convert it into a digital value that can be read by the microprocessor.

Dept. OF ECE, SEAGI, TIRUPATI 18


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

11. Main microcontroller:


Each Arduino board has its own microcontroller (11). You can assume it as the
brain of your board. The main IC (integrated circuit) on the Arduino is slightly different
from board to board. The microcontrollers are usually of the ATMEL Company. You
must know what IC your board has before loading up a new program from the Arduino
IDE. This information is available at the top of the IC. For more details about the IC
construction and functions, you can refer to the data sheet. The Atmega8U2 programmed
as a USB-to-serial converter. "Uno" means "One" in Italian and is named to mark the
upcoming release of Arduino 1.0. The Uno and version 1.0 will be the reference versions
of Arduino, moving forward. The Uno is the latest in a series of USB Arduino boards,
and the reference model for the Arduino platform; for a comparison with previous
versions, see the index of Arduino boards.

Figure 3.2: At mega pin diagram

Pin Description:
VCC: Digital supply voltage.
GND: Ground.

Port B (PB [7:0]) XTAL1/XTAL2/TOSC1/TOSC2:

Dept. OF ECE, SEAGI, TIRUPATI 19


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected
for each bit). The Port B output buffers have symmetrical drive characteristics with both
high sink and source capability. As inputs, Port B pins that are externally pulled low will
source current if the pull-up resistors are activated. The Port B pins are tri-stated when a
reset condition becomes active, even if the clock is not running.
Depending on the clock selection fuse settings, PB6 can be used as input to the
inverting Oscillator amplifier and input to the internal clock operating circuit.
Depending on the clock selection fuse settings, PB7 can be used as output from
the inverting Oscillator amplifier.
If the Internal Calibrated RC Oscillator is used as chip clock source, PB [7:6] is
used as TOSC [2:1] input for the Asynchronous Timer/Counter2 if the AS2 bit in ASSR
is set.
Port C (PC [5:0]):
Port C is a 7-bit bi-directional I/O port with internal pull-up resistors (selected for
each bit). The PC [5:0] output buffers have symmetrical drive characteristics with both
high sink and source capability. As inputs,
Port C pins that are externally pulled low will source current if the pull-up resistors
are activated. The Port C pins are tri-stated when a reset condition becomes active, even
if the clock is not running.
PC6/RESET:
If the RSTDISBL Fuse is programmed, PC6 is used as an I/O pin. Note that the
electrical characteristics of PC6 differ from those of the other pins of Port C.
If the RSTDISBL Fuse is unprogrammed, PC6 is used as a Reset input. A low
level on this pin for longer than the minimum pulse length will generate a Reset, even if
the clock is not running. Shorter pulses are not guaranteed to generate a Reset.
Port D (PD [7:0]):
Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected
for each bit). The Port D output buffers have symmetrical drive characteristics with both
high sink and source capability. As inputs, Port D pins that are externally pulled low will
source current if the pull-up resistors are activated. The Port D pins are tri-stated when a

Dept. OF ECE, SEAGI, TIRUPATI 20


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

reset condition becomes active, even if the clock is not running.


AVCC: AVCC is the supply voltage pin for the A/D Converter, PC [3:0], and PE [3:2].
It should be externally connected to VCC, even if the ADC is not used. If the ADC is
used, it should be connected to VCC through a low-pass filter. Note that PC [6:4] uses
digital supply voltage, VCC.
AREF: AREF is the analog reference pin for the A/D Converter.
ADC [7:6] (TQFP and VFQFN Package Only): In the TQFP and VFQFN package,
ADC [7:6] serve as analog inputs to the A/D converter. These pins are powered from the
analog supply and serve as 10-bit ADC channels.
12. ICSP pin: Mostly, ICSP (12) is an AVR, a tiny programming header for the Arduino
consisting of MOSI, MISO, SCK, RESET, VCC, and GND. It is often referred to as an
SPI (Serial Peripheral Interface), which could be considered as an "expansion" of the
output. Actually, you are slaving the output device to the master of the SPI bus.
13. Power LED indicator: This LED should light up when you plug your Arduino into
a power source to indicate that your board is powered up correctly. If this light does not
turn on, then there is something wrong with the connection.
14. TX and RX LEDs: On your board, you will find two labels: TX (transmit) and RX
(receive). They appear in two places on the Arduino UNO board. First, at the digital pins
0 and 1, to indicate the pins responsible for serial communication. Second, the TX and
RX led (13). The TX led flashes with different speed while sending the serial data. The
speed of flashing depends on the baud rate used by the board. RX flashes during the
receiving process.
15. Digital I / O: The Arduino UNO board has 14 digital I/O pins (15) (of which 6 provide
PWM (Pulse Width Modulation) output. These pins can be configured to work as input
digital pins to read logic values (0 or 1) or as digital output pins to drive different modules
like LEDs, relays, etc. The pins labeled “~” can be used to generate PWM.
16. AREF: AREF stands for Analog Reference. It is sometimes used to set an external
reference voltage (between 0 and 5 Volts) as the upper limit for the analog input pins to
work.

Dept. OF ECE, SEAGI, TIRUPATI 21


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

CHAPTER 4
SOFTWARE

Dept. OF ECE, SEAGI, TIRUPATI 22


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

4.1. Introduction to Arduino IDE


Arduino is a prototype platform (open source) based on easy-to-use hardware and
software. It consists of a circuit board, which can be programmed (referred to as a
microcontroller) and ready-made software called Arduino IDE (Integrated Development
Environment), which is used to write and upload the computer code to the physical board.
The key features are:

• Arduino boards can read analog or digital input signals from different sensors and turn
it into an output such as activating a motor, turning LED on/off, connect to the cloud
and many other actions.
• You can control your board functions by sending a set of instructions to the
microcontroller on the board via Arduino IDE (referred to as uploading software).
• Unlike most previous programmable circuit boards, Arduino does not need an extra
piece of hardware (called a programmer) in order to load a new code onto the board.
You can simply use a USB cable.
• Additionally, the Arduino IDE uses a simplified version of C++, making it easier to
learn to program.
• Finally, Arduino provides a standard form factor that breaks the functions of the micro-
controller into a more accessible package.
After learning about the main parts of the Arduino UNO board, we are ready to learn
how to set up the Arduino IDE. Once we learn this, we will be ready to upload our
program on the Arduino board.
4.2. Arduino data types:
Data types in C refers to an extensive system used for declaring variables or
functions of different types. The type of a variable determines how much space it occupies
in the storage and how the bit pattern stored is interpreted.
The following table provides all the data types that you will use during Arduino
programming.
Void:
The void keyword is used only in function declarations. It indicates that the

Dept. OF ECE, SEAGI, TIRUPATI 23


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

function is expected to return no information to the function from which it was called.
Example:
Void Loop ()
{
// rest of the code
}
Boolean:
A Boolean holds one of two values, true or false. Each Boolean variable occupies
one byte of memory.
Example:
Boolean state= false; // declaration of variable with type Boolean and initialize it
with false.
Boolean state = true; // declaration of variable with type Boolean and initialize it
with false.
Char: A data type that takes up one byte of memory that stores a character value.
Character literals are written in single quotes like this: 'A' and for multiple characters,
strings use double quotes: "ABC".
However, characters are stored as numbers. You can see the specific encoding in
the ASCII chart. This means that it is possible to do arithmetic operations on characters,
in which the ASCII value of the character is used. For example, 'A' + 1 has the value 66,
since the ASCII value of the capital letter A is 65.
Example:
Char chr_a = ‘a’ ;//declaration of variable with type char and initialize it with
character a.
Char chr_c = 97 ;//declaration of variable with type char and initialize it with
character 97
Unsigned char:
An unsigned char is an unsigned data type that occupies one byte of memory.
The unsigned char data type encodes numbers from 0 to 255.
Example:

Dept. OF ECE, SEAGI, TIRUPATI 24


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

Unsigned Char chr_y = 121; // declaration of variable with type Unsigned char
and initialize it with character y
Byte:
A byte stores an 8-bit unsigned number, from 0 to 255.
Example:
byte m = 25 ;//declaration of variable with type byte and initialize it with 25
int:
Integers are the primary datatype for number storage. int stores a 16-bit (2-byte)
value. This yields a range of -32,768 to 32,767 (minimum value of -2^15 and a maximum
value of (2^15) - 1).
The int size varies from board to board. On the Arduino Due, for example, an int
stores a 32-bit (4-byte) value. This yields a range of -2,147,483,648 to 2,147,483,647
(minimum value of -2^31 and a maximum value of (2^31) - 1).
Example:
int counter = 32 ;// declaration of variable with type int and initialize it with 32.
Unsigned int:
Unsigned int (unsigned integers) are the same as int in the way that they store a
2-byte value. Instead of storing negative numbers, however, they only store positive
values, yielding a useful range of 0 to 65,535 (2^16) - 1). The Due stores a 4-byte (32-
bit) value, ranging from 0 to 4,294,967,295 (2^32 - 1).
Example:
Unsigned int counter= 60; // declaration of variable with type unsigned int and
initialize it with 60.
Word:
On the Uno and other ATMEGA based boards, a word stores a 16-bit unsigned
number. On Due and Zero, it stores a 32-bit unsigned number.
Example
word w = 1000 ;//declaration of variable with type word and initialize it with 1000.
Long:
Long variables are extended size variables for number storage, and store 32 bits

Dept. OF ECE, SEAGI, TIRUPATI 25


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

(4 bytes), from 2,147,483,648 to 2,147,483,647.


Example:
Long velocity= 102346 ;//declaration of variable with type Long and initialize it
with 102346
Unsigned long: Unsigned long variables are extended size variables for number storage
and store 32 bits (4 bytes). Unlike standard longs, unsigned longs will not store negative
numbers, making their range from 0 to 4,294,967,295 (2^32 - 1).
Example:
Unsigned Long velocity = 101006 ;// declaration of variable with type Unsigned
Long and initialize it with 101006.
Short:
A short is a 16-bit datatype. On all Arduinos (ATMEGA and ARM based), a short
store a 16-bit (2-byte) value. This yields a range of -32,768 to 32,767 (minimum value of
-2^15 and a maximum value of (2^15) - 1).
Example:
short val= 13 ;//declaration of variable with type short and initialize it with 13
Float:
Data type for floating-point numbers is a number that has a decimal point.
Floating-point numbers are often used to approximate the analog and continuous values
because they have greater resolution than integers.
Floating-point numbers can be as large as 3.4028235E+38 and as low as
3.4028235E+38. They are stored as 32 bits (4 bytes) of information.
Example:
float num = 1.352;//declaration of variable with type float and initialize it with
1.352.
Double:
On the Uno and other ATMEGA based boards, Double precision floating-point
number occupies four bytes. That is, the double implementation is exactly the same as
the float, with no gain in precision. On the Arduino Due, doubles have 8 -byte (64 bit)
precision.

Dept. OF ECE, SEAGI, TIRUPATI 26


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

Example:
double num = 45.352 ;// declaration of variable with type double and initialize it
with 45.352.
In this section, we will learn in easy steps, how to set up the Arduino IDE on our
computer and prepare the board to receive the program via USB cable.
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
Mega2560, or Decimal, 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.

Figure 4.1: USB Cable

Step 2: Download Arduino IDE Software.


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 (Windows, IOS, or Linux). After your file download is complete, unzip
the file.

Dept. OF ECE, SEAGI, TIRUPATI 27


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

Figure 4.2: Down load Arduino Uno software

Step 3: Power up your board.


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 must 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 LED (labeled PWR) should
glow.

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).
Double click the icon to start the IDE.

Dept. OF ECE, SEAGI, TIRUPATI 28


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

Figure 4.3: Arduino IDE launch folder

Step 5: Open your first project.


Once the software starts, you have two options:
• Create a new project.
• Open an existing project example.

To create a new project, select File --> New. To open

Dept. OF ECE, SEAGI, TIRUPATI 29


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

Figure 4.4: Opening a new file

To open an existing project example, select File -> Example -> Basics -> Blink.

Dept. OF ECE, SEAGI, TIRUPATI 30


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

Figure 4.5: File Drop menu in Arduino IDE

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.

Step 6: Select your Arduino board.


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.
Go to Tools -> Board and select your board.

Dept. OF ECE, SEAGI, TIRUPATI 31


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

Figure 4.6: Selecting Arduino board

Here, we have selected Arduino Uno board according to our tutorial, but you must
select the name matching the board that you are using.

Step 7: Select your serial port.


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,
the entry that disappears should be of the Arduino board. Reconnect the board and select
that serial port.

Dept. OF ECE, SEAGI, TIRUPATI 32


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

Figure 4.7: Selecting Serial port

Step 8: Upload the program to your board. Before explaining how we can upload our
program to the board, we must demonstrate the function of each symbol appearing in the
Arduino IDE toolbar.

Dept. OF ECE, SEAGI, TIRUPATI 33


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

Figure 4.8: Toolbar in Arduino IDE


A- Used to check if there is any compilation error.
B- Used to upload a program to the Arduino board.
C- Shortcut used to create a new sketch.
D- Used to directly open one of the example sketch.
E- Used to save your sketch.
F- Serial monitor used to receive serial data from the board and send the serial data to the
board.
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
message "Done uploading" will appear in the status bar.
Note: If you have an Arduino Mini, NG, or other board, you need to press the reset button
physically on the board, immediately before clicking the upload button on the Arduino
Software.

4.3. Arduino programming structure


In this chapter, we will study in depth the Arduino program structure and we will
learn more new terminologies used in the Arduino world. The Arduino software is open
source. The source code for the Java environment is released under the GPL and the
C/C++ microcontroller libraries are under the LGPL.
Sketch: The first new terminology is the Arduino program called “sketch”.
Structure

Dept. OF ECE, SEAGI, TIRUPATI 34


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

Arduino programs can be divided into three main parts: Structure, Values
(variables and constants), and Functions. In this tutorial, we will learn about the Arduino
software program, step by step, and how we can write the program without any syntax or
compilation error.
Let us start with the Structure. Software structure consist of two main functions:
• Setup() function
• Loop() function

Figure 4.9: Default Functions in Arduino IDE

PURPOSE:
The setup () function is called when a sketch starts. Use it to initialize the
variables, pin modes, start using libraries, etc. The setup function will only run once, after
each power up or reset of the Arduino board.
PURPOSE:
After creating a setup () function, which initializes and sets the initial values, the
loop () function does precisely what its name suggests, and loops seductively, allowing
your program to change and respond. Use it to actively control the Arduino board.

Dept. OF ECE, SEAGI, TIRUPATI 35


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

CHAPTER 5
HARDWARE

Dept. OF ECE, SEAGI, TIRUPATI 36


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

5.1. POWER SUPPLY UNIT

The power supply for this system is shown below.

Figure 5.1: power supply


Transformer:
Transformer is a static device used to convert the voltage from one level to another
level without changing its frequency. There are two types of transformers
1. Step-up transformer
2. Step-down transformer
Step-up transformer converts low voltage level into high voltage level without changing
its frequency.
Step-down transformer converts high voltage level into low voltage level without
changing its frequency.
In this project we are using a step-down transformer which converts 230V AC to 12V AC
[or] 230V AC to 5V as shown below.

Dept. OF ECE, SEAGI, TIRUPATI 37


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

Figure 5.2: Transformers

Diodes: Diodes allow electricity to flow in only one direction. The arrow of the circuit
symbol shows the direction in which the current can flow. Diodes are the electrical
version of a valve, and early diodes were called valves.

Figure 5.3: Diode Symbol

A diode is a device which only allows current to flow through it in one direction. In this
direction, the diode is said to be 'forward biased' and the only effect on the signal is that

Dept. OF ECE, SEAGI, TIRUPATI 38


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

there will be a voltage loss of around 0.7V. In the opposite direction, the diode is said to
be 'reverse-biased' and no current will flow through it.

5.2. RECTIFIER

The purpose of a rectifier is to convert an AC waveform into a DC waveform (OR)


Rectifier converts AC current or voltages into DC current or voltage.

There are two different rectification circuits, known as 'half-wave' and 'full wave'
rectifiers. Both use components called diodes to convert AC into DC.
The Half-wave Rectifier

The half-wave rectifier is the simplest type of rectifier since it only uses one diode, as
shown in figure.

Figure 5.4: Half Wave Rectifier

Figure 2 shows the AC input waveform to this circuit and the resulting output. As you
can see, when the AC input is positive, the diode is forward-biased and lets the current
through. When the AC input is negative, the diode is reverse-biased and the diode does
not let any current through, meaning the output is 0V. Because there is a 0.7V voltage
loss across the diode, the peak output voltage will be 0.7V less than Vs.

Dept. OF ECE, SEAGI, TIRUPATI 39


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

Figure 5.5: Half-Wave Rectification

While the output of the half-wave rectifier is DC (it is all positive), it would not be
suitable as a power supply for a circuit. Firstly, the output voltage continually varies
between 0V and Vs-0.7V, and secondly, for half the time there is no output at all.
The Full-wave Bridge Rectifier

The circuit in figure 3 addresses the second of these problems since at no time is the
output voltage 0V. This time four diodes are arranged so that both the positive and
negative parts of the AC waveform are converted to DC. The resulting waveform is
shown in figure 4.

Figure 5.6: Full-Wave Rectifier

Dept. OF ECE, SEAGI, TIRUPATI 40


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

Figure 5.7: Full-Wave Rectification

When the AC input is positive, diodes A and B are forward-biased, while diodes C
and D are reverse-biased. When the AC input is negative, the opposite is true - diodes C
and D are forward-biased, while diodes A and B are reverse-biased.

While the full-wave rectifier is an improvement on the half-wave rectifier, its output
still isn't suitable as a power supply for most circuits since the output voltage still varies
between 0V and Vs-1.4V. So, if you put 12V AC in, you will 10.6V DC out.

5.3. INTRODUCTION TO LCD

A liquid crystal display (LCD) is a thin, flat display device made up of any
number of color or monochrome pixels arrayed in front of a light source or reflector.
Each pixel consists of a column of liquid crystal molecules suspended between two
transparent electrodes, and two polarizing filters, the axes of polarity of which are
perpendicular to each other.
Without the liquid crystals between them, light passing through one would be
blocked by the other. The liquid crystal twists the polarization of light entering one filter

Dept. OF ECE, SEAGI, TIRUPATI 41


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

to allow it to pass through the other.


A program must interact with the outside world using input and output devices
that communicate directly with a human being. One of the most common devices
attached to a controller is an LCD display. Some of the most common LCDs connected
to the controllers are 16X1, 16x2 and 20x2 displays. This means 16 characters per line by
1 line 16 characters per line by 2 lines and 20 characters per line by 2 lines,
respectively.
Many microcontroller devices use ‘smart LCD’ displays to output visual
information. LCD displays designed around LCD NT-C1611 module, are inexpensive,
easy to use, and it is even possible to produce a readout using the 5X7 dots plus cursor of
the display.
They have a standard ASCII set of characters and mathematical symbols. For an
8-bit data bus, the display requires a +5V supply plus 10 I/O lines (RS, RW, D7, D6, D5,
D4, D3, D2, D1, D0).
For a 4-bit data bus it only requires the supply lines plus 6 extra lines (RS, RW,
D7, D6, D5, D4). When the LCD display is not enabled, data lines are tri-state and they
do not interfere with the operation of the microcontroller.

Figure 5.8: 2x16 LCD Display

Dept. OF ECE, SEAGI, TIRUPATI 42


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

USES
LCD is used exclusively in watches, calculators and measuring instruments. It is
simple seven-segment display, having a limited amount of numeric data. The recent
advances in technology have resulted in better legibility, more information displaying
capability and a wider temperature range. These have resulted in the LCD s being
extensively used in telecommunications and entertainment electronics. The LCD s has
even started replacing the cathode ray tubes (CRTs) used for the display of text and
graphics, and in small TV applications
LCD PIN DIAGRAM

Figure 5.9: Pin Diagram of LCD

CONTROL LINES:

EN:
Line is called "Enable." This control line is used to tell the LCD that you are
sending it data. To send data to the LCD, your program should make sure this line is low
(0) and then set the other two control lines and/or put data on the data bus. When the
other lines are completely ready, bring EN high (1) and wait for the minimum amount of
time required by the LCD datasheet (this varies from LCD to LCD), and end by bringing
it low (0) again.

Dept. OF ECE, SEAGI, TIRUPATI 43


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

RS: Line is the "Register Select" line. When RS is low (0), the data is to be treated as
a command or special instruction (such as clear screen, position cursor, etc.). When RS
is high (1), the data being sent is text data which should be displayed on the screen.
RW:
Line is the "Read/Write" control line. When RW is low (0), the information on
the data bus is written to the LCD. When RW is high (1), the program is effectively
querying (or reading) the LCD. Only one instruction ("Get LCD status") is a read
command. All others are writing commands, so RW will almost always be low.
▪ LOGIC STATUS ON CONTROL LINES

• E - 0 Access to LCD disabled.


1 Access to LCD enabled.
• R/W - 0 Writing data to LCD.
1 Reading data from LCD
• RS - 0 Instructions.
1 Character

▪ CONTRAST CONTROL

To have a clear view of the characters on the LCD, contrast should be adjusted. To
adjust the contrast, the voltage should be varied. For this, a preset is used which can
behave like a variable voltage device. As the voltage of this preset is varied, the contrast
of the LCD can be adjusted.

Dept. OF ECE, SEAGI, TIRUPATI 44


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

Figure 5.10: variable resistor

5.4. POTENTIOMETER
Variable resistors used as potentiometers have all three terminals connected. This
arrangement is normally used to vary voltage, for example to set the switching point of
a circuit with a sensor or control the volume (loudness) in an amplifier circuit. If the
terminals at the ends of the track are connected across the power supply, then the wiper
terminal will provide a voltage which can be varied from zero up to the maximum of the
supply.

Figure 5.11: potentiometer symbol


Presets
These are miniature versions of the standard variable resistor. They are designed to
be mounted directly onto the circuit board and adjusted only when the circuit is built. For
example, to set the frequency of an alarm tone or the sensitivity of a light-sensitive circuit,
a small screwdriver or similar tool is required to adjust presets. Presets are much cheaper
than standard variable resistors so they are sometimes used in projects where a standard
variable resistor would normally be used.
Multiturn presets are used where very precise adjustments must be made. The screw
must be turned many times (10+) to move the slider from one end of the track to the other,
giving very fine control.

Dept. OF ECE, SEAGI, TIRUPATI 45


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

Figure 5.12: preset symbol

5.5. GAS SENSOR


▪ A sensor is a technological device that detects / senses a signal, physical condition
and chemical compounds.

▪ It is also defined as any device that converts a signal from one form to another.

Sensors are mostly electrical or electronic.


▪ Gas sensor is a subclass of chemical sensors.

▪ Gas sensor measures the concentration of gas in its vicinity. Gas sensor interacts with
a gas to measure its concentration. Each gas has a unique breakdown voltage i.e. the
electric field at which it is ionized. Sensor identifies gases by measuring these
voltages. The concentration of the gas can be determined by measuring the current
discharge in the device.

Applications:

▪ Process control industries.

▪ Environmental monitoring.

▪ Boiler control.

▪ Fire detection.

▪ Alcohol breath tests.

▪ Detection of harmful gases in mines.

▪ Home safety.

Dept. OF ECE, SEAGI, TIRUPATI 46


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

▪ Grading of agro-products like coffee and spices.

Gas sensing technologies:

▪ Metal Oxide Based Gas Sensors.

▪ Capacitance Based Gas Sensors.

▪ Acoustic Wave Based Gas Sensors.

▪ Calorimetric Gas Sensors.

▪ Optical gas sensors.

▪ Electrochemical gas sensors.

Types:
Metal Oxide Based Gas Sensors

▪ Metal oxide sensors are also known as chemiresistors.

▪ The detection principle of resistive sensors is based on change of the resistance of a


thin film upon adsorption of the gas molecules on the surface of a semiconductor.

▪ The gas-solid interactions affect the resistance of the film because of the density of
electronic species in the film.

Capacitance Based Gas Sensors


▪ They measure the change in dielectric constant of films between the electrodes as a
function of the gas concentration.

▪ The capacitive sensor relies on inter-digitated electrode structures, which correspond


to the two plates of a standard capacitor, to monitor changes of the dielectric
coefficient of the film.

Dept. OF ECE, SEAGI, TIRUPATI 47


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

▪ The simple theory behind it is if the dielectric constant of the film is lower than that
of the analyte, the capacitance will increase and vice versa.

Acoustic Wave Based Gas Sensors


▪ Sound based gas sensors are known as acoustic wave-based gas sensors.

▪ To launch the acoustic waves, this type of sensor uses piezoelectric material either
in the thin film form or in bulk form which has one or more transducers on its surface.

Carbon monoxide gas sensor


▪ It can either be battery-operated or AC powered.

▪ Mostly the sensor will not sound an alarm at lower concentrations (e.g. 100 ppm).
The alarm will sound within a few minutes at 400 ppm. So, the function is specific
to concentration-time. Figure shows simple carbon monoxide sensor.

Carbon monoxide gas sensor (Contd.)


Carbon monoxide sensor can be of different types such as:
▪ Semiconductor sensor

▪ Electrochemical sensor

▪ Digital sensor

▪ Biome

▪ etic sensor (chem-optical or gel cell sensor)

5.6. What is MQ3 Alcohol Sensor: Pin Configuration & Its


Applications

The MQ3 alcohol sensor is one of the series of MQ gas sensors, which can detect
and monitor the alcohol gas present in the atmosphere. It is capable of detecting 25-

Dept. OF ECE, SEAGI, TIRUPATI 48


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

500ppm alcohol gas concentration in the air. This article gives a brief description of the
pin configuration, specifications, and Arduino interfacing of the MQ3 alcohol sensor. The
alternatives of MQ3 alcohol sensors are MQ138 (benzene, hydrogen, alcohol, propane,
toluene, formaldehyde gas), MQ303A (ethanol, smoke, and alcohol), MQ2(methane,
smoke, LPG, butane), MQ214 (methane), MQ5 (natural gas and LPG), and MQ306A
(LPG and butane).

What is an MQ3 Alcohol Sensor?

The MQ3 alcohol gas sensor is a module used for detecting alcohol, CH4, benzene,
gasoline, hexane, CO, and LPG. It has a sensitive material SnO2 for alcohol gas detection,
with lower electrical conductivity in the fresh air. It is a semiconductor alcohol gas sensor
that detects or monitors the presence or absence of alcohol. It is also known
as chemiresistors because sensing of the sensitive material depends on the resistance
change when the sensor is exposed to alcohol gas.

Figure 5.13: MQ3 Alcohol Sensor

When the sensor is pointed closer to the alcohol gas, the SnO2 conductivity increases.
The increase in sensor conductivity is directly proportional to the alcohol concentration.
Therefore, the alcohol concentration is measured by any microcontroller very easily. The
MQ3 alcohol gas sensor is very fast and has a high sensitivity to alcohol, smoke, and
gasoline. An Alcohol detector can be made using this alcohol sensor.

Dept. OF ECE, SEAGI, TIRUPATI 49


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

The concentration of alcohol gas sensing range in fresh air or atmosphere by the
MQ3 sensor is 0.04mg/L-4 mg/L, which is acceptable for breathalyzers. It consumes 150
mA and operates with a 5V power supply at -10°C to 50°C temperature.

Pin Configuration and Structure:

The configuration and structure of the MQ3 alcohol sensor are shown in the
figure below. It consists of 2 H-pins for supply and ground connection, 2 A-pins
connected to the power supply, and 2 B-pins for output and ground connection. Since A-
pins and B-pins can be interchanged.

Figure 5.14: MQ3 Sensor Configuration

Inside the MQ3 alcohol gas sensor, the resistance over A and B varies based on the
alcohol detection. As the level of alcohol concentration detection increases, the resistance
of the sensor decreases.The MQ3 alcohol gas sensor consists of an AL2O3 micro-ceramic
tube, a sensitive layer of tin dioxide (SnO2), a measuring electrode, and a heater attached
to a grid made of stainless steel and plastic. The heater is necessary for providing the
required conditions for the operation of sensitive components. The MQ-3 alcohol gas
sensor has 6-pin, of which 4-pins are used to extract the signal and 2-pins are used to
provide the heating current.

Dept. OF ECE, SEAGI, TIRUPATI 50


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

Figure 5.15: MQ3 Sensor Structure

This alcohol sensor can generate an analogue output from the Ao pin (ranging from
0-5V) relating to the available alcohol gas concentration, otherwise use the built-
in/onboard potentiometer to get a digital output (0 or 1) from the Do pin (Do LED is used
to monitor the presence of alcohol gas concentration) for a specific gas concentration.

The manual calibration of the onboard potentiometer of the sensor is possible to


change the digital output sensitivity and set the threshold value. If the concentration of
alcohol vapor is above the threshold value (set by using an onboard potentiometer), then
the output of the digital pin will be low. This is monitored easily when the Do LED glows.
In addition, turning the potentiometer clockwise increases the sensitivity of the sensor.

MQ3 Alcohol Sensor Module Pin Out/Pin Diagram:

The MQ3 alcohol sensor comes in a 4-pin gas sensor module. The pin configuration/pin
diagram is shown in the figure below.

Dept. OF ECE, SEAGI, TIRUPATI 51


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

Figure 5.16: Pin Configuration of MQ3 Module

VCC: This pin refers to the positive power supply. To power up the sensor, the 5V
positive supply is connected to this pin.

GND: This pin refers to the common ground connection.

Digital Output (Do): This pin generates the digital output signal by varying threshold
limits with the help ofan onboard potentiometer. This pin is to represent the digital output
as 0 or 1 based on the alcohol gas present in the air.

Analog Output (Ao): This pin generates an analogue output signal in the range of 0V to
5V and it depends on the alcohol gas intensity.

MQ3 Alcohol Sensor Features:

Dept. OF ECE, SEAGI, TIRUPATI 52


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

Technical Specifications:

The MQ3 alcohol sensor technical specifications are listed below.

• It requires a power supply of 5VDC (@ 165mA heater ON / 60mA heater off).


• Consumes 150mA current.
• Digital output Do: 0 and 1 TTL digital (0.1V and 5V).
• Analog output Ao: 0.1V to 0.3V (relates to pollution), voltage concentration is
maximum of 4V.
• Alcohol Concentration detection: 0.05 mg/L to 10 mg/L.
• Interface: one TTL compatible input (HSW) and one TTL compatible output (ALR).
• Heater consumes: <750mW.
• Resistance of the heater: 33ohms±5%.
• Operating temperature: -10°C to 50°C (14°F to 122°F).
• Storage temperature: 20°C to 70°C.
• The load resistance is 200kilo ohms.
• Sensitivity Rs: ≥5: Rs (in the air) / Rs (0.4mg/L Alcohol).
• Sensing resistance Rs: 1Mega ohms to 8Mega ohms @ 0.4mg/L alcohol.
• Sensor dimensions:32x22x16mm.
• Humidity: <95%RH.
• Oxygen concentration: 21%
• Slope rate: ≤0.6.
• Preheating duration: 20seconds.

Circuit Diagram of MQ3 Alcohol Sensor/How to Connect:

Now, let’s have a look at how to interface the MQ3 alcohol sensor with
the Arduino UNO. In this case, the analogue output pin of the MQ3 sensor is used for
proper sensor calibration. The circuit diagram/how to use the MQ3 alcohol sensor with
the Arduino is shown in the figure below. The components required are;

Dept. OF ECE, SEAGI, TIRUPATI 53


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

Figure 5.17: Interfacing MQ3 with Arduino

• Arduino UNO.
• MQ3 alcohol sensor.
• 5V positive power supply.
• Connecting wires.
• Serial monitor to upload the Arduino code and observe the output.

Connect the MQ3 Sensor to Arduino UNO as per the above diagram.

The 5V operating voltage terminal of the Arduino is connected to the VCC pin of the
MQ3 alcohol sensor. The analogue output pin of the sensor is connected to the Ao pin of
the Arduino board. Note that an analogue output pin is used, and the digital output pin of
the sensor is left. The GND pin of the MQ3 sensor is connected to the GND pin of the
Arduino.

Dept. OF ECE, SEAGI, TIRUPATI 54


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

Calibrate the sensor and set the threshold value by using an in-built potentiometer to
detect and monitor alcohol concentration. Similar to the above way MQ3 Alcohol sensor
can also be interfaced with the other microcontroller.

Upload the Arduino code below in Arduino IDE to observe the analogue output of the
sensor.
To upload the Arduino code, select the Arduino board from the tools board and COM
port, to which the Arduino is connected from the tools.

5.7. ARDUINO CODE

#define analog pin0 (A0 pin of Arduino connected to the analog output pin of MQ3
sensor)

Float sensor value; (defines the sensor value to save the analog output of sensor)

Void setup () {

Serial. Begin (115200); (serial communication is set to 115200 baud rate)

Serial. Print (“MQ3 is warning up”);

Delay (120000); //2 min warmup time (delay of 2 min to preheat the sensor for
operation at required temperature)

Void loop ()

Sensor value= analog Read (analog pin);

Serial. Print (“sensor value:”);

Dept. OF ECE, SEAGI, TIRUPATI 55


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

Serial. Print (sensor value);

Delay (2000); (This process is repeated, and the output is displayed on the serial
monitoring every second)

Applications:

The applications of the MQ3 alcohol sensor are given below,

• Used as a gas level over-limit alarm.


• Portable alcohol detector.
• Breathalyzer.
• Stand-alone sensing module.
• Used in environmental monitoring equipment.
• Vehicle alcohol detector.

Figure5.18: DHT 11 sensor

Dept. OF ECE, SEAGI, TIRUPATI 56


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

5.8. DHT11
The DHT11 is a commonly used Temperature and humidity sensor that comes
with a dedicated NTC to measure temperature and an 8 -bit microcontroller to output the
values of temperature and humidity as serial data.

DHT11 Specifications:

• Operating Voltage: 3.5V to 5.5V


• Operating current: 0.3mA (measuring) 60uA (standby)
• Output: Serial data
• Temperature Range: 0°C to 50°C
• Humidity Range: 20% to 90%
• Resolution: Temperature and Humidity both are 16-bit
• Accuracy: ±1°C and ±1%

Where to use DHT11 Sensors

The DHT11 is a commonly used Temperature and humidity sensor. The sensor
comes with a dedicated NTC to measure temperature and an 8 -bit microcontroller to
output the values of temperature and humidity as serial data. The sensor is also factory
calibrated and hence easy to interface with other microcontrollers.

The sensor can measure temperature from 0°C to 50°C and humidity from 20% to 90%
with an accuracy of ±1°C and ±1%. So, if you are looking to measure in this range then
this sensor might be the right choice for you.

Dept. OF ECE, SEAGI, TIRUPATI 57


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

CHAPTER 6
Internet Of Things

Dept. OF ECE, SEAGI, TIRUPATI 58


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

6.1. INTRODUCTION
What Is the Internet of Things (IoT)
The Internet of Things may be a hot topic in the industry but it’s not a new
concept. In the early 2000’s, Kevin Ashton was laying the groundwork for what would
become the Internet of Things (IoT) at MIT’s Auto ID lab. Ashton was one of the pioneers
who conceived this notion as he searched for ways that Proctor & Gamble could improve
its business by linking RFID information to the Internet. The concept was simple but
powerful. If all objects in daily life were equipped with identifiers and wireless
connectivity, these objects could be communicated with each other and be managed by
computers. In a 1999 article for the RFID Journal Ashton wrote:
“If we had computers that knew everything there was to know about things—
using data they gathered without any help from us -- we would be able to track and count
everything, and greatly reduce waste, loss and cost. We would know when things needed
replacing, repairing or recalling, and whether they were fresh or past their best. We need
to empower computers with their own means of gathering information, so they can see,
hear and smell the world for themselves, in all its random glory. RFID and sensor
technology enable computers to observe, identify and understand the world—without the
limitations of human-entered data.”
At the time, this vision required major technological improvements. After all, how
would we connect everything on the planet? What type of wireless communications could
be built into devices? What changes would need to be made to the existing Internet
infrastructure to support billions of new communication devices? What would power
these devices? What must be developed to make the solutions cost effective? There were
more questions than answers to the IoT concepts in 1999.
Today, many of these obstacles have been solved. The size and cost of wireless
radios has dropped tremendously. IPv6 allows us to assign a communications address to
billions of devices. Electronics companies are building Wi-Fi and cellular wireless
connectivity into a wide range of devices. ABI Research estimates over five billion
wireless chips will ship in 2013.2. Mobile data coverage has improved significantly with
many networks offering broadband speeds. While not perfect, battery technology has

Dept. OF ECE, SEAGI, TIRUPATI 59


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

improved, and solar recharging has been built into numerous devices. There will be
billions of objects connecting to the network within the next several years. For example,
Cisco’s Internet of Things Group (IOTG) predicts there will be over 50 billion connected
devices by 2020.
IoT describes a system where items in the physical world, and sensors within or
attached to these items, are connected to the Internet via wireless and wired Internet
connections. These sensors can use various types of local area connections such as RFID,
NFC, Wi-Fi, Bluetooth, and Zigbee. Sensors can also have wide area connectivity such
as GSM, GPRS, 3G, and LTE. The Internet of Things will:
• Connect both inanimate and living things: Early trials and deployments of Internet
of Things networks began with connecting industrial equipment. Today, the vision of IoT
has expanded to connect everything from industrial equipment to everyday objects. The
types of items range from gas turbines to automobiles to utility meters. It can also include
living organisms such as plants, farm animals and people. For example, the Cow Tracking
Project in Essex uses data collected from radio positioning tags to monitor cows for illness
and track behavior in the herd. Wearable computing and digital health devices, such as
Nike+ Fuel band and Fitbit, are examples of how people are connecting on the Internet
of Things landscape. Cisco has expanded the definition of IoT to the Internet of
Everything (IoE), which includes people, places, objects and things. Basically, anything
you can attach to a sensor and connectivity can participate in the new connected
ecosystems.
• Use sensors for data collection:
The physical objects that are being connected will possess one or more sensors. Each
sensor will monitor a specific condition such as location, vibration, motion and
temperature. In IoT, these sensors will connect to each other and to systems that can
understand or present information from the sensor’s data feeds. These sensors will
provide new information to a company’s systems and to people.
• Change what types of items communicate over an IP Network: In the past, people
communicated with people and with machines. Imagine if all of your equipment had the
ability to communicate. What would it tell you? IoT-enabled objects will share

Dept. OF ECE, SEAGI, TIRUPATI 60


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

information about their condition and the surrounding environment with people, software
systems and other machines. This information can be shared in Realtime or collected and
shared at defined intervals. Going forward, everything will have a digital identity and
connectivity, which means you can identify, track and communicate with objects. IoT
data differs from traditional computing. The data can be small in size and frequent in
transmission. The number of devices, or nodes, that are connecting to the network are
also greater in IoT than in traditional PC computing. Machine-to-Machine
communications and intelligence drawn from the devices and the network will allow
businesses to automate certain basic tasks without depending on central or cloud-based
applications and services. These attributes present opportunities to collect a wide range
of data but also provide challenges in terms of designing the appropriate data networking
and security.
What It Means for Your Business?
IoT impacts every business. Mobile and the Internet of Things will change the
types of devices that connect into a company’s systems. These newly connected devices
will produce new types of data. The Internet of Things will help a business gain
efficiencies, harness intelligence from a wide range of equipment, improve operations
and increase customer satisfaction. IoT will also have a profound impact on people’s
lives. It will improve public safety, transportation and healthcare with better information
and faster communications of this information. While there are many ways that the
Internet of Things could impact society and business, there are at least three major
benefits of IOT that will impact every business, which include: communication, control
and cost savings.

6.2. The Three Causes of IoT


Communication: IoT communicates information to people and systems, such as state
and health of equipment (e.g. It’s on or off, charged, full or empty) and data from sensors
that can monitor a person’s vital signs. In most cases, we didn’t have access to this
information before or it was collected manually and infrequently. For example, an IOT-
enabled HVAC system can report if its air filter is clean and functioning properly. Almost

Dept. OF ECE, SEAGI, TIRUPATI 61


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

every company has a class of assets it could track. GPS-enabled assets can communicate
their current location and movement. Location is important for items that move, such as
trucks, but it’s also applicable for locating items and people within an organization. In
the healthcare industry, IoT can help a hospital track the location of everything from
wheelchairs to cardiac defibrillators to surgeons. In the transportation industry, a business
can deliver real-time tracking and conditioning of parcels and pallets. For example,
Maersk can use sensors to track the location of a refrigerated shipping container and its
current temperature.
Control and Automation: In a connected world, a business will have visibility into a
device’s condition. In many cases, a business or consumer will also be able to remotely
control a device. For example, a business can remotely turn on or shut down a specific
piece of equipment or adjust the temperature in a climate-controlled environment.
Meanwhile, a consumer can use IoT to unlock their car or start the washing machine.
Once a performance baseline has been established, a process can send alerts for anomalies
and possibly deliver an automated response. For example, if the brake pads on a truck are
about to fail, it can prompt the company to take the vehicle out of service and
automatically schedule maintenance.

Cost Savings: Many companies will adopt IoT to save money. Measurement provides
actual performance data and equipment health, instead of just estimates. Businesses,
particularly industrial companies, lose money when equipment fails. With new sensor
information, IoT can help a company save money by minimizing equipment failure and
allowing the business to perform planned maintenance. Sensors can also measure items,
such as driving behavior and speed, to reduce fuel expense and wear and tear on
consumables. New smart meters in homes and businesses can also provide data that helps
people understand energy consumption and opportunities for cost savings.

6.3. How To Get Started:


These are just a few examples of how IoT can help a business save money,
automate processes and gain new insight into the business. To reap the benefits IoT can

Dept. OF ECE, SEAGI, TIRUPATI 62


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

provide, a business should address at least the following four items:


1. Define what you’d like to learn from sensors: Over the next three years, most of the

devices purchased will have sensors and many existing items can be retrofitted with
sensors. This will produce a wide range of new data sources for people and systems to
use to improve their lives and existing business processes. Within a business setting, IT
must define what types of information can be obtained from these sensors and work with
business leaders to define which business processes can be improved with this new IoT
information. For example, sensor data that highlights anomalies in equipment vibration
can be used to predict and avoid equipment failure.
2. Build an IOT network and security foundation: Many industrial IoT deployments

have used proprietary networks. Instead of building proprietary networks, IT should


connect IoT devices with standards-based IP networks. An IP-based network will help
businesses deliver the performance, reliability and interoperability that are required to
support global IoT networks and connections with partner ecosystems. Additionally,
many businesses are focused on building security strategies for smartphones and tablets,
but this is just one aspect ofthe new mobile world. The proliferation of connected sensors
and equipment provides new security concerns. As IT embraces IoT, it needs to ensure it
has built safeguards into the solution including security procedures such as hardware
encryption, physical building security and network security for data in transit. Identity
and authentication structures will also need to be updated to support “things” as well as
people.
3. Collect as much data as possible: Businesses that don’t plan carefully for IoT will

be overwhelmed with the volume and variety of data that IoT will generate. While each
sensor may only produce a small amount of data, a company will be collecting data from
thousands to millions of sensors. Firms must build a data collection and analytics strategy
that supports this new torrent of information in a scalable and cost-effective manner. Big
data technology, such as Hadoop and NoSQL, can give companies the ability to rapidly
collect, store and analyze large volumes of disparate IoT data. A company should collect
any data that is relevant to existing processes. If possible and cost-effective, a company
should also collect additional data that will enable the business to answer new questions

Dept. OF ECE, SEAGI, TIRUPATI 63


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

in the future.

4. Review the size and scale of IoT providers: IoT is a complicated landscape with

numerous categories and many vendors within each category. The four main categories
of an IoT solution are: a sensor(s) and radio(s) that often sits in the machine, an M2M
device-management platform, a solution delivery platform and apps that enable IoT
devices to report or act on data. While there are many vendors, no single vendor offers a
complete solution without building partnerships. As a firm begins its IoT voyage, IT and
line of business executives should build a cross-functional team to evaluate strategic
partners. The team should evaluate the financial position of the vendors, industry
knowledge, partnerships and breadth of offerings.

6.4. Advantages of IOT

Here are some advantages of IoT:

1. Data: The more the information, the easier it is to make the right decision. Knowing
what to get from the grocery while you are out, without having to check on your own, not
only saves time but is convenient as well.

2. Tracking: The computers keep track both on the quality and the viability of things at
home. Knowing the expiration date of products before one consumes them improves
safety and quality of life. Also, you will never run out of anything when you need it at
the last moment.

3. Time: The amount of time saved in monitoring and the number of trips done otherwise
would be tremendous.

4. Money: The financial aspect is the best advantage. This technology could replace
humans who oversee monitoring and maintaining supplies.

Dept. OF ECE, SEAGI, TIRUPATI 64


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

6.5. The Internet of Things applications


• Smart home. Smart Home clearly stands out, ranking as the highest Internet of
Things application on all measured channels.

• Wearable’s.

• Smart City.

• Smart grids.

• Industrial internet.

• Connected car.

• Connected Health (Digital health/Telehealth/Telemedicine).

• Smart retail.

6.6. BUZZER
Magnetic Transducer
Magnetic transducers contain a magnetic circuit consisting of an iron core with a
wound coil and a yoke plate, a permanent magnet and a vibrating diaphragm with a
movable iron piece. The diaphragm is slightly pulled towards the top of the core by the
magnet's magnetic field. When a positive AC signal is applied, the current flowing
through the excitation coil produces a fluctuating magnetic field, which causes the
diaphragm to vibrate up and down, thus vibrating air. Resonance amplifies vibration
through resonator consisting of sound hole(s) and cavity and produces a loud sound.
Magnetic Buzzer (Sounder)
Buzzers like the TMB-series are magnetic audible signal devices with built-in
oscillating circuits. The construction combines an oscillation circuit unit with a detection
coil, a drive coil and a magnetic transducer. Transistors, resistors, diodes and other small
devices act as circuit devices for driving sound generators. With the application of
voltage, current flows to the drive coil on primary side and to the detection coil on the
secondary side.
The amplification circuit, including the transistor and the feedback circuit, causes
vibration. The oscillation current excites the coil, and the unit generates an AC magnetic

Dept. OF ECE, SEAGI, TIRUPATI 65


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

field corresponding to an oscillation frequency. This AC magnetic field magnetizes the


yoke comprising the magnetic circuit. The oscillation from the intermittent magnetization
prompts the vibration diaphragm to vibrate up and down, generating buzzer sounds
through the resonator.

Recommended Driving Circuit for Magnetic Transducer


Introduction of Magnetic Buzzer (Transducer)
Specifications:
Rated Voltage: A magnetic buzzer is driven by 1/2 square waves (V o-p).
Operating Voltage: For normal operating. But it is not guaranteed to make the
minimum Sound Pressure Level (SPL) under the rated voltage.
Consumption Current: The current is stably consumed under the regular operation.
However, it normally takes three times the current time now of starting to work.
Direct Current Resistance: The direct current resistance is measured by ammeter
directly.
Sound Output: The sound output is measured by decibel meter. Applying rated voltage
and 1/2 square waves, and the distance of 10 cm.
Rated Frequency: A buzzer can make sound on any frequencies, but we suggest that
the highest and the most stable SPL comes from the rated frequency.
Operating Temp.: Keep working well between -30℃ and +70℃.
How to choose:
Driving methods: A X series with built drive circuit will be the best choice when we
cannot provide frequency signal to a buzzer, it only needs direct current.
Dimension: Dimension affects frequency, small size results in high frequency.
Voltage: Depend on V o-p (1/2 square waves)
Fixed methods: From the highest cost to the lowest- DIP, wires/ connector, SMD.
Soldering methods: AS series is soldered by hand, the frequency is lower because of
the holes on the bottom.On the other hand, we suggest AC series for the reflow
soldering, the reliability is better.

Dept. OF ECE, SEAGI, TIRUPATI 66


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

CHAPTER 7
RESULT AND ANALYSIS

Dept. OF ECE, SEAGI, TIRUPATI 67


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

STEP-1
Proposed Air Quality Monitoring System Model

Figure 7.1: Proposed model non-working condition.

Dept. OF ECE, SEAGI, TIRUPATI 68


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

STEP-2
Proposed model working condition of the the kit

Figure 7.2: Proposed Model Working Condition

Dept. OF ECE, SEAGI, TIRUPATI 69


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

STEP-3
Connecting the kit with Thingspeak software

Figure 7.3: Connecting Kit with ThingSpeak

Dept. OF ECE, SEAGI, TIRUPATI 70


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

STEP-4
Detected temperature or Command display on the LCD

Figure 7.4: Command display on LCD

Dept. OF ECE, SEAGI, TIRUPATI 71


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

CHAPTER-8
CONCLUSION AND FUTURE SCOPE

Dept. OF ECE, SEAGI, TIRUPATI 72


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

8.1. CONCLUSION
The data are automatically stored in the database and this information can be used
by the authorities to take prompt action. It also helps normal people to know about the
number of pollutants in their area and to take control measures. This is a robust system
which is very useful in industries because of the increasing pollution due to the increase
in industries. This system is user friendly, and the cost of the product is affordable
monitoring. The sensor was giving us a value of 90 when there was no gas near it and the
safe level of air quality is 350 PPM and it should not exceed 1000 PPM. When it exceeds
the limit of 1000 PPM, then it starts to cause Headaches, sleepiness and stagnant, stale,
stuffy air and if exceeds beyond 2000 PPM then it can cause increased heart rate and
many other diseases.

8.2. FUTURE SCOPE

• Expansion of IoT Infrastructure: As IoT infrastructure continues to expand,


especially with the advent of 5G networks and the proliferation of connected
devices, the scalability and coverage of air quality monitoring systems will increase.
This will enable more comprehensive monitoring in urban and rural areas alike.

• Integration with Smart Cities Initiatives: Many cities are embracing the concept
of smart cities, which leverage technology to improve urban infrastructure and
services. IoT-based air quality monitoring systems will play a crucial role in these
initiatives by providing real-time data for informed decision-making regarding
environmental policies, urban planning, and public health interventions.

• Advancements in Sensor Technology: Ongoing advancements in sensor


technology, including miniaturization, increased accuracy, and lower costs, will
enhance the capabilities of IoT-based air quality monitoring systems.

Dept. OF ECE, SEAGI, TIRUPATI 73


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

• Integration with Health and Wellness Platforms: There is growing awareness of the
impact of air quality on human health and well-being. IoT-based air quality monitoring
systems can integrate with health and wellness platforms to provide personalized
recommendations and alerts based on an individual's exposure to pollutants.

• Collaboration and Partnerships: Collaboration between governments, private sector


entities, research institutions, and community organizations will be crucial for the success
of IoT-based air quality monitoring initiatives. Partnerships can help address challenges
such as data standardization, interoperability, and funding.

• Environmental Regulations and Standards: Increasing environmental regulations and


standards worldwide will drive the adoption of IoT-based air quality monitoring systems
by governments, industries, and communities. Compliance with these regulations will
require accurate and reliable monitoring of air quality parameters.

• The future of IoT-based air quality monitoring and alerting systems looks promising, with
opportunities for technological advancements, integration with smart city initiatives,
data-driven insights, and collaboration among stakeholders. These systems have the
potential to significantly improve air quality management and public health outcomes in
the years to come.

Dept. OF ECE, SEAGI, TIRUPATI 74


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

REFERENCES
[1] Rd. K Gomathy, Article: A Study on the recent Advancements in Online Surveying,
International Journal of Emerging technologies and Innovative Research (JETIR)
Volume 5 | Issue 11 | ISSN: 2349- 5162, P. No:327-331, Nov-2018.

[2] C.K. Gomathy. (2010),"Cloud Computing: Business Management for Effective


Service Oriented Architecture" International Journal of Power Control Signal and
Computation (IJPCSC), Volume 1, Issue IV, Oct - Dec 2010, P. No:22-27, ISSN: 0976-
268X.

[3] Dr.C.K. Gomathy, C K Hemalatha, Article: A Study on Employee Safety and Health
Management International Research Journal of Engineering and Technology (Irjet)-
Volume: 08 Issue: 04 | Apr 2021.

[4] Rd. K Gomathy, Article: A Study on the Effect of Digital Literacy and information
Management, IAETSD Journal for Advanced Research in Applied Sciences, Volume 7
Issue 3, P. No-51-57, ISSN NO: 2279- 543X, Mar/2018.

[5] Rd. K Gomathy, Article: An Effective Innovation Technology in Enhancing Teaching


and Learning of Knowledge Using It Methods, International Journal of Contemporary
Research in Computer Science and Technology (Incrust) E-Assn: 2395-5325 Volume3,
Issue 4, P. No-10-13, April ’2017.

[6] Rd. K Gomathy, Article: Supply chain Impact of importance and Technology in
Software Release Management, International Journal of Scientific Research in Computer
Science Engineering and Information Technology (IJSRCSEIT) Volume 3 | Issue 6 |
ISSN: 2456-3307, P. No :1-4, July-2018.

[7] C. K. Gomathy and S. Rajalakshmi, "A software quality metric performance of


professional management in service-oriented architecture," Second International

Dept. OF ECE, SEAGI, TIRUPATI 75


IOT BASED AIR QUALITY MONITORING AND ALERTING SYSTEM

Conference on Current Trends in Engineering and Technology - ICCTET 2014, 2014, pp.
41-47, Doi: 10.1109/ICCTET.2014.6966260.

[8] C K Gomathy and V Geetha. Article: A Real Time Analysis of Service based using
Mobile Phone Controlled Vehicle using DTMF for Accident Prevention. International
Journal of Computer Applications 138(2):11-13, March 2016. Published by Foundation
of Computer Science (FCS), NY, USA, ISSN No: 0975-8887.

[9] C K Gomathy and V Geetha. Article: Evaluation on Ethernet based Passive Optical
Network Service Enhancement through Splitting of Architecture. International Journal of
Computer Applications 138(2):14-17, March 2016. Published by Foundation of
Computer Science (FCS), NY, USA, ISSN No: 0975-8887.

[10] "A STUDY ON THE RECENT ADVANCEMENTS IN ONLINE SURVEYING",


International Journal of Emerging Technologies and Innovative Research
(www.jetir.org), ISSN:2349-5162, Vol.5, Issue 11, page no.327-331, November-2018,
Available :http://www.jetir.org/papers/JETIR1811850.pdf

Dept. OF ECE, SEAGI, TIRUPATI 76

You might also like