This project tackles air quality concerns by building an air purifier system with real-time monitoring capabilities. It utilizes an Arduino Uno for control, an MQ-135 sensor for gas detection, and I2C communication for efficient data transfer.
Components:
- Arduino Uno: The brain of the system, it collects sensor data, controls the purifier, and potentially displays information.
- MQ-135 Gas Sensor: Detects a range of gases including volatile organic compounds (VOCs), smoke, and ammonia, indicating potential air quality issues.
- Fan: Creates airflow to draw polluted air through the filter for purification.
- I2C Module (Optional): Simplifies communication between the Arduino and other I2C-compatible devices (e.g., LCD for displaying air quality data).
- Jumper Wires: Connect all the electronic components.
- Breadboard (Optional): Useful for prototyping the circuit before final assembly.
- Power Supply: AC adapter for the Arduino and potentially a separate power source for the fan (depending on its power requirements).
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
void setup()
{
lcd.init(); // initialize the lcd
// Print a message to the LCD.
lcd.backlight();
Serial.begin(9600);
}
void loop()
{
// Air Quality Measurement
int sv = analogRead(A0);
Serial.print("AQI: ");
Serial.print(sv , DEC);
Serial.println(" PPM");
if ( sv <= 400 )
{
lcd.setCursor(0,0) ;
lcd.print("Fresh Air");
lcd.setCursor(0,1) ;
lcd.print("AQI : ");
lcd.print(sv , DEC);
lcd.print(" PPM");
delay (1000) ;
}
else if ( sv > 400 && sv < 750 )
{
lcd.setCursor(0,0) ;
lcd.print("Air Quality:Good");
lcd.setCursor(0,1) ;
lcd.print("AQI : ");
lcd.print(sv , DEC);
lcd.print(" PPM");
delay (1000) ;
}
else if ( sv >= 750 && sv < 1200 )
{
lcd.setCursor(0,0) ;
lcd.print("Air Quality:Bad");
lcd.setCursor(0,1) ;
lcd.print("AQI : ");
lcd.print(sv , DEC);
lcd.print(" PPM");
delay (1000) ;
}
else if ( sv > 1200)
{
lcd.setCursor(0,0) ;
lcd.print("Air Quality:Harm");
lcd.setCursor(0,1) ;
lcd.print("AQI : ");
lcd.print(sv , DEC);
lcd.print(" PPM");
delay (1000) ;
}
}