Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO Based Fire Alarm System with Gas and Flame Detection

View and Edit Project In Cirkit DesignerImage of Arduino UNO Based Fire Alarm System with Gas and Flame Detection

Circuit Documentation

Summary

The circuit is designed as a fire alarm system that utilizes an Arduino UNO as the central processing unit. It includes a flame sensor and a smoke sensor for fire detection, two red LEDs, one green LED, and two buzzers for alerting purposes. A 12V single-channel relay is used to control a water pump as part of the fire suppression system. The circuit is powered by a 5V battery. Resistors are used to limit current to the LEDs.

Component List

Arduino UNO

12V Single Channel Relay

Flame Sensor

Smoke Sensor

LED: Two Pin (red)

LED: Two Pin (green)

Buzzer

Water Pump

Resistor (200 Ohms)

5V Battery

Wiring Details

Arduino UNO

12V Single Channel Relay

Flame Sensor

Smoke Sensor

LEDs (Red and Green)

Buzzer

Water Pump

Resistor (200 Ohms)

5V Battery

Documented Code

/*
www.arduinopoint.com 
Fire Alarm System 
*/

int redLed1 = 3;
int redLed2 = 4;
int greenLed = 8;
int buzzer1 = 5; //PWM (~) pin
int buzzer2 = 6; //PWM (~) pin
int gasPin = A0;
int flamePin = 2;
// Your threshold value
int gasSensorThres = 400;

void setup() {
  pinMode(redLed1, OUTPUT);  
  pinMode(redLed2, OUTPUT);
  pinMode(greenLed, OUTPUT);
  pinMode(buzzer1, OUTPUT);
  pinMode(buzzer2, OUTPUT);
  pinMode(gasPin, INPUT);
  pinMode(flamePin, INPUT);
  Serial.begin(9600);
}

void loop() {
  int gasSensor = analogRead(gasPin);
  int flameSensor = digitalRead(flamePin);
  
  Serial.print("gasPin Value: ");
  Serial.println(gasSensor);
  Serial.print("flamePin Value: ");
  Serial.println(flameSensor);
  delay(1000);
  
  if (gasSensor > gasSensorThres  && flameSensor==LOW){
    digitalWrite(redLed1, HIGH);
    tone(buzzer1, 5000); //the buzzer sound frequency at 5000 Hz
    digitalWrite(redLed2, HIGH);
    tone(buzzer2, 5000); //the buzzer sound frequency at 5000 Hz
    digitalWrite(greenLed, LOW);
  }
   else if (gasSensor > gasSensorThres)
  {
    digitalWrite(redLed1, HIGH);
    tone(buzzer1, 5000); //the buzzer sound frequency at 5000 Hz
    digitalWrite(redLed2, LOW);
    noTone(buzzer2);
    digitalWrite(greenLed, LOW);
  }
  else if (flameSensor==LOW){ // HIGH MEANS NO FLAME
    digitalWrite(redLed1, LOW);
    noTone(buzzer1);
    digitalWrite(redLed2, HIGH);
    tone(buzzer2, 5000); //the buzzer sound frequency at 5000 Hz
    digitalWrite(greenLed, LOW);
    }
  
  else
  {
    digitalWrite(redLed1, LOW);
    digitalWrite(redLed2, LOW);
    noTone(buzzer1);
    noTone(buzzer2);
    digitalWrite(greenLed, HIGH);    
  }
}

This code is designed for a fire alarm system. It reads the values from a gas sensor and a flame sensor, and activates different combinations of red and green LEDs and buzzers depending on the sensor readings. If both sensors detect fire conditions, both red LEDs and buzzers are activated. If only the gas sensor detects a fire condition, only one red LED and buzzer are activated. If only the flame sensor detects a fire condition, the other red LED and buzzer are activated. If neither sensor detects a fire condition, the green LED is activated.