Flame sensor with Arduino | Flame sensor with led indicator and buzzer
Hello, welcome back. In this tutorial, we will learn what is the flame sensor and how to work with an Arduino. These types of sensors are mainly used for fire detection. That is, these sensors are included in the fire detection systems. These are designed to be very sensitive to fire. Also, this tutorial includes how to make a fire detection system using the flame sensor, so you can better understand how this sensor works. Now you can see the different types of flame sensors below.
How do flame sensors work?
These sensors include one or more IR receiver diodes. The main purpose of these sensors is to detect IR rays. That is, when there is a fire near this sensor, it can detect the IR rays in the fire (these IR rays are invisible to our eye). Then, it gives us a signal through these sensors. That is, we can get that signal as a digital or analog value.
In this tutorial, we will learn about the sensor below. But, all these sensors work in the same way.
The PIN structure of this sensor
OK, let’s learn how to work this flame sensor with an Arduino. A simple fire detecting system project has been used for this. So, let’s do this project step by step. The required components are given below.
- Arduino Nano board x 1 — Our Store / Amazon
- Flame sensor x 1 — Our Store / Amazon
- LED x 1 — Our Store / Amazon
- 180-ohm resistor x 1 — Our Store / Amazon
- Buzzer x 1 — Our Store / Amazon
- Breadboard x 1 — Our Store / Amazon
- Jumper wires — Our Store / Amazon
Disclosure: These Amazon links are Affiliate links. As an Amazon Associate, I earn from qualifying purchases.
Step 1
Firstly, identify these components.
Step 2
Secondly, connect these components. To do this, use the circuit diagram below.
Step 3
Thirdly, let’s creates the program for this project. It is as follows.
- The complete program of this project – Download
/*Flame sensor with Arduino Nano.
created by the SriTu Hobby team.
Home Page
*/
#define Sensor 2
#define Buzzer 3
#define LED 4
void setup() {
Serial.begin(9600);
pinMode(Sensor, INPUT);
pinMode(LED, OUTPUT);
pinMode(Buzzer, OUTPUT);
}
void loop() {
bool value = digitalRead(Sensor);
Serial.println(value);
if (value == 0) {
digitalWrite(LED, HIGH);
digitalWrite(Buzzer, HIGH);
} else {
digitalWrite(LED, LOW);
digitalWrite(Buzzer, LOW);
}
}
Code Explanation
Firstly, the sensor, buzzer, and LED pins are defined.
#define Sensor 2
#define Buzzer 3
#define LED 4
In the setup function, the sensor PIN is set to the input PIN. Also, LED pins and buzzer pins are set as output pins.
void setup() {
Serial.begin(9600);
pinMode(Sensor, INPUT);
pinMode(LED, OUTPUT);
pinMode(Buzzer, OUTPUT);
}
In the loop function,
void loop() {
// Obtains values from the sensor
bool value = digitalRead(Sensor);
Serial.println(value);
// Those values are checked using the IF condition. If the value is 0, the LED and Buzzer activated.
if (value == 0) {
digitalWrite(LED, HIGH);
digitalWrite(Buzzer, HIGH);
//Otherwise, the LED and Buzzer turns off
} else {
digitalWrite(LED, LOW);
digitalWrite(Buzzer, LOW);
}
}
Step 4
Now, select the board and port. Lastly, upload this code to the Arduino board.
OK, enjoy this project. The full video guide is given below. So, we will meet in the next tutorial.
Flame sensor with Arduino | Flame sensor with led indicator and buzzer