0% found this document useful (0 votes)
46 views51 pages

Project Report Real

The document describes an air quality monitoring system project report submitted by Shivani for their MCA degree. The project involved developing a device called "Smart-Air" to precisely monitor indoor air quality and transmit real-time data to a cloud-based web server using an IoT sensor network. The web server analyzes the data and issues alerts if air quality declines, allowing corrective action. The Smart-Air device uses various sensors to measure air quality and an LTE modem to transmit data directly to the server.

Uploaded by

Shivani ;
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)
46 views51 pages

Project Report Real

The document describes an air quality monitoring system project report submitted by Shivani for their MCA degree. The project involved developing a device called "Smart-Air" to precisely monitor indoor air quality and transmit real-time data to a cloud-based web server using an IoT sensor network. The web server analyzes the data and issues alerts if air quality declines, allowing corrective action. The Smart-Air device uses various sensors to measure air quality and an LTE modem to transmit data directly to the server.

Uploaded by

Shivani ;
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/ 51

AIR QUALITY MONITORING SYSTEM

A PROJECT REPORT
BY
SHIVANI
ROLL NO. 210581220077

SUBMITTED TO
HIMACHAL PRADESH UNIVERSITY -SHIMLA

IN
PARTIAL FULLFILLMENT OF THE REQUIREMENTS
FOR THE DEGREE
OF

MASTER OF COMPUTER APPLICATIONS (MCA)


SESSION: (2021-2023)

Under the supervision of


PROF. MANU SOOD
(PROFESSOR)

DEPARTMENT OF COMPUTER SCIENCE


HIMACHAL PRADESH UNIVERSITY
SHIMLA-171005,1NDIA

1
1

DECLARATION

I ,”Shivani D/O Sh. Surinder Paul”, having examination Roll no. 210581220077, a
student of MCA 4th semester,Department of Computer Science, Himachal Pradesh
University, Shimla hereby declare that the project work entitled “Air Quality
Monitoring System” submitted with the Department of Computer Science,
Himachal Pradesh University, Shimla as a partial fulfillment of the requirement for
the award of the degree in Master in Computer Applications (MCA) has been carried
out by me under the guidance of “Prof. Manu Sood”.

Shivani
Exam Roll No. :- 210581220077
Class Roll No. :- 21176
Department of Computer Science
Himachal Pradesh University

Dated:

1
2

CERTIFICATE FROM ORGANIZATION___________________

2
3

DEPARTMENT OF COMPUTER SCIENCE


HIMACHAL PRADESH UNIVERSITY
SHIMLA-171005,INDIA

CERTIFICATE

This is to certify that the project report entitled “Air Quality


Monitoring System” Department of Computer Science, Himachal Pradesh
University , Shimla-171005 in partial fulfillment of the requirement for the degree of
MASTER OF COMPUTER APPLICATION (MCA)has been carried out by Ms. Shivani
with enrollment no. 210581220077 under my guidance during the 4th semester of MCA
programme.

Dated:
Prof. Manu Sood
Department of Computer Science
Himachal Pradesh University
Shimla-171005

3
4

ACKNOWLEDGEMENT

Presentation, inspiration and motivation have always played a key role in the
success of any venture.

I feel to acknowledge my indebtedness and deep sense of gratitude to my guide


Prof. Manu Sood whose valuable guidance and kind supervision given to me
throughout the course which shaped the present work as its show.

I express my sincere thanks to Prof. Jawahar Thakur, HOD, Department of


Computer Science, Himachal Pradesh University, Shimla, for his generous
guidance,help and useful suggestions.

Shivani
Roll No. 21176

4
5

Table of Contents
S.NO. CONTENTS PAGE NO.

1. Introduction 4

2 Hardware and software components 5-8

3 Feasibility study 9-15

4. Circuit Diagram 16-25

5 Introduction to software 26-30

6 Identification 31-34

7 Code sketch 35-40

8 Data on Thing speak 40-45

9 Log book 46-50

5
6

CHAPTER 1

INTRODUCTION

An IOT -based indoor air quality monitoring platform based on integration of


cloud computing and IOT is presented in this research. Also, a device called
“Smart-Air” was developed to precisely monitor indoor air quality and

efficiently transmit real time data to a cloud computing-based web server

using an IOT sensor network.

The cloud computing based web server introduced in this platform analyzes real-time
data and adds visual effects to illustrate the conditions of the indoor air quality. In
addition, the web server was designed to issue alert mobile application users or
facility managers of moderate or poor air quality so that responsible parties can take
immediate remedial action. Real-time monitoring and a rapid alert system produce an
efficient platform for improving indoor air quality.

Major contributions of the proposed study are as follows:


(i)We propose the use of the Smart-Air for the precise monitoring of indoor air quality.
(ii)We propose the utilization of an IOT for efficient monitoring of real-time data.
(iii)We propose the adoption of cloud computing for real-time analysis of indoor air
quality.

(iv) We originally developed a mobile application to make the proposed IoT system
with features of anytime, anywhere.

6
7

(v) The device has been tested for reliability of the data and the platform has been implemented in a
building to test its feasibility.

2. Smart-Air

An accurate data measurement of indoor air quality is the most important factor for
the platform. Thus, Smart-Air was developed to collect accurate and reliable
data for indoor air quality monitoring. Because the monitoring area is not
constant, the device was designed to be easily customized to an environment by
using an expandable interface. Thus, various types of sensors can be installed or
adjusted based on the environment. Also, a Long-Term Evolution (LTE) modem is
mounted in the device to transmit detected data directly to the web server for
classifying and visualizing air quality. For most IOT platforms, gateway or data
loggers are installed to gather and transmit data wireless to the web server. However,
in this study, a micro controller was installed in the device to gather the data from
the sensors and transmit it to the web server using the LTE modem, eliminating
the need for a gateway and a data logger.

The most important purpose of Smart-Air is to precisely detect air quality in the
perception layer of the platform that a primitive concept design of the device .

This device has an expandable interface such that multiple sensors can be
installed simultaneously or easily added according to monitoring requirements. In
the present study, the Smart-Air device consists of a laser dust sensor, a volatile
organic compound (VOC) sensor, a carbon monoxide (CO) sensor, a carbon
dioxide (CO2) sense LED strip was installed in the center of the device to .The
AQI is an index for reporting daily air quality. It tells you how clean or polluted
your air is, and what associated health effects might be a concern for you. the AQI
for five major air pollutants regulated by the Clean Air Act: ground-level ozone, particle pollution
(also known as particulate matter), carbon monoxide, sulfur dioxide, and nitrogen dioxide.

For each of these pollutants, EPA has established national air quality standards to protect public
health. Ground-level ozone and airborne particles are the two pollutants that pose the greatest threat
to human health in this country.

7
8

Io T Monitoring System components

IOT- based air pollution monitoring systems comprise several components that work

together to collect and analyze air quality data. The components include:

1.Sensors: Sensors are the primary components of IOT-based air pollution monitoring

systems. They measure various air quality parameters such as particulate matter, carbon

monoxide, sulfur dioxide, and nitrogen oxides. The sensors can be classified into two

categories: physical and chemical sensors. Physical sensors measure parameters such as

temperature, humidity, and pressure, while chemical sensors measure air pollutants.

8
9

2. Micro controller: The micro-controller is the brain of Io T-based air pollution


monitoring systems. It receives data from the sensors, processes it, and sends it to the
cloud server. The micro controller is usually a microprocessor such as

Arduino, Raspberry Pi, or similar devices.

3.Communication Module: The communication module is responsible for transmitting


data from the micro controller to the cloud server. Communication modules can use
various wireless technologies such as Wi-Fi, Bluetooth, or cellular networks.

4.Cloud Server: The cloud server is a centralized platform for storing, analyzing, and

sharing air quality data. It collects data from the communication module and stores it in a

database. The cloud server also provides web and mobile applications for users to access
the data

5.Power Supply: IOT -based air pollution monitoring systems require a power supply to
operate. In case of permanent installations external power supply is provided and
batteries are provided for portable devices.

6. Enclosure: The enclosure is the outer covering that protects the components from
environmental factors such as dust, water, and temperature.

9
10

CHAPTER 2

HARDWARE AND SOFTWARE REQUIREMENTS

HARDWARE

➢ NodeMCUESP8266

➢ Breadboard

➢ MQ135sensor

➢ Jumper-wires

➢ i2c OLED display

SOFTWARE

➢ ARDUINO UNO IDE

➢ Thing Speak

BLOCK DIAGRAM

10
11

The above bock diagram shows how MQ135 air quality sensor’s data is sent to Thing speak.
MQ135 is an analog air pollution sensor which converts the level of toxic gases in the
surrounding to analog values.
The Arduino collects the analog sensor values and converts it to digital value
and sends it to ESP8266 via UART / serial communication.
The ESP8266 connects to Thing speak server via internet. The sent data to Thing
speak can be accessed using a PC or a laptop by logging in to your Thingspeak
account.
Be side Arduino we have a 16 x 2 LCD to display real-time air pollution level and
other stats about air quality sensor. The LCD is connected to I2C adapter which will
reduce the number of wires that connects from Arduino to LCD to four (VCC, GND, SDA
and SC.

Node mcuesp8622

NodeMCU is an open-source LUA based firmware developed for the ESP8266 wifi

chip. By exploring functionality with the ESP8266 chip, NodeMCU firmware comes

with the ESP8266 Development board/kit i.e. NodeMCU Development board.

Since NodeMCU is an open-source platform, its hardware design is open for


edit/modify/build.

NodeMCU Dec Kit/board consist of ESP8266 WiFi enabled chip. TheESP8266 is a


low-cost Wi-Fi chip developed by Repressive Systems with TCP/IP protocol. For more
information about ESP8266, you can refer to the ESP8266 WiFi Module.

11
12

There is Version2 (V2) available for NodeMCU Det Kit i.e. NodeMCU
Development Board v1.0 (Version2), which usually comes in black
colored PCB.

NodeMCU Development board is featured with WiFi capability, analog pin, digital pins,
and serial communication protocols.

To get started with using NodeMCU for IOT applications first we need to know about
how to write/download NodeMCU firmware in NodeMCU Development Boards. And
before that where this NodeMCU firmware will get as per our requirement.

There are online NodeMCU custom builds available using which we can easily get
our custom NodeMCU firmware as per our requirement.

To know more about how to build custom NodeMCU firmware online and download it
refer toGetting started with NodeMCU

ESP 8266 SPECIFICATIONS

Model. NodeMCU ESP8266.


• Type. ESP8266.

• Processor. Tensilica
LX106. .
• RAM. 64 kB.
• Data storage. 96 kB.
• Wireless standard.
802.11 b/g/n. • Frequency.
2,4 GHz

POWERING OF THE ESP8622

12
13

The power required by NodeMCU is 600mA, as ESP8266 pulls as much as


80mA during RF transmissions. During boot or WiFi operation it’s drawing up to
200mA peak current. Thus supply power from Micro-USB Cable is not enough for
NodeMCU Board when we are adding multiple sensors or modules to the Board. This
is because Computer USB port can provide less than500mAof current. Check more
about Nodemcu Power requirement here: Nodemcu ESP8266 Datasheet.

BREADBOARD
A breadboard is derived from two words bread and board. The word breadboard was
initially used to slice the bread pieces. But, it was further named as a breadboard for
its use in electronics around the 1970s. Hence, the term breadboard refers to these
boards only and provides a quick electrical connection.
A breadboard is also categorized as a Solder less board. It means that the
component does not require any soldering to fit into the board. Thus, we can
say that breadboard can be reused. We can easily fit the components by
plugging their end terminal into the board. Hence, a breadboard is often called
a plug board.Let's discuss the materials used for creating the breadboard.

White plastic is the material that is used to create breadboards. Today, most of the
breadboards are Solder less breadboards. We can directly plug in the
electronic components and connect it with the external power supply.

The breadboards are available as per the specified point holes. For example, 400 point
breadboard, 830 point breadboard.

13
14

Breadboards are one of the most fundamental pieces when learning how to build circuits.
In this tutorial, you will learn a little bit about what breadboards are, why they are called
breadboards, and how to use one. Once you are done you should have a basic
understanding of how breadboards work and be able to build a basic circuit on a
breadboard.

JUMPER WIRE

Jumper wires are simply wires that have connector pins at each end, allowing them to be
used to connect two points to each other without soldering. Jumper wires are typically
used with breadboards and other prototyping tools in order to make it easy to change a
circuit as needed. Fairly simple. In fact, it doesn’t get much more basic than jumper wires.

Though jumper wires come in a variety of colors, the colors don’t actually mean anything.
This means that a red jumper wire is technically the same as a black one. But the colors
can be used to your advantage in order to differentiate between types of connections,
such as ground or power.

14
15

MQ135 Sensor

The MQ-135 Gas sensor can detect gases like Ammonia (NH3), sulfur (S), Benzene
(C6H6), CO2, and other harmful gases and smoke. Similar to other MQ series gas sensor,
this sensor also has a digital and analog output pin. When the level of these gases go
beyond a threshold limit in the air the digital pin goes high. This threshold value can be set
by using the on-board potentiometer. The analog output pin, outputs an analog voltage
which can be used to approximate the level of these gases in the atmosphere.

The MQ135 air quality sensor module operates at 5V and consumes around 150mA. It
requires some preheating before it could actually give accurate results.

Details of MQ135 Sensor

The MQ135 is one of the popular gas sensors from the MQ series of sensors that are
commonly used in air quality control equipment. It operates from 2.5V to 5.0V and can
provide both digital and analog output. The pin-outs and important components on an
MQ135 Module is marked below.

Note that all MQ sensors have to be powered up for a pre-heat duration for the sensor to
warm up before it can start working. This pre-heat time is normally between 30 seconds to
a couple of minutes. When you power up the module the power LED will turn on, leave the
module in this state till the pre-heat duration is completed.

15
16

Technical Specifications of MQ135 Gas Sensor

•Operating Voltage: 2.5V to 5.0V•Digital Output:


0V to 5V (TTL Logic ) @ 5V VCC •Analog
Output: 0-5V @ 5V VCC

Detect Harmful Gases using Digital Pin:

The digital output pin of the sensor can be used to detect harmful gases in the
environment. The sensitivity of the digital pin can be controlled by using the 10k
potentiometer. If the gas is detected the indicator LED D0 will turn on and the digital pin
will go from logic high to logic low (0V). The LM393 Op-Amp Compactor IC is used to
compare the actual gas value with the value set using the potentiometer. If the actual gas
value increases than the set value then the digital output pin gets low.

Because of the onboard LM393 compactor IC the MQ135 Gas sensor module can also be
used without the need of an external micro-controller. Simply power up the module and
set the sensitivity of the digital pin using the potentiometer, then when the module detects
the gas the digital pin will go low. This digital pin can directly be used to drive a buzzer or
LED with the help of simple transistors.

Measure PPM Value using Analog Pin:

The Analog output pin of the sensor can be used to measure the PPM value
of the required gas. To do this we need to use an external micro controller like
Arduino. The micro controller will measure the value of analog voltage and
perform some calculations to find the value of Rs/R0 where Rs is the sensor
resistance when gas is present and R0 is sensor resistance at clean air. Once
we find this ratio of Rs/R we can use it to calculate the PPM value of required
gas using the graph below which is taken from the data sheet of MQ13
sensor.

16
17

Entity RelationshipDiagram

17
18

18
19

Chapter 3

FEASIBILITY STUDY

A wide range of industrial operators, including mining, construction, ports, landfill and
the oil and gas industry, are looking more closely at the air quality on and around their
operational sites.

Such operators, also including chemical, processing, agriculture and utilities, are under
increasing pressure to carry out environmental monitoring around their perimeter,
particularly if they are close to population bases.

Boundary monitoring is also important in a situation with several potential pollution


sources, as multiple measurement nodes and local wind speed and direction data can
identify the distance and direction of different pollution sources, by individual pollutant.

Equally important is the ability to distinguish between local pollution sources, where
emissions can potentially be managed directly, and regional or background pollution,
which will require a different approach.

Health and safety of workers on site is important, as well as the exposure of local
communities. Samples of air may be taken for laboratory analysis on an ad or
scheduled basis, but this high level of accuracy cannot completely make up for the
delays levels can be logged – as frequently as every minute – and used to trigger alerts,
as well as maintaining and sharing an ongoing database, showing daily patterns and
historical information.

19
20

Arduino IDE Software

Arduino Software (IDE) makes it easy to write code and upload it to the board
offline. We recommend it for users with poor or no internet connection. This
software can be used with any Arduino board.
here are currently two versions of the Arduino IDE, one is the IDE 1.x.x and
the other is IDE 2.x. The IDE 2.x is new major release that is faster and even
more powerful to the IDE 1.x.x. In addition to a more modern editor and a
more responsive interface it includes advanced features to help users with
their coding and debugging.

The following steps can guide you with using the offline IDE (you can choose
either IDE 1.x.x or IDE 2.x):

1.Download and install the Arduino Software IDE:


•Arduino IDE 1.x.x (Windows,Mac OS,Linux,Portable IDEfor Windows and
Linux,ChromeOS).
•Arduino IDE 2.x

2.Connect your Arduino board to your device.

3.Open the Arduino Software (IDE).


The Arduino Integrated Development Environment - or Arduino Software (IDE) -
connects to the Arduino boards to upload programs and communicate with
them. Programs written using Arduino Software (IDE) are called
sketches. These sketches are written in the text editor and are saved with the
file extension .ino.

Using the offline IDE 1.x.x


The editor contains the four main areas:
1.A Toolbar with buttons for common functions and a series of menus. The
toolbar buttons allow you to verify and upload programs, create, open, and
save sketches, and open the serial monitor.

20
21

2.The message area, gives feedback while saving and exporting and also
displays errors.
3.The text editor for writing your code.
4. The text console displays text output by the Arduino Software (IDE), including
complete error messages and other information.
The bottom right-hand corner of the window displays the configured board and
serial port.

5. Connect your Arduino or Genuine board to your computer.


6. Now, you need to select the right core & board. This is done by navigating to
Tools > Board > Arduino AVR Boards > Board. Make sure you select the board that
you are using. If you cannot find your board, you can add it from Tools > Board
> Boards Manager.

21
22

1. Connect your Arduino or Gen uino board to your computer.

2. Now, you need to select the right board & port. This is done from the toolbar.
Make sure you select the board that you are using. If you cannot find your
board, you can add it from the board manager in the sidebar.
Selecting a board & port.

3. Let’s try an example: navigate to File > Examples > 01.Basics > Blink.
Opening an example.
4. To upload it to your board, simply click on the arrow in the top
left corner. This process takes a few seconds, and it is important
to not disconnect the board during this process. If the upload is
successful, the message "Done uploading" will appear in the
bottom output area.

22
23

5. Once the upload is complete, you should see on your board the yellow LED
with the letter L next to it, start blinking. You can adjust the speed of blinking by
changing the delay number in the parenthesis to 100, and upload the Blink
sketch again. Now the LED should blink much faster.

Congratulations! You have successfully programmed your board to blink its on-
board LED! You can find more information about the Arduino Software (IDE)
here.

Circuit Diagram And Connections

For Designing IOT based air quality monitoring system using Esp8622 and
MQ135 sensor sensor assemble the circuit as shown in the figure given below:

23
24

Installation and settings Arduino IDE :


•If you have not already done, follow the installation and settings of Arduino IDE through
this link https://youtu.be/4Ih39hGcPzg
•Follow the settings of ESP8266 through this link https://youtu.be/G6CqvhXpBKM

•To create the gas sensor project, go in options files-----> New

You can add the library files from sketch-->include library --->manage library

Add all the libraries specified in theprogram

“ ESP8266WiFi.h” “ DNSServer.h” “ESP8266WebServer.h” "WiFiManager.h"

•You can search for the libraries you want to include and click install

Part II: Setting Up Cloud Account on Thingsio.AI


You will get your Device ID. After that, Enter the device name and click on the create and
configure device:

•You will be on your device dashboard: track your device’s special parameters here.This
can be set in the device configuration(default to null)
•you can see your real time and special parameter’s graph

•you can see all your data points

•you can see here your last 5 data points

Click on the “Send trial data” to send a trial data to the server.
Part III: Setting Up NodeMCU
Now switch back to your NodeMCU project.

join sample device code options in http://thingsio.ai/ account and click on the Node MCU.
You will get the sample code from there.

copy and paste the sample code into your IDE

compile the sketch by clicking on the compile icon on the top left corner

connect the node MCU(ESP8266) via the USB cable

Upload the sketch by clicking on the upload icon

24
25

Part IV: Charting and Visualizations on Thing .AI


•Things IO.AI is an Io T Platform for developers. As a developer we understood the pain
of not having a seamless place to connect, analyze and process device data. Many pure
analytic platforms does not offer device management, which is core for the IOT. That is
the reason of Things IO.AI
•Register the account in http://thingsio.ai/#/register.

•You will get the notification for sign up.

•Go in your email address and verify your account. You will get the notification for the
email verification

•After that, sign in your account with your email address and password

•Now, you will be on the project dashboard of your account. Click on the new project
option:

•Click on the add a new device option:•Go in sample device code options in
http://thingsio.ai/ account and click on the Node MCU. You will get the sample code
from there.

•Copy and paste it on your IDE

•compile the sketch by clicking on the compile icon on the top left corner

•connect the node MCU(ESP8266) via the USB cable

•Upload the sketch by clicking on the upload icon

•Now, click on the configure device option

•You can set the special parameters (this is tracked on the dashboard) & transform it
accordingly and add new parameters

•Click on the update device option:

•You can also set your device geographical location

To create a graph for your device click on the “create graph option”.

•Go in sample device code options and click on the Node MCU. You will get the sample
code from there.

25
26

Code /sketch

#include<SPI.h>
#includefuit_GFX.h>i
include <Ada fruit_SSD1306.h>

#define SCREEN_WIDTH
128 #define
SCREEN_HEIGHT 64
#define OLED_RESET -1
Ada fruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

String apiKey =
"WG89GEZYSP35Q7AL"; const char
*ssid = "SHIVANI25";
const char *pass #include <Wire.h>
#include "MQ135.h"#include <ESP8266WiFi.h>=
"12345678"; const char* server = "api.thing
speak.com";

WiFiClient client;

void
setup() {
Serial.begin(115200);
display.begin(SSD1306_SWITCHCAPVCC,
0x3C) display.clear Display();
delay(10);

Serial.print ln("Connecting to
"); Serial.print ln(ssid);

display.clear Display();
display.setCursor(0,0);
display.set TextSize(1);
display.set Text Color
(WHITE);cursor_y =
cursor_x = 0; textsize =
1;

26
27

void Ada fruit_GFX::draw Circle(int16_t x0, int16_t y0,


int16_t r, uint16_t color) {
int16_t f = 1 - r;
int16_t ddF_x = 1;
int16_t ddF_y = -2 *
r; int16_t x = 0;
int16_t y = r;

Draw Pixel(x0, y0+r,


color); draw Pixel(x0,
y0-r, color); draw
Pixel(x0+r, y0, color);
draw Pixel(x0-r, y0,
color);

while (x<y)
{ if (f >= 0)
{
y--;
ddF_y +=
2; f +=
ddF_y;
}
x++;
ddF_x +=
2; f +=
ddF_x;

Draw Pixel(x0 + x, y0 + y,
color); draw Pixel(x0 - x, y0
+ y, color); draw Pixel(x0 + x,
y0 - y, color); draw Pixel(x0
- x, y0 - y, color); draw
Pixel(x0 + y, y0 + x, color);
draw Pixel(x0 - y, y0 + x,
color); draw Pixel(x0 + y, y0
- x, color); draw Pixel(x0 - y,
y0 - x, color);

}
}

void Ada fruit_GFX::drawCircleHelper( int16_t x0,


int16_t y0, int16_t r, uint8_t cornername,
uint16_t color) {

27
28

int16_t f = 1 - r;
int16_t ddF_x = 1;
int16_t ddF_y = -2 *
r; int16_t x = 0;
int16_t y = r;

while (x<y)
{ if (f >= 0)
{
y--;
ddF_y += 2;
f +=
ddF_y; }
x++;
ddF_x += 2;
f += ddF_x;
if (cornername & 0x4) { draw
Pixel(x0 + x, y0 + y, color);
draw Pixel(x0 + y, y0 + x,
color);
}
if (cornername & 0x2) { draw
Pixel(x0 + x, y0 - y, color);
draw Pixel(x0 + y, y0 - x,
color);
}
if (cornername & 0x8) { draw
Pixel(x0 - y, y0 + x, color);
draw Pixel(x0 - x, y0 + y,
color);
}
if (cornername & 0x1) { draw
Pixel(x0 - y, y0 - x, color);
draw Pixel(x0 - x, y0 - y,
color);
}
}
}

void Ada fruit_GFX::fillCircle(int16_t x0, int16_t y0,


int16_t r, uint16_t color) {
Draw FastVLine(x0, y0-r, 2*r+1,
color); fill CircleHelper(x0, y0, r, 3,
0, color);
}

28
29

int16_t ddF_x = 1;
int16_t ddF_y = -2 *
r; int16_t x = 0;
int16_t y = r;

while (x<y)
{ if (f >= 0)
{
y--;
ddF_y += 2;
f +=
ddF_y; }
x++;
ddF_x += 2;
f += ddF_x;

if (cornername & 0x1) {


Draw FastVLine(x0+x, y0-y, 2*y+1+delta,
color); draw FastVLine(x0+y, y0-x,
2*x+1+delta, color);
}
if (cornername & 0x2) {
Draw FastVLine(x0-x, y0-y, 2*y+1+delta,
color); draw FastVLine(x0-y, y0-x,
2*x+1+delta, color);
}
}
}

void Ada fruit_GFX::draw Line(int16_t x0,


int16_t y0, int16_t x1,
int16_t y1, uint16_t
color) {
int16_t steep = abs(y1 - y0) > abs(x1 -
x0); if (steep) {
swap(x0,
y0);
swap(x1, y1);
}

if (x0 > x1) {


swap(x0,
x1);
swap(y0,
y1);
}

int16_t dx,
dy; dx = x1 -

29
30

x0;
dy = abs(y1 - y0);

30
31

= -1;
int16_t err = dx /
2; int16_t ystep;

if (y0 < y1)


{ ystep =
1;
} else {
ystep
}

for (; x0<=x1; x0++)


{ if (steep) {
Draw Pixel(y0, x0,
color); } else {
Draw Pixel(x0, y0,
color); }
err -= dy;
if (err < 0) {
y0 +=
ystep; err
+= dx;
}
}
}

void Ada fruit_GFX::draw Rect(int16_t x,


int16_t y, int16_t w,
int16_t h, uint16_t
color) {
Draw FastHLine(x, y, w, color);
draw FastHLine(x, y+h-1, w,
color); draw FastVLine(x, y, h,
color); draw FastVLine(x+w-1,
y, h, color);
}

void Ada fruit_GFX::draw FastVLine(int16_t x,


int16_t y, int16_t h,
uint16_t color) {

Draw Line(x, y, x, y+h-1,


color); }

void Ada fruit_GFX::draw FastHLine(int16_t x,


int16_t y, int16_t w,
uint16_t color) {

31
32

void Ada fruit_GFX::fill Rect(int16_t x, int16_t y, int16_t w,


int16_t h, uint16_t color) {

for (int16_t i=x; i<x+w; i++) {


draw FastVLine(i, y, h,
color);
}
}
WiFi.begin(ssid, pass);

while (WiFi.status() !=
WL_CONNECTED) {
delay(500);
Serial.print("."
);
}

Serial.print ln(""); Serial.print


ln("WiFi connected");

display.clear Display();
display.setCursor(0,0);
display.set TextSize(1);
display.set Text
Color(WHITE);
display.print("WiFi
connected");
display.display();
delay(4000);

void
loop() {
MQ135 gasSensor = MQ135(D0);
float air_quality =
gasSensor.getPPM();
Serial.print("Air Quality: ");
Serial.print(air_quality);
Serial.print ln(" PPM");
Serial.print ();

32
33

display.setCursor(0,20);
display.set TextSize(2);
display.set Text
Color(WHITE);
display.print(air_quality);
display.set TextSize(1);
display.set Text
Color(WHITE);
display.print ln(" PPM");
display.display();

if (client.connect(server,
80)) {
String postStr =
apiKey; postStr +=
"&field1=";
postStr +=
String(air_quality); postStr
+= "r\n";

client.print("POST /update
HTTP/1.1\n"); client.print("Host:
api.thing speak.com\n");
client.print("Connection: close\n");
client.print("X-THINGSPEAKAPIKEY: " + apiKey + "\n");
client.print("Content-Type: application/ x-wow-form-
encoded\n"); client.print("Content-Length: ");
client.print(postStr.length(
)); client.print("\n\n");
client.print(postStr);

Serial.print ln("Data Send to Thing


speak"); }
client.stop(); Serial.print
#include ("Waiting...");

delay(2000)
;}
"Ada fruit_GFX.h"
#include "glc font.c"
#include <.h>

void Ada fruit_GFX::constructor(int16_t w,


int16_t h) { _width = WIDTH = w;
_height = HEIGHT = h;

33
34

serial monitor

The Serial Monitor is an essential tool when creating projects with Arduino. It
can be used as a debugging tool, testing out concepts or to communicate
directly with the Arduino board.

The Arduino IDE 2 has the Serial Monitor tool integrated with the editor, which
means that no external window is opened when using the Serial Monitor. This
means that you can have multiple windows open, each with its own Serial
Monitor.You can download the editor from the Arduino Software page.
You can also follow the downloading and installing the Arduino IDE 2 tutorial
for more detailed guide on how to install the editor.

Requirements
.Arduino IDE 2 installed.
•Arduino board.
•Core installed for the board used.

Notable Changes

Integrated Monitor

One major change that was introduced with the Arduino IDE 2 is the integrated
Serial Monitor. The older versions of the editor features an external window that
matches the port/board that we select.

The Arduino IDE 2 works a bit differently. Instead of opening an external


window for the Serial Monitor, it shows up where the console log is located, as
an additional tab. To understand how this works, let's take a look at how the
old editor works:
Serial Monitor on the older version.

34
35

Get Started
Learn the basics of ThingSpeak

Configure Accounts and Channels


Information on ThingSpeak channels, users, and licenses

Write Data to Channel


Use the REST and MQTT APIs to update channels with software or devices

Read Data from Channel


Use the REST and MQTT APIs to read channels using software or devices

Prepare and Analyze Data


Filter, transform, and respond to data in MATLAB

Visualize Data
Transform and visualize data in MATLAB

Act on Data
Use Thing Speak apps to trigger an action or transform and visualize data

Specialized Analysis with MATLAB


Thing Speak examples that show use of the advanced tools available in add-on
toolboxes

API Reference
Use the REST and MQTT APIs to update Thing Speak channels and to chart numeric
data stored in channels

35
36

Serial Monitor on the new version.


The Serial Monitor settings are also located here, such as adjusting the baud
rate and sending messages.

Advantages

A major advantage with having the Serial Monitor integrated with the editor is
the possibility to have multiple monitors open simultaneously. In the old editor,
when changing the port/board, it changed across all windows. In addition, we
were limited to one Serial Monitor window, an obstacle that the IDE 2 removes.

Thing speak

36
37

Thing Speak is an Io T analytic platform service that allows you to aggregate,


visualize, and analyze live data streams in the cloud. You can send data to Thing
Speak from your devices, create instant visualization of live data, and send alerts.

The Thing Speak service is operated by Math Works. In order to sign up for Thing Speak,
you must create a new Math Works Account or log in to your existing Math Works
Account.

Thing Speak is free for small non-commercial projects.

Thing Speak includes a Web Service (REST API) that lets you collect and store sensor
data in the cloud and develop Internet of Things applications. It works with Arduino,
Raspberry Pi and MATLAB ( made libraries and API exists) But it should work with all
kind of Programming Languages, since it uses a REST API and HTTP.

Thing Speak Key Features

Thing Speak allows you to aggregate, visualize and analyze live data streams in the cloud. Some
of the key capabilities of Thing Speak include the ability to:

37
38

•Easily configure devices to send data to Thing Speak using popular Io T protocols.
•Visualize your sensor data in real-time.

• data on-demand from third-party sources.


•Use the power of MATLAB to make sense of your IOT data.
•Run your IOT analytic automatically based on schedules or events.
•Prototype and build IOT systems without setting up servers or developing web software.
•Automatically act on your data and communicate using third-party services like Twilio®
or Twitter®.

Database on think speak

Once data is in a Thing Speak channel, you can analyze and visualize it, calculate new
data, or interact with social media, web services, and other devices.

38
39

this graph is showing the quality of the air

39
40

Using Multiple Serial Monitors Simultaneously


A really cool feature with the Arduino IDE 2 is that the Serial Monitor is linked
to the sketch windows you have open. For example, if we have two sketch
windows, named sketch_1 and sketch_2, we can select the port and board for
each window, and have two Serial Monitors running at the same time.

This is really useful when working with various communication / connectivity


projects, where we want to know what's going on both boards at the same time.
If you have two Arduino boards, you can try out this feature using the
instructions below.

1. First, we need to open a new file, through File > New.

Open a new sketch.

2. Now, we need to choose another board. In this example, we are using an Arduino Nano 33 IoT.
If you have connected it to your computer and installed the necessary core for it, it will show up in
the board list.

40
41

List of available boards.

3. For the new sketch, let's use the same sketch we uploaded to the other board, but
replace the
"Hello world!"
, with something else. In this example, we used
"Hello Mars!"
, as you can see in the code snippet below:

COPY

1void setup() {

2Serial.begin(9600);

3}

5void loop() {

6Serial.println("Hello Mars!");

7delay(1000);

8}

4. Upload the code to the board, and open the Serial Monitor. We should now see

41
42

this graph is showing the quality of the air.

42
43

For database, in the think speak you have to create the channel.

Data sending to think speak

43
44

Arduino Serial Monitor (Windows, Mac, Linux)


The Arduino Integrated Development Environment (IDE) is the software side of the Arduino
platform. And, because using a terminal is such a big part of working with Arduino and other
micro controllers, they decided to included a serial terminal with the software. Within the
Arduino environment, this is called the Serial Monitor.

Making a Connection
Serialmonitor comes with any and all version of the Arduino IDE. To open it, simply click the
Serial Monitor icon.

The icon is located to the right of the other icons in Arduino 0023 and below.

The icon is located to the far right in Arduino 1.0 and beyond.

Selecting which port to open in the Serial Monitor is the same as selecting a port for
uploading Arduino code. Go to Tools -> Serial Port, and select the correct.

44
45

Future Scope of I.O.T.

Future scope of IOT in healthcare, automotive, and agriculture industries.


Internet of Things has emerged as a leading technology around the world. It
has gained a lot of popularity in lesser time. Also, the advancements in

Artificial Intelligence and Machine Learning have made the automation of IOT
devices easy. Basically, AI and ML programs are combined with IOT devices
to give them proper automation.

Due to this, IOT has also expanded its area of application in various sectors.
Here, in this section, we will discuss the applications and the

45
46

Conclusion

In conclusion, an IoT-based air pollution monitoring system is a revolutionary


solution that can provide accurate and real-time data about the air quality in a
particular area. It can help identify the sources of pollution and take
necessary measures to reduce it, protecting the environment and human
health.

This research proposed a smart air pollution monitoring system that


constantly keeps track of air quality in an area and displays.

46
47

Bibliography

➢https://www.schneier.com
➢https://docs.github.co
➢ https://www.youtube.com/watch?v=Td1d5iMF3EQ

47
48

Project log book ( 6 months )

Log Book of January

Date work
1. 9jan-14jan Introduction to Internet Of Things

2. 16Jan- Application In IOT Eco System


20Jan

3. 23Jan- IOT Levels


27Jan

Log Book of February

1. 1Feb-3Feb The physical design of IOT


2. 6Feb-10Feb IOT Components

3. 13Feb- Logical design of I.O.T.


17Feb

.
Log Book of March

1. 20Mar- Introduction to Arduino software, about its features


24Mar

Embedded c coding introduction and programs in


2. 27Mar- this
31Mar

48
49

Log Book of April

1. 3Apr-6Apr Introduction to Connecting


hardware components.
2. 10Apr- Using the embedded C coding and upload the
13Apr Components of I.o.t.
3. 17Apr- Arduino Programs

Log Book of May

1. 2May- Programs of embedded c,Project work


4May
2. 8May- Working on the different project of I.O.T.
12May
3. 15May- Performing the I.O.T. code and uploading the
19May data on the sensors and WI FI modules
4. 22May- Introduction to think speak, creating channel on
26May it to perform the tasks.

5. 29May- Sending data techniques of I.O.T. projects


31May

49
50

Log Book of June

1. 1June- Working on the Project.


2June
2. 5June- Connecting wires and sensors . Writing the code
9June sketch
3. 12June- Project Working
16June

50

You might also like