How to Make a DIY Air Quality Monitor with Arduino + MQ135 Sensor (Science Fair Project)

https://images.openai.com/static-rsc-4/S7I_dvVWj1hHxTUdyqvytw0nWWioCeGflvkd49lJwybRez-st-S_AXhEhZDKu8HMqhFatZ4WMITDhymshwJBOilHZpFE2Wjb5pCNlsxpTpM-SyawLZx_LYWncrrlkKGywySDU9kPdkDs4GNTtW2qtpR8--ysz6pJ8vBw8fpv_qJMTa9GTZPYxa22TCiaa3im?purpose=fullsize
https://images.openai.com/static-rsc-4/Pu2r8cthMSC1DZqJ22dfIaVXauYZa2VkYomR12qlfZ3nppbUx8CCT4pDMHiKNthDOifj5_hVRXaK7JbufRwVhe1m6DNWBJKjwy3Wzjj6zO_7YhjcF0Lg-3quARagO_yS9Ckdhj0b_VWgYgFbGeDMB0M5dCaR-TY26Qr9xIjKx31WfQUQuPPzT9TcG6prgI--?purpose=fullsize
https://images.openai.com/static-rsc-4/c4sgw0qWGovACb9FQuWLTkBODM0cRILuTX9YSP0vkYgFPYPbeD_pqFV9E6Y1RpoD2soFV5Ud3nzn_65d6Uf529NFYWQbeDbmRtr9JQaOljkGsDqB66PVRNNaqPnqE2c9dVP6bgPpGjZFlAEf6TjGnkvcZpV06TZii03_GleubGO9pNh5jq8rz2UipeVwhCE8?purpose=fullsize

4

Introduction

This project involves building a simple device that monitors air quality using an Arduino Uno and an MQ135 gas sensor. The sensor detects harmful gases and pollutants in the air, while the Arduino processes the data and displays air quality levels using LEDs and a buzzer.


Materials Required

ItemQuantity
Arduino Uno1
MQ135 Air Quality Sensor1
Breadboard1
Jumper WiresSeveral
Green LED1
Yellow LED1
Red LED1
220 Ω Resistors3
Buzzer1
USB Cable1
Laptop with Arduino IDE1

Step 1: Understand How the Sensor Works

The MQ135 sensor contains a sensitive material that changes its electrical resistance when exposed to gases such as:

  • Carbon dioxide (CO₂)
  • Ammonia (NH₃)
  • Benzene
  • Smoke
  • Alcohol vapours

The Arduino reads these changes and determines the air quality level.


Step 2: Assemble the Circuit

Connect the MQ135 Sensor

MQ135 PinArduino Pin
VCC5V
GNDGND
A0A0

Connect the LEDs

Green LED

  • Positive leg → Pin 4 through 220 Ω resistor
  • Negative leg → GND

Yellow LED

  • Positive leg → Pin 5 through 220 Ω resistor
  • Negative leg → GND

Red LED

  • Positive leg → Pin 6 through 220 Ω resistor
  • Negative leg → GND

Connect the Buzzer

Buzzer PinArduino Pin
PositivePin 7
NegativeGND

Step 3: Build the Circuit on the Breadboard

Arrange the components neatly:

  1. Place the Arduino beside the breadboard.
  2. Insert the MQ135 sensor on the breadboard.
  3. Place the three LEDs in a row.
  4. Connect all grounds to the breadboard ground rail.
  5. Use jumper wires to complete all connections.

Step 4: Install Arduino Software

  1. Download Arduino IDE.
  2. Install it on your computer.
  3. Connect the Arduino using the USB cable.
  4. Select:
    • Board → Arduino Uno
    • Port → COM Port of your Arduino

Step 5: Upload the Program

Copy and paste the following code into Arduino IDE.

int sensorPin = A0;
int greenLED = 4;
int yellowLED = 5;
int redLED = 6;
int buzzer = 7;

void setup()
{
Serial.begin(9600);

pinMode(greenLED, OUTPUT);
pinMode(yellowLED, OUTPUT);
pinMode(redLED, OUTPUT);
pinMode(buzzer, OUTPUT);
}

void loop()
{
int airValue = analogRead(sensorPin);

Serial.print("Air Quality = ");
Serial.println(airValue);

if(airValue < 200)
{
digitalWrite(greenLED, HIGH);
digitalWrite(yellowLED, LOW);
digitalWrite(redLED, LOW);
digitalWrite(buzzer, LOW);
}

else if(airValue < 400)
{
digitalWrite(greenLED, LOW);
digitalWrite(yellowLED, HIGH);
digitalWrite(redLED, LOW);
digitalWrite(buzzer, LOW);
}

else
{
digitalWrite(greenLED, LOW);
digitalWrite(yellowLED, LOW);
digitalWrite(redLED, HIGH);
digitalWrite(buzzer, HIGH);
}

delay(1000);
}

Click Verify and then Upload.


Step 6: Test the Device

After uploading:

Clean Air

  • Green LED ON
  • Yellow LED OFF
  • Red LED OFF
  • Buzzer OFF

Moderate Pollution

  • Yellow LED ON

Heavy Pollution

  • Red LED ON
  • Buzzer sounds

Step 7: Conduct Experiments

Measure air quality in different locations:

LocationSensor ReadingAir Quality
Classroom
Laboratory
Kitchen
Roadside
Near Vehicle Exhaust

Record observations and compare results.


Step 8: Prepare Your Science Fair Display

Include:

Title

Smart Air Quality Monitoring System Using Arduino and MQ135 Sensor

Sections

  1. Introduction
  2. Problem Statement
  3. Objectives
  4. Materials
  5. Methodology
  6. Circuit Diagram
  7. Results
  8. Discussion
  9. Conclusion
  10. Recommendations

Expected Results

ReadingInterpretation
0–200Good Air
200–400Moderate Air
400–600Poor Air
Above 600Dangerous Air

Advanced KSEF Upgrades

To make the project more competitive:

  1. Add an OLED display showing AQI.
  2. Add a DHT22 sensor for temperature and humidity.
  3. Use an ESP8266 Wi-Fi module to send data online.
  4. Create a mobile phone monitoring app.
  5. Power the system using a solar panel.
  6. Store data on an SD card for long-term analysis.
  7. Use AI to predict pollution trends.

Science Behind the Project

The MQ135 sensor converts chemical changes caused by pollutants into electrical signals. The Arduino interprets these signals and provides a real-time indication of air quality, helping people identify polluted environments and take appropriate action.

This project combines Environmental Science, Electronics, Programming, Data Analysis, and Public Health, making it an excellent science fair project for secondary school and KSEF competitions

  • mbeva

    Dominic Mbeva is a science teacher, experienced researcher, innovator, and creative technologist with expertise in STEM education, digital media, and scientific research. As a Kenya Science and Engineering Fair (KSEF) advisor and projects manager, he mentors young scientists, guiding them in developing award-winning innovations. He is also an IC Technorat, leading advancements in science and technology. Beyond education, Dominic is a skilled photographer and video editor, using visual storytelling to make science more engaging. His philosophy, “If you take care of minutes, hours will take care of themselves,” reflects his belief in consistent effort, strategic thinking, and innovation to drive success in both research and creativity.

    Related Posts

    How to Build a Thermoelectric Generator (TEG) Science Project

    A thermoelectric generator converts heat directly into electricity using the Seebeck Effect. When one side of the TEG module is hot and the other side is cold, voltage is generated.…

    Read more

    Top 5 Piezoelectric Projects for Engineering Students (With Circuit Diagrams)

    Top 5 Piezoelectric Projects for Engineering Students (With Circuit Diagrams) Top 5 Piezoelectric Projects for Engineering Students (With Circuit Diagrams) As the global demand for sustainable, decentralized green energy alternatives…

    Read more

    Leave a Reply

    Your email address will not be published. Required fields are marked *