Arduino Fire Detection System Using Flames Sensor, LED and Buzzer
Hello everyone! Today I will show you how to use a fire sensor with Arduino.
The required Component kits are :
There are 4 pins on the digital sound sensor. but i use 3 pins flame sensor which They are :
- AO-Analog pin
- GND-Ground pin ✅✔
- VCC-positive power pin ✅✔
- DO-digital output pin ✅✔
There are two legs on a LED. The longer leg is positive and the shorter leg is negative. A buzzer has similar legs. The steps to setup hardware are listed below:
- Connect “VCC” pin of the sensor to 5V pin on the arduino.
- Connect “GND” ground pin to GND pin on the arduino.
- Connect “AO” analog output pin to any analog or digital pins on the arduino.In this tutorial I connected it with A2
- Connect longer LED leg to pin 13 on the arduino. If you want to use anyother pin on the arduino, you need to use a 220 ohm resistor.
- Connect shorter LED leg to GND pin on the arduino.
- FIx buzzer on the breadboard.
- Connect longer buzzer leg to pin 11(or any other pin) on the arduino.
- Connect shorter buzzer leg to GND pin on the arduino.
The setup is complete. Now, upload the code and enjoy.
Check out the tutorial
Sources Code
const int ledpin=13; // ledpin,flamepin and buzpin are not changed throughout the process
const int flamepin=A2;
const int buzpin=11;
const int threshold=200;// sets threshold value for flame sensor
int flamesensvalue=0; // initialize flamesensor reading
void setup() {
Serial.begin(9600);
pinMode(ledpin,OUTPUT);
pinMode(flamepin,INPUT);
pinMode(buzpin,OUTPUT);
}
void loop() {
flamesensvalue=analogRead(flamepin); // reads analog data from flame sensor
if (flamesensvalue<=threshold) { // compares reading from flame sensor with the threshold value
digitalWrite(ledpin,HIGH); //turns on led and buzzer
tone(buzpin,100);
delay(1000); //stops program for 1 second
}
else{
digitalWrite(ledpin,LOW); //turns led off led and buzzer
noTone(buzpin);
}
}
2 thoughts on “Fire Detection System Using Arduino and Flames Sensor”