Fire and Smoke detection system

Fire and Smoke detection system

In this tutorial ,I showed you how to make your smoke or gas detection system using MQ2 sensor

  • 17 views
  • 0 comments
  • 0 respects

Components and supplies

About this project

In this example, you will read the sensor analog output voltage and when the smoke reaches a certain level, it will make sound a buzzer and a red LED will turn on.

When the output voltage is below that level, a green LED will be on.

What is an MQ-2 Smoke Sensor

MQ2 gas sensor can be used to detect the presence of LPG, Propane and Hydrogen, also could be used to detect Methane and other combustible steam, it is with low cost and suitable for different application. Sensor is sensitive to flammable gas and smoke. Smoke sensor is given 5 volt to power it. Smoke sensor indicate smoke by the voltage that it outputs .More smoke more output. A potentiometer is provided to adjust the sensitivity. Sn02 is the sensor used which is of low conductivity when the air is clean. But when smoke exist, an analog output is produced based on the concentration of smoke. The circuit has a heater. Power is given to heater by VCC and GND from power supply. The circuit has a variable resistor. The resistance across the pin depends on the smoke in air in the sensor. The resistance will be lowered if the content is more. And voltage is increased between the sensor and load resistor.

Thanks UTSOURCE.net to offer electronic components for my projects

How does it Work?

The voltage that the sensor outputs changes accordingly to the smoke/gas level that exists in the atmosphere. The sensor outputs a voltage that is proportional to the concentration of smoke/gas.

In other words, the relationship between voltage and gas concentration is the following:

  • The greaterthe gas concentration,the greaterthe output voltage
  • The lowerthe gas concentration,the lowerthe output voltage

Pin Wiring

The MQ-2 sensor has 4 pins.

Pin--Wiring to Arduino Uno

A0---Analog pins

D0----Digital pins

GND-----GND

VCC--------5V

for more info: https://www.blackkeyhole.com/

Code

codi ngC/C++
//FOR MORE project visit:https://www.blackkeyhole.com/

int redLed = 12;
int greenLed = 11;
int buzzer = 10;
int smokeA0 = A5;
// Your threshold value
int sensorThres = 235;

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, 1000, 200);
  }
  else
  {
    digitalWrite(redLed, LOW);
    digitalWrite(greenLed, HIGH);
    noTone(buzzer);
  }
  delay(100);
}
codingC/C++
//FOR MORE project visit:https://www.blackkeyhole.com/

int redLed = 12;
int greenLed = 11;
int buzzer = 10;
int smokeA0 = A5;
// Your threshold value
int sensorThres = 235;

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, 1000, 200);
  }
  else
  {
    digitalWrite(redLed, LOW);
    digitalWrite(greenLed, HIGH);
    noTone(buzzer);
  }
  delay(100);
}

Schematics

circuit
Untitled design btwafihy7c

Comments

Add projectSign up / Login