Air Quality Monitoring System

Introduction

An Air Quality Monitoring System is an IoT-based project that measures the quality of air in a specific area by detecting pollutants, smoke, CO2 levels, and other harmful gases.

It is essential for environmental monitoring, health awareness, and smart city initiatives, helping authorities take action against pollution and improve urban living conditions.


Objective of the Project

  • To measure air quality parameters like smoke, CO2, and pollutant levels.
  • To send real-time air quality data to an IoT platform for monitoring.
  • To provide alerts when air quality falls below safe limits.
  • To understand sensor interfacing and IoT integration.

Working Principle

The system works by using gas sensors that detect specific pollutants in the air. Data is processed by a microcontroller and transmitted to the cloud for real-time monitoring.

Step-by-Step Working

  1. MQ135 sensor detects harmful gases (CO2, NH3, smoke).
  2. The Arduino/ESP32 reads analog values from the sensor.
  3. Data is normalized and analyzed to determine air quality (Good, Moderate, Poor).
  4. The microcontroller sends data to a cloud platform (ThingSpeak, Blynk, or Firebase).
  5. Optional: A buzzer or LED alerts if air quality is below the safe threshold.

Components Required

  • ESP32 / ESP8266 or Arduino Uno
  • MQ135 Gas Sensor
  • DHT11 / DHT22 Sensor (optional for temperature & humidity)
  • Jumper Wires
  • Breadboard / PCB
  • IoT Platform (ThingSpeak, Blynk, or Firebase)
  • 5V Power Supply

Circuit Diagram

Connections (ESP32 + MQ135 + DHT22)

MQ135 Gas Sensor:
VCC -> 5V
GND -> GND
A0  -> GPIO34 (ESP32 ADC)

DHT22 (optional for temperature & humidity):
VCC -> 3.3V
GND -> GND
DATA -> GPIO4

ESP32:
Connect all sensors to GPIO pins
Connect ESP32 to Wi-Fi for IoT monitoring

Note: MQ135 outputs analog voltage proportional to gas concentration. ESP32 ADC reads the value and sends it to IoT cloud.


Arduino/ESP32 Code Example (MQ135 + ThingSpeak)

#include <WiFi.h>
#include "ThingSpeak.h"
#include <DHT.h>

#define MQ135_PIN 34
#define DHTPIN 4
#define DHTTYPE DHT22

DHT dht(DHTPIN, DHTTYPE);

const char* ssid = "Your_WiFi_SSID";
const char* password = "Your_WiFi_PASSWORD";
WiFiClient client;

unsigned long myChannelNumber = 123456; // ThingSpeak Channel ID
const char* myWriteAPIKey = "YOUR_API_KEY";

void setup() {
  Serial.begin(115200);
  dht.begin();

  WiFi.begin(ssid, password);
  Serial.print("Connecting to Wi-Fi");
  while(WiFi.status() != WL_CONNECTED){
    delay(500);
    Serial.print(".");
  }
  Serial.println("Connected!");

  ThingSpeak.begin(client);
}

void loop() {
  int mqValue = analogRead(MQ135_PIN);
  float temp = dht.readTemperature();
  float hum = dht.readHumidity();

  Serial.print("MQ135 Value: "); Serial.println(mqValue);
  Serial.print("Temperature: "); Serial.println(temp);
  Serial.print("Humidity: "); Serial.println(hum);

  // Send data to ThingSpeak
  ThingSpeak.setField(1, mqValue);
  ThingSpeak.setField(2, temp);
  ThingSpeak.setField(3, hum);
  ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);

  delay(20000); // Update every 20 seconds
}

Code Explanation

  • MQ135 sensor measures air pollutants and gives an analog reading.
  • DHT22 sensor adds temperature & humidity readings for environmental monitoring.
  • ESP32 connects to Wi-Fi and sends data to ThingSpeak IoT platform.
  • Data is updated every 20 seconds, and dashboards can display real-time air quality.

Advantages

  • Real-time air quality monitoring
  • Detects harmful gases to ensure safety
  • Can trigger alerts for poor air quality
  • Low-cost and scalable

Applications

  • Smart cities and urban air quality monitoring
  • Indoor air quality monitoring for homes/offices
  • Industrial pollution detection
  • Environmental research and data collection

Future Enhancements

  • Add multiple gas sensors for PM2.5, CO, NO2 detection
  • Use IoT dashboards for city-wide air quality mapping
  • Trigger automatic ventilation or air purifiers when pollution is high
  • Integrate AI to predict pollution trends

Conclusion

The Air Quality Monitoring System is a vital IoT project that combines sensors, microcontrollers, and cloud platforms to provide real-time environmental data. It’s perfect for smart city applications, health monitoring, and pollution awareness.

Leave a Reply

Shopping cart

0
image/svg+xml

No products in the cart.

Continue Shopping