Flame Sensor with Arduino UNO

Flame Sensor with Arduino UNO
Atribot team

Written by

Atribot team

Last updated

June 18, 2026

Introduction

The Flame Sensor is a fire detection sensor designed to detect infrared light emitted by flames. It is commonly used in fire alarm systems, safety monitoring devices, industrial protection systems, and smart home automation projects. The sensor can quickly detect the presence of a flame and provide a digital output signal to the Arduino.

In this tutorial, you will learn how to interface a Flame Sensor with an Arduino UNO, upload the code, and detect the presence of fire using the Serial Monitor. By the end of this guide, you'll understand how to build basic fire detection systems using Arduino.

Components Required

Swipe right to view full table
Item NameQtyAction
1
Flame sensor
1
USB Cable
1
Breadboard
1
Jumper Wires
5

Tools Required

Swipe right to view full table
Item NameAction
Soldering Iron
Screwdriver

Software Required

Swipe right to view full table
Item NameAction
Arduio IDE

Circuit Diagram

Flame Sensor with Arduino UNO Circuit Connections
Flame Sensor with Arduino UNO Circuit Connections

Source Code

flame-sensor-with-arduino-uno.inocpp
const int flameSensorPin = 2;

void setup()
{
  pinMode(flameSensorPin, INPUT);
  Serial.begin(9600);
}

void loop()
{
  int flameState = digitalRead(flameSensorPin);

  if(flameState == LOW)
  {
    Serial.println("Flame Detected");
  }
  else
  {
    Serial.println("No Flame");
  }

  delay(500);
}

Step by Step Instructions

Step 1: Connect the Flame Sensor

Make the following connections:

Swipe right to view full table

Flame Sensor

Arduino UNO

VCC

5V

GND

GND

DO

D2

Step 2: Open Arduino IDE

  1. Launch Arduino IDE.

  2. Connect Arduino UNO using USB.

  3. Select:

    • Board → Arduino UNO

    • Port → Correct COM Port

Step 3: Create a New Sketch

Create a new Arduino sketch and paste the provided code.

Step 4: Verify the Code

Click the Verify button to check for syntax errors.

Step 5: Upload the Code

Click Upload and wait until the upload process completes successfully.

Step 6: Open Serial Monitor

  1. Open Serial Monitor.

  2. Set the baud rate to 9600.

  3. Carefully bring a small flame source (such as a candle) near the sensor.

  4. Observe the detection messages displayed on the Serial Monitor.

The Serial Monitor will continuously display the flame detection status.

Expected Output

When no flame is present:

No Flame
No Flame
No Flame

When a flame is detected:

Flame Detected
Flame Detected
Flame Detected

Conclusion

In this tutorial, you learned how to interface a Flame Sensor with Arduino UNO and detect the presence of fire using digital input. This setup can be used in fire alarm systems, safety monitoring devices, industrial protection systems, and various Arduino projects that require flame detection.