vishnutheerth_e_p
Published © GPL3+

IoT Based Simple Air Pollution Monitoring System

We are using some simple cost effective materials to make an IoT based air pollution monitoring system.

BeginnerFull instructions provided14,138
IoT Based Simple Air Pollution Monitoring System

Things used in this project

Hardware components

Grove - Gas Sensor(MQ2)
Seeed Studio Grove - Gas Sensor(MQ2)
IMPORTANT:please use mq135 gas sensor...
×1
Arduino UNO
Arduino UNO
×1
Buzzer
Buzzer
×1
Breadboard (generic)
Breadboard (generic)
×1
Resistor 221 ohm
Resistor 221 ohm
×2
5 mm LED: Red
5 mm LED: Red
×1
5 mm LED: Green
5 mm LED: Green
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Not needed if you are using proper jumper wires

Story

Read more

Schematics

connection diagram

No need of fritzing.It is just a simple connection circuit diagram.

Code

Arduino code for this program

C#
int redLed = 12;
int greenLed = 8;
int buzzer = 10;
int smokeA0 = A0;
// Your threshold value
int sensorThres = 150;

void setup() {
  pinMode(redLed, OUTPUT);
  pinMode(greenLed, OUTPUT);
  pinMode(buzzer, OUTPUT);
  pinMode(smokeA0, INPUT);
  Serial.begin(9600);
}
void loop() {
  int analogSensor = analogRead(smokeA0);
  Serial.print("Pin A0: ");
  Serial.println(analogSensor);
  // Checks if it has reached the threshold value
  if (analogSensor > sensorThres)
  {
    digitalWrite(redLed, HIGH);
    digitalWrite(greenLed, LOW);
    tone(buzzer, 3000, 300);
  }
  else
  {
    digitalWrite(redLed, LOW);
    digitalWrite(greenLed, HIGH);
    noTone(buzzer);
  }
  delay(100);
}

Credits

vishnutheerth_e_p

vishnutheerth_e_p

1 project • 1 follower

Comments