flame sensor interfacing with arduino for fire detection



Flame Sensor: The flame sensor is used to detect the fire or other light sources which are in the range of wavelength from 760nm to 1100nm. The module consists of an IR sensor, potentiometer, OP-Amp circuitry and a led indicator. When a flame will be detected, the module will turn on its red led. This module is sensitive to flame but it can also detect ordinary light. The detection point is 60 degrees. The sensitivity of this sensor is adjustable and it also has a stable performance.



It has both outputs, analog and digital. The analog output gives us a real time voltage output signal on thermal resistance while the digital output allows us to set a threshold via a potentiometer. In our tutorial we are going to use both of these outputs one by one and see how the sensor works.We can use the flame sensor to make an alarm when detecting the fire, for safety purpose in many projects and in many more ways.

The flame sensor module has the following features.

  • The operating voltage is from 3.3 – 5V.
  • It gives us both analog and digital output.
  • It has a led indicator, which indicates that whether the flame is detected or not.
  • The threshold value can be changes by rotating the top of potentiometer.
  • Flame detection distance, lighter flame test can be triggered within 0.8m, if the intensity of flame is high, the detection distance will be increased.
  • The detection angle of the flame sensor module is about 60 degrees.

flame sensor Pin Out

The pin out of the flame from left to right is as follows.flame sensor pinout

A0: This is the analog pin and this will be connected to the analog pin of the Arduino.

G: This is the ground pin and this will be connected to the ground of the Arduino.

+: This is the input voltage pin of the sensor and this will be connected to the +5V of Arduino.

D0: This is the digital pin and this will be connected to the digital pin of Arduino.

flame sensor interfacing with arduino using digital pin

flame sensor interfacing with arduino

First of all connect the +5V and the ground pin of the sensor with the ground and the +5V pin of the Arduino. When we will have to take the digital output of the flame sensor, then we will have to connect the digital pin of sensor to the digital pin of the Arduino. We have used the digital pin 2 of the Arduino. We can change the threshold value of the sensor when using the digital pin by rotating the top of potentiometer. We have connected the led at the pin 12 of the Arduino. When the sensor will detect a flame, then the led will light up.

Code for fire detection using digital pin

// This code is for flame sensor when using the digital pin.

int led_pin = 13 ;                                               // initializing the pin 13 as the led pin

int flame_sensor_pin = 7 ;                           // initializing pin 7 as the sensor output pin

int flame_pin = HIGH ;                                   // state of sensor




void setup ( )  {

  pinMode ( led_pin , OUTPUT ) ;                               // declaring led pin as output pin

  pinMode ( flame_sensor_pin , INPUT ) ;             // declaring sensor pin as input pin for Arduino

  Serial.begin ( 9600 ) ;                                    // setting baud rate at 9600

}




void loop ( ) {

   flame_pin = digitalRead ( flame_sensor_pin ) ;                // reading from the sensor

  if (flame_pin == LOW )                                        // applying condition

  {

    Serial.println ( " FLAME , FLAME , FLAME " ) ;

    digitalWrite ( led_pin  , HIGH ) ;            // if state is high, then turn high the led

  }

  else

  {

    Serial.println ( " no flame " ) ;

    digitalWrite ( led_pin , LOW ) ;             // otherwise turn it low

  } 

}

flame sensor interfacing with arduino using analog pin

flame sensor interfacing with arduino using analog pin

When using the analog pin of the Arduino. The Arduino will read from the sensor and gives us values from 0 to 1023. We will further have to use these values and apply conditions to turn on or off the led. In the following, we just have showed them on the screen.

Code for flame sensor arduino

This code is for testing the flame sensor when using the analog pin

int flame_Sensor_pin = A0 ;       // initializing A0 as sensor pin

int Led_pin = 12 ;                // initializing pin 12 as led pin

int Value = 0 ;                  // initializing a variable to store sensor value

void setup ( ) {

  pinMode ( Led_pin , OUTPUT ) ;                                              // declaring pin 12 as output pin

  Serial.begin ( 9600 ) ;                                                    // Setting baud rate at 9600

}

void loop ( ) {

  Value = analogRead ( flame_Sensor_pin ) ;                        // reading from the sensor

  digitalWrite ( Led_pin , HIGH ) ;

  delay (Value ) ;

  digitalWrite ( Led_pin , LOW ) ;

  delay ( Value ) ;

  Serial.print ( " SENSOR PIN A0 : " )

  Serial.println ( Value , DEC ) ;                               // displaying the value on serial monitor

}

So this flame sensor can be used for fire detection, we can also set the range of flame sensor detection. It is very easy to detect flame or fire with the help of this little module. we can extend this project with home automation project and home security based project.



2 Comments

  1. Dut Makur Mapur November 10, 2016
  2. Mohammad Rashid November 6, 2017

Add Comment

Subscribe to our blog to get updates in your email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,395 other subscribers