logologo

HOMEABOUTSERVICESBLOGSBOOKSSHOPCONTACT

+977 9803661701support@nepatronix.orgLokanthali, Bhaktapur

© 2025 NepaTronix all rigths reserved

Fire and Gas Monitoring System(IoT Project)

  Back To Blogs

The Fire and Gas Monitoring System is designed to enhance safety in residential, commercial, and industrial environments. It continuously monitors for fire and gas leaks using a fire sensor and an MQ2 gas sensor. When a hazardous condition is detected, the system alerts the user via an LCD display and activates a buzzer. This system provides an effective way to quickly respond to fire outbreaks and gas leaks, potentially preventing damage and saving lives.

Project : 2

Fire and Gas Monitoring System

Description

The Fire and Gas Monitoring System is designed to enhance safety in residential, commercial, and industrial environments. It continuously monitors for fire and gas leaks using a fire sensor and an MQ2 gas sensor. When a hazardous condition is detected, the system alerts the user via an LCD display and activates a buzzer. This system provides an effective way to quickly respond to fire outbreaks and gas leaks, potentially preventing damage and saving lives.

Required Components

  1. Arduino Board: The central microcontroller to process sensor data and control the display and buzzer (e.g., Arduino Uno, Mega).
  2. Fire Sensor: A sensor to detect the presence of fire or high temperatures.
  3. MQ2 Gas Sensor: A sensor to detect smoke and various gases like LPG, CO, and methane.
  4. LCD Display with I2C Interface: A 16x2 LCD to display the status of fire and gas detection.
  5. Buzzer: An audible alert that sounds when a hazardous condition is detected.
  6. Connecting Wires: Wires to connect all components to the Arduino.
  7. Breadboard (Optional): For easier prototyping and connections.

Working Principle

  1. Initialization:
    • The Arduino initializes serial communication for debugging purposes.
    • The LCD is initialized and a welcome message is displayed.
    • Sensor pins and the buzzer pin are configured.
  2. Sensor Reading:
    • The fire sensor provides a digital output (HIGH or LOW) indicating the presence of fire.
    • The MQ2 gas sensor provides an analog output that corresponds to the concentration of detected gases.
  3. Data Processing:
    • The Arduino reads the digital output from the fire sensor.
    • It also reads the analog value from the MQ2 gas sensor, which is then compared to a predefined threshold to determine the presence of hazardous gas levels.
  4. Display and Alerts:
    • The sensor readings are displayed on the LCD, showing whether fire is detected and the gas concentration level.
    • If fire is detected or the gas concentration exceeds the threshold, the buzzer is activated to alert the user.
  5. Continuous Monitoring:
    • The system continuously monitors the environment by repeatedly reading sensor values and updating the display and buzzer status.

Code:

#include <Wire.h>

#include <LiquidCrystal_I2C.h>

 

// Define the I2C address for the LCD

LiquidCrystal_I2C lcd(0x27, 16, 2); // Adjust the address 0x27 if needed

 

// Define sensor pins

const int fireSensorPin = 2;

const int mq2SensorPin = A0;

const int buzzerPin = 8;

 

void setup() {

  // Initialize the serial communication

  Serial.begin(9600);

 

  // Initialize the LCD

  lcd.begin();

  lcd.backlight();

  lcd.setCursor(0, 0);

  lcd.print("Initializing...");

 

  // Initialize sensor pins

  pinMode(fireSensorPin, INPUT);

  pinMode(mq2SensorPin, INPUT);

  pinMode(buzzerPin, OUTPUT);

 

  // Wait for a second to initialize

  delay(1000);

  lcd.clear();

}

 

void loop() {

  // Read the fire sensor value

  int fireSensorValue = digitalRead(fireSensorPin);

 

  // Read the MQ2 sensor value

  int mq2SensorValue = analogRead(mq2SensorPin);

 

  // Print the sensor values to the Serial Monitor

  Serial.print("Fire Sensor: ");

  Serial.print(fireSensorValue);

  Serial.print("  MQ2 Sensor: ");

  Serial.println(mq2SensorValue);

 

  // Display sensor values on the LCD

  lcd.setCursor(0, 0);

  lcd.print("Fire: ");

  lcd.print(fireSensorValue ? "No" : "Yes");

 

  lcd.setCursor(0, 1);

  lcd.print("Smoke: ");

  lcd.print(mq2SensorValue);

 

  // Check if fire or smoke is detected

  if (fireSensorValue == LOW || mq2SensorValue > 300) { // Adjust threshold as needed

    digitalWrite(buzzerPin, HIGH); // Turn on buzzer

  } else {

    digitalWrite(buzzerPin, LOW);  // Turn off buzzer

  }

 

  delay(500); // Wait for 0.5 second before next reading

}

Conclusion

The Fire and Gas Monitoring System is a reliable and efficient solution for detecting fire and gas leaks. It provides real-time monitoring and immediate alerts through an LCD display and buzzer, allowing for quick responses to potential hazards. This system can significantly enhance safety measures in various settings, reducing the risk of damage and harm caused by fire and gas leaks. The integration of sensors with an Arduino microcontroller and a user-friendly display makes it a versatile and valuable addition to any safety protocol.




Total likes : 3

Comments







Read More Blogs!

Automatic Street Light Control(STEAM Education)

Understanding the operation and application of an automatic street light system using an LDR.


1.6k04

Smart Bell(Automation Project)

This project aims to create a smart doorbell system using an ESP32 microcontroller. The system integrates a relay, buzzer, and transistor to notify users of a visitor's presence, and an RTC (Real-Time Clock) module for timekeeping. The project demonstrates how IoT can be utilized for smart home automation, enhancing security and convenience.


3.1k017

Hydrogen Reader Through ESP32 (Mobile App Based)

The Hydrogen Gas Monitoring System project aims to create a wireless system that can monitor hydrogen gas levels and upload the data to a Firebase database for remote monitoring and analysis. The system utilizes an ESP32 development board, a hydrogen gas sensor, and Firebase's real-time database. The objective is to provide an efficient and reliable solution for monitoring hydrogen gas levels in an environment.


1.7k04

Electromagnet with Compass(STEAM Education)

To understand the concept of electromagnetism and explore the direction of magnetic fields and poles.


1.7k05