Air Quality monitoring

In this project, you will learn how to monitor the quality of air and detect LPG gas leakage using the MQ-135 sensor and an Arduino.


We observe in most cases fire accidents occur in houses due to the leakage of gas.


So to prevent these kinds of accidents we came up with a simple solution.
Here we monitor the air quality using MQ-135 sensor and when there is any leakage in the gas the air quality will be reduced and the Buzzer goes high to inform us and we take immediate action.


5v-2A power adapter
arduino nano or Arduino Uno
Mq-135 sensor
16*2 LCD Display
connecting wires/jumper wires
10k and 3.7k resistors
10k potentiometer/ variable resistor
BC547 transistor




Here we measure the air quality using the sensor MQ-135 and display it in LCD display. When LPG gas is leaked the air quality will be reduced and then the buzzer goes high to warn us.


#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 8, 9, 10, 11 , 12); // pin reference - LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
int buzzer = 6;                  // buzzer to digital 6 pin
void setup() { 
  lcd.begin(16, 2);           // tell program the size of lcd display
  lcd.setCursor(0,1);         // to set s=cursor at beginning of the screen
  lcd.write("HELLO AJ");      // Write your name to check on screen
  pinMode(buzzer, OUTPUT);
  digitalWrite(buzzer, 0); 
  Serial.begin(9600);          // serial  baud rate 
void loop() {
  int sensorValue = analogRead(A3);  //reading analog input from mq-135 sensor
  Serial.print("Air Quality = ");
  lcd.clear();                       // to clear the screen 
  lcd.setCursor(0,0);                // set cursor at beginning of display
  lcd.print("Air Quality = ");
  lcd.setCursor(1,0);                // set cursor at 2nd row 1 colum of display
  lcd.print(" PPM");
  if (sensorValue < 500){
   lcd.print("is good");   
  if (sensorValue > 500){
   lcd.print("is poor");
  if (sensorValue > 1000){
   lcd.print("is very poor");
   digitalWrite(buzzer, HIGH);


Share this post

Share on facebook
Share on twitter
Share on linkedin
Share on email
Share on whatsapp