fradirosa00Giancarlo00
Published © CC BY-NC-SA

Arduino Fire Alarm

If the flame sensor detects a flame, a buzzer and a LED (connected by a relay) will activate.

IntermediateShowcase (no instructions)1.5 hours34,316
Arduino Fire Alarm

Things used in this project

Hardware components

Adafruit Flame sensor module
×1
Buzzer
Buzzer
×1
LED (generic)
LED (generic)
×1
Relay (generic)
×1
Arduino Leonardo
Arduino Leonardo
×1
Resistor 221 ohm
Resistor 221 ohm
×1
Breadboard (generic)
Breadboard (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Fritzing circuit

Connecting diagram of the project

Code

Fire alarm with Arduino Leonardo

Arduino
int relay = 4 ;// define relay pin
int flamedigital = 9; // define the flame sensor digital pin
int flameanalog = A3; // define the flame sensor analog pin
int buzzer = 11; //define buzzer pin
int val ; // define numeric variable val
float sensor; //define floating variable sensor

void setup ()
{
  pinMode (flamedigital, INPUT) ;// input interface defines the flame sensor
  pinMode (flameanalog, INPUT) ;// input interface defines the flame sensor
  pinMode (relay, OUTPUT); //output interface defines the relay
  pinMode (buzzer, OUTPUT); //output interface defines the buzzer
}

void loop ()
{
  sensor = analogRead(flameanalog); //read flameanalog value and assigne it to sensor variable


  val = digitalRead (flamedigital) ;// read flamedigital value and assigne it to val variable
  if (val == HIGH) // When the flame sensor detects a signal relay is on and buzzer sound (void alarm)
  {
    alarm();
    digitalWrite (relay, HIGH); //close the relay circuit

  }
  else
  {
    digitalWrite (relay, LOW); //open the relay circuit
  }
  delay(1000);
}

void alarm()  {
  tone(buzzer, 400, 500); //the buzzer emit sound at 400 MHz for 500 millis
  delay(500); //wait 500 millis
  tone(buzzer, 650, 500); //the buzzer emit sound at 650 MHz for 500 millis
  delay(500); //wait 500 millis
}

Credits

fradirosa00
0 projects • 0 followers
Contact
Giancarlo00
1 project • 0 followers
Contact

Comments

Please log in or sign up to comment.