Fire Detector Interfacing Flame sensor with Arduino

Fire Detector Interfacing Flame sensor with Arduino Fire Detector Interfacing Flame sensor with Arduino

In this quick tutorial we are connecting IR flame sensor (KY-026) with Arduino to make fire or flame detector using a buzzer or LED light to create an alert.

Before getting started lets learn about the IR flame sensor principle, how it works, Pinout diagrams and specifications of sensor.

What is IR flame Sensor?

The IR Flame sensor KY-026 is a device which detects the Infra-Red light wavelengths of a fire generally between 760nm to 1100 nm(Nanometers). This flame sensor captures the signals from the IR light and send them to the Arduino through Analog output or Digital output.

Flame sensors are mainly used in Industries where there are machinery which run with fuel elements like coal, oil. If something occurs unexpectedly which leads to fire these flame sensors captures the signals and send them to the controller to alert the management. These are incorporated as a safely devices.

Also read: Automatic Plant watering system using Arduino or ESP8266

The sensors used in industries are of high precision and has the capacity to capture more wavelengths of Ultra Violet as well as Infrared. The sensor we used in this example has less precession with a range to measure InfraRed wavelengths between 760-1100nm with a detection angle of 60 degrees and distance up to 0.40 to 0.80 meters.

Principle and Working:

This type of infrared flame sensors is usually incorporated with a standard measurement using LM393 comparator, which allows to obtain the reading in both analog and digital outputs when a certain threshold is exceeded, which is regulated through a potentiometer located in the plate.

flame sensor threshold graph

As we can see the wavelength of this cheap and small flame sensors are will not perform well when compared to industrial sensors. These may even affected by indoor lighting which can lead to numerous false positives.

Therefore, the sensitivity and reliability of these cheap flame sensors are not enough to consider them a true security device, although they can be interesting in small electronics projects and for educational purposes, such as sounding an alarm or activating an LED when detecting the flame of a lighter.

KY-026 Flame sensor Pinout Diagram:

flame sensor pinout diagram

Flame sensor Specifications

  • Operating Voltage: 3.3V – 5V DC
  • Detection range: 60 °
  • Detectable wavelength: 760 – 1100 nm
  • Working temperature: -25 ° C to 85 ° C
  • LM393 in onboard comparator mode
  • 1 digital output
  • 1 analog output
  • Potentiometer to adjust sensitivity

Interfacing KY-026 flame sensor with Arduino

Required components:

  • 1 X Flame sensor (KY-026)
  • 1 X Arduino Uno R3 development board
  • 1 X Buzzer or Light (Or both).
  • Few connecting wires.

Circuit Diagram:

Connect the Flame sensor and Arduino UNO R3 as shown in the image below.

interfacing flame sensor with arduino circuit diagramAs you can see from the above image the Vcc (+) pin from sensor is connected to the 5v pin on the Arduino, The GND(-) pin from the sensor is connected to the GND pin of Arduino. And D0 the digital output pin from the sensor is connected to the pin 10 of Arduino. And finally the Buzzer/LED is connected as + pin from buzzer is connected to pin 13 of Arduino and – pin to GND. You can also connect the LED instead of buzzer or along with piezo buzzer, while doing so check the voltages and add resistance.

That’s it for connection, Now copy the below code and paste in the Arduino IDE and Upload the code to Arduino.

Source code for Flame Detector:

int buz_pin = 13 ;// initializing the pin 9 as the buzzer/LED pin
 
int flame_sensor_pin = 10 ;// initializing pin 10 as the sensor digital output pin
int flame_pin = HIGH ; // current state of sensor
 
void setup ( ) {
 
pinMode ( buz_pin , OUTPUT ); // declaring buzzer 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 ( " ALERT: FLAME DETECTED" ) ;
digitalWrite ( buz_pin , HIGH ) ;// if state is high, then turn high the BUZZER
}
 
else
{
Serial.println ( " NO FLAME DETECTED " ) ;
digitalWrite ( buz_pin , LOW ) ; // otherwise turn it low
}
}

After uploading the code its time to test the device. Now turn on the device, Grab a Lighter or match box and generate the flame and bring it near the sensor and watch the results. If the buzzer sounds when the flame is near the sensor then the device is working perfectly. you can also check the results in the Arduino IDE serial monitor.

output result of flame sensor