Professional Documents
Culture Documents
AirQuality
AirQuality
Submitted by Submitted to
……………….………
Date of submission:
14-12-22 Signature
Project Report
Project Title: Air Quality monitoring and alert system using Arduino and gas
sensor(MQ-135).
Background: Most of the major cities in developing countries and most cities of
the developed countries are suffering from it. Thus to develop a real time air
quality and pollution monitoring system is critical. We have developed an
arduino based air pollution detector which combined a small-sized, minimum-
cost sensor to an arduino microcontroller unit. The advantages of the detector,
have a reliable stability, rapid response recovery and long-life features. It is
affordable, user-friendly, low-cost and minimum-power requirement hardware
which is appropriate for mobile measurement, as well as comprehensible data
collection. It has a processing software able to analyze, collected quality data
with high precision. Simple instrument which can be commercially utilized.
Code:
#define F_CPU 1000000UL
#include <avr/io.h>
#include <util/delay.h>
#include <LiquidCrystal.h> //Header file for LCD
const int rs=12, en=11, d4=5, d5=4, d6=3, d7=2; //pins of LCD connected
to Arduino
LiquidCrystal lcd(rs,en,d4,d5,d6,d7); //lcd function from LiquidCrystal
void setup() {
ADMUX = 0x40;
ADCSRA = 0b10000111;
ADCSRA|=(1<<ADSC); // start conversion
ADCSRA|=(1<<ADIF);
return(ADC);
}
void loop() {
st
lcd.setCursor (0,0); // set cursor of lcd to 1st row and 1 column
lcd.print("Air QualitY: "); // print message on lcd lcd.print(ppm);
Circuit Diagram:
Description: First we define some header file .Then we define all the pins of
LCD that are connected to Arduino. Then we initialize LCD with this argument
LiquidCrystal lcd(rs,en,d4,d5,d6,d7).Now I define threshold for compare with
digital input value. In Void setup() function I use Data Direction Register(DDRX)
configures the data direction of port pins. Then making two pins of port B as
output pins which is PB0 and PB1 . For making PC0 pins of port C as input pins:
DDRC = 0b00000000 (in binary) or DDRC = 0x00 (in hexa).
Now clearing LCD with this command lcd.clear() and begin LCD with this
command .Now taking digital input and read in ReadAdc().After read from A0
store it in ppm. Then ppm convert with threshold value if ppm > threshold
then turn on LED and Buzzer and showing in LCD AQ Level is high. If not then
turn off LED and BUZZER and show in LCD AQ level is low.
OUTPUT: