Air Pollution Detector
1276 1
VIGHNESH NAUSO SHETYE

Air Pollution Detector

India has the distinction of releasing the largest volumes of pollutants into the air after China....

Description:-

India has the distinction of releasing the largest volumes of pollutants into the air after China. Majority of the cities with the most polluted air are in India. Air pollution is the fifth largest killer in the country, according to Global Burden of Disease. Many areas in Indian States, and the world, are faced with serious air quality problems. It is the most important environmental health risk of our times. Air in our cities is becoming hazardous to breathe but it is not immediately reported to the controlling authorities. Currently Air in our cities is becoming hazardous to breathe but it is not immediately reported to the controlling authorities and therefore result in delay in action. Because of this the polluting agencies like the factories are getting escaped, resulting in the hazardous health issues. So to cater this problem, I have developed Air pollution detector. This system detects and reports the pollution on the mobile app developed by me. It also Gives warnings to the nearby public when the pollution crosses the defined limit by turning on the siren.

Project Used Hardware

Air Pollution Detector Hardware

Wemos D1 (esp8266), MQ3 Sensor , Battery \ solar panel \ 5-12v adapter for power supply , Buzzer

Project Used Software

Kodular Creator (clone of MIT app inventor) , Arduino IDE , Firebase Realtime Database , Firebase Authentication

Project Hardware Software Selection

On the Hardware side, I used Wemos D1 which is a esp8266 based board because it is a low cost microcontroller that has Wi-Fi connectivity for sending data to the internet. I have also used MQ3 sensor for measuring the amount of smoke present in air, Buzzer as a siren and a power supply for the device. On the Software side, I have used Arduino IDE to program the microcontroller. As a database and IoT server I have used Google Firebase's Realtime Database. To build the android app I have used Kodular Creator which is a clone of MIT app inventor. For Authentication I have used Firebase Authentication.

Circuit Diagram

Air Pollution Detector Circuit Diagram

 

The GND and VCC of MQ3 sensor is connected to GND and 5v of the Wemos D1 Respectively. The Analog output is connected to A0 pin of the Wemos D1. The Buzzer is connected to D2 pin of the Wemos D1 controller.

 

Code

#include <WiFiManager.h>
#include "FirebaseESP8266.h"
#include <ESP8266WiFi.h>

#define nameofdevice "Device 1"

FirebaseData firedb;
int status;

void setup()
{
  status = 1;
  pinMode(D2, OUTPUT);
  pinMode(A0, INPUT);
  WiFi.mode(WIFI_STA);
  Serial.begin(115200);
  WiFiManager wm;

  bool res;

  res = wm.autoConnect("Air Pollution Detector", "pollution");
  if (!res) {
    Serial.println("Failed to connect");
  }
  else {
    Serial.println("connected...yeey :)");
    Firebase.begin( "smart-9b2ba-default-rtdb.firebaseio.com", "0CgaJ1CmWwsiNqAymhQnLHgqwXEbwkDvL9zXuFG6");
    Serial.println("Firebase Connected");
  }

}

void loop()
{

  int value = analogRead(A0);
  Serial.println(value);

    if (status == 1)    {
        if (value > 700)
        {
          Firebase.setString(firedb, "/database/Device 1/Pollution Level", "Device1" );
          Firebase.setString(firedb, "/database/alerts", "Device1" );
          digitalWrite(D2,HIGH);
          status = 0;
        }
    }
else{
    if (value < 700 )
    {

        status = 1;
                  digitalWrite(D2,LOW);

     }
}
delay(1000);
}