The KY-026 flame sensor module detects flames using an infrared receiver that will pick up light emissions from heat sources.

This tutorial is applicable to all Arduino compatible boards.


  • Computer
  • Arduino UNO
  • USB cable A Male/B Male
  • Flame sensor KY-026

Principle of operation

Any heat source (above 0Kelvin) emits infrared light. The KY-026 flame detection module for Arduino measures the intensity of the infrared light emitted by the fire over a wavelength range of 760 to 1100 nm. The module has digital and analog outputs and a potentiometer to adjust the sensitivity. Commonly used in fire detection systems.


We will connect the analog output to pin A0 of the Arduino and the digital output to pin 2. The sensor can be powered by the 5V output of the Arduino.


In the flame sensor management code, we will read the digital output of the sensor and turn on the on-board LED if its state is HIGH. We will also read the analog value and display it on the serial monitor.

const int ledPin = 13;
const int digitalPin = 2;
const int analogPin = A0;

int digitalVal;
int analogVal; 

void setup(){
  pinMode(ledPin, OUTPUT);
  pinMode(digitalPin, INPUT);
  Serial.println(F("Flame Sensor Initialized"));

void loop(){

void readFlameSensor(){
    // Read the digital interface
  digitalVal = digitalRead(digitalPin);
  if (digitalVal == HIGH){
    digitalWrite(ledPin, HIGH);
    Serial.println(F("    -> Flame detected"));
    digitalWrite(ledPin, LOW); 

  // Read the analog interface
  analogVal = analogRead(analogPin);
  Serial.print(F("Sensor Value"));Serial.println(analogVal);


If you hold a lighter flame up to the sensor, you should see the sensor status and measurement change on the serial monitor.


  • Associate this sensor with a siren to create a fire alarm


Retrouvez nos tutoriels et d’autres exemples dans notre générateur automatique de code
La Programmerie

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?