Shashwat Raj
Published © GPL3+

How to make gas leak alert security alarm using arduino

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

IntermediateFull instructions provided20,762
How to make gas leak alert security alarm using arduino

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Gravity: Analog LPG Gas Sensor (MQ5) For Arduino
DFRobot Gravity: Analog LPG Gas Sensor (MQ5) For Arduino
×1
LED (generic)
LED (generic)
×1
5 mm LED: Green
5 mm LED: Green
×1
Buzzer
Buzzer
×1
5V 2.5A Switching Power Supply
Digilent 5V 2.5A Switching Power Supply
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free
PCB, For DMB-4775
PCB, For DMB-4775

Story

Read more

Schematics

Circuit Diagram

Code

Arduino source code

Arduino
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);
}

Credits

Shashwat Raj

Shashwat Raj

7 projects • 12 followers
My name is Shashwat Raj. I love doing projects with arduino and Raspberry Pi. You want to view more please subscribe to my YouTube Channel.

Comments