Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Husham Dogar
Published © GPL3+

DIY Arduino Fire Alarm System At Home

Build your Fire Alarm System at home with Arduino UNO. In this tutorial, you will learn all steps to DIY  Arduino fire alert system.

BeginnerFull instructions provided1 hour30,508
DIY Arduino Fire Alarm System At Home

Things used in this project

Story

Read more

Custom parts and enclosures

Parts

1x Flame sensor any type.
1x Buzzer.
1x Arduino board.
some jumper wires

Schematics

analog diagram

Digital Diagram

Code

Code for Digital flame sensor

C/C++
This is the main code for digital flame sensor D0. Just upload it to Arduino.
// http://www.mrmodder.com visits for more Arduino Projects //
int Buzzer = 13; // Use buzzer for alert 
int FlamePin = 2; // This is for input pin
int Flame = HIGH; // HIGH when FLAME Exposed
 
void setup() {
 pinMode(Buzzer, OUTPUT);
 pinMode(FlamePin, INPUT);
 Serial.begin(9600);
 
}
 
void loop() {
 Flame = digitalRead(FlamePin);
 if (Flame== HIGH)
 {
 Serial.println("HIGH FLAME");
 digitalWrite(Buzzer, HIGH);
 }
 else
 {
 Serial.println("No flame");
 digitalWrite(Buzzer, LOW);
 }
}

Source Code for A0 Analog flam sensor.

C/C++
Upload this code to Arduino board if you are using Analog sensor A0
//        http://www.mrmodder.com   visits for more Arduino Projects //
const int analogPin = A0;    // Flame Sensor (A0) to Arduino analog input pin A0
const int BuzzerPin = 13;       // Buzzer output pin
const int threshold = 400;   // Flame level threshold (You can vary the value depends on your need)
 
void setup() {
  
  pinMode(BuzzerPin, OUTPUT);
  // initialize serial communications:
  <b>Serial</b>.begin(9600);
}
 
void loop() {
  // read the value of the Flame Sensor:
  int analogValue = analogRead(analogPin);
   <b>Serial</b>.println(analogValue); //serial print the FLAME sensor value
  
  if (analogValue &gt; threshold) {
    digitalWrite(BuzzerPin, HIGH);
    <b>Serial</b>.print("High FLAME");
  } 
  else if (analogValue = threshold){
    <b>Serial</b>.print("Low FLAME");
    digitalWrite(BuzzerPin, HIGH);
    delay(400);
    digitalWrite(BuzzerPin, LOW);
  }
  else {
    digitalWrite(BuzzerPin, LOW);
    <b>Serial</b>.print("No flame");
  }
 
  delay(1);       
}

Credits

Husham Dogar

Husham Dogar

3 projects • 25 followers
Arduino and Raspberry pi project developer.

Comments