How to make gas leak alert security alarm using arduino

Published Feb 22, 2021
 2 hours to build
 Intermediate

In this tutorial I will show you how to make gas leak alert security alarm using arduino nano and mq 5 gas sensor

display image

Components Used

Arduino Nano
Arduino Nano
1
Buzzer 5V
Buzzer 5V
1
LED 5mm
LED 5mm
2
MQ5 Gas Sensor
MQ5 Gas Sensor
1
5VDC Adapters Power Supply
Wall Mount AC Adapters ac-dc, 5 Vdc, 2 A, SW, wall-plug, EU, P5 center pos, level VI, black
1
Description

Introduction

A gas detector is a device that detects the presence of gases in an area, often as part of a safety system. This type of equipment is used to detect a gas leak or other emissions and can interface with a control system so a process can be automatically shut down. A gas detector can sound an alarm to operators in the area where the leak is occurring, giving them the opportunity to leave. This type of device is important because there are many gases that can be harmful to organic life, such as humans or animals. Gas detectors can be used to detect combustible, flammable, and toxic gases, and oxygen depletion.

About Device

There are many metal oxide sensors, known as MQ detectors, are available in a series of devices. MQ2 sensors detect methane and butane, for example. MQ138 sensors detect benzene and toluene. A partial list of MQ series sensors includes:

• MQ2 Methane, Butane, LPG, Smoke

• MQ3 Alcohol, Ethanol, Smoke

• MQ4 Methane, CNG

• MQ5 Natural gas, LPG

• MQ6 LPG, Butane

• MQ7 Carbon Monoxide

• MQ8 Hydrogen gas

But in this project, I am using an mq5 gas detector sensor with Arduino Nano. 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.

When LPG gas leakage sensed, it will give a HIGH pulse on its DO pin and Arduino constantly reads its DO pin. When Arduino receives a HIGH pulse from the LPG Gas sensor module its green led turns off and red led turns on with led a 5v buzzer also starts beeping until it senses LPG gas.

When Arduino gets a LOW pulse from the LPG Gas detector module, then the red led and buzzer turns off and the green led turns on.

Advantages

  •  Detection and prevention of any sort of gas leakage.
  •  Cost-efficient
  •  Less complex circuit

Demo video

             How the projects work

Arduino Code:--

 

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

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

 

 

I hope you enjoyed this project.

Downloads

photo_1598952982227_V8d0LwCQ9T Download
Comments
Ad