In this tutorial, we will find out how to make your room alert to detect any flame.
There are three parts in this tutorial:
Introduction to Flame SensorCircuit diagramCode SchematicsIntroduction to Flame Sensor
The Flame sensor used in this tutorial is a IR Flame detector
When a fire is lit, it emits a small amount of infrared light
This light is detected using the flame sensor
Basically, it is an Ir sensor with only a IR receiver
Circuit diagram
In this project, we use the flame sensor as an digital input device
CONNECTIONS:
VCC - 5v
GND - GND
DO - pin 4
LED(positive) - 13
LED(negative) - GND
Buzzer(positive) - pin 3
Buzzer(negative) - GND
How it works:
If the sensor detects fire, it will activate the buzzer and led
and it will print "Flame detected" on serial
Code schematics:
This code will first define led, buzzer, flame_sensor and flame_detected
int buzzer = 3;
int LED = 13;
int flame_sensor = 4;
int flame_detected;
n
ext it will define flame_detected, LED, Buzzer and start Serial
void setup()
{
Serial.begin(9600);
pinMode(buzzer, OUTPUT);
pinMode(LED, OUTPUT);
pinMode(flame_sensor, INPUT);
}
T
hen, it will start void loop
void loop()
{
flame_detected = digitalRead(flame_sensor);
if (flame_detected == 1)
{
Serial.println("Flame detected.");
tone(buzzer,65,500)
delay(500)
digitalWrite(LED, HIGH);
delay(200);
digitalWrite(LED, LOW);
delay(200);
}
else
{
Serial.println("no fire detected");
digitalWrite(LED, LOW);
}
delay(1000);
}
Comments