Fire Alarm Using Arduino UNO/NANO/MEGA at Home
by TechGenius YK in Circuits > Arduino
674 Views, 1 Favorites, 0 Comments
Fire Alarm Using Arduino UNO/NANO/MEGA at Home
What does it do? When the Infrared diode sees the flame, it sends the digital out DO to also, the level of the flame is represented with Analog output
Connection
DO = D2
BUZZER = 8
DO NOT USE SERVO
CODE UPLODING
/*
* This is code for Flame Sensor module for Arduino
* watch the video:- https://youtu.be/zXgUw0JdLcg
* Other Arduino library and videos https://www.youtube.com/channel/UCNKaXZsJwhSNxG_D...
* Flame Sensor Module for Arduino
* Written by Y.K. from Tech Genius
* Permission granted to share this code given that this note is kept with the code. *
Disclaimer: This code is for educational purposes only.
*/
/*
What does it do? When the Infrared diode sees the flame, it sends the digital out DO to also, the level of the flame is represented with Analog output
*/ // 4 Infrared Obstacle code for
#define FLAME 2 // connect DO pin of sensor to this pin
#define ALARM 8 // pin 8 for Alarm
void setup() {
Serial.begin(9600);
Serial.println("Tech Genius");
pinMode(FLAME, INPUT);//define FLAME input pin
pinMode(ALARM, OUTPUT);//define ALARM output pin
}
void loop() {
int fire = digitalRead(FLAME);// read FLAME sensor
if( fire == HIGH)
{
digitalWrite(ALARM,HIGH);// set the buzzer ON
Serial.println("Fire! Fire!");
}else
{
digitalWrite(ALARM,LOW); // Set the buzzer OFF
Serial.println("OK");
}
delay(200);
}
TESTING
TAKE SOME FLAME AND OPEN THE SERIAL MONITOR TO CHEAK THE PROJECT