Fire detection is crucial for both residential and industrial applications. A flame sensor is a device that detects fire by sensing infrared or ultraviolet light emitted by flames. When combined with an Arduino, it can help create an automated fire detection system. In this guide, we'll cover everything you need to know about using a flame sensor with Arduino, from wiring and coding to troubleshooting and advanced applications.
Important: this is a student project and a learning demo. It is not a certified fire alarm — never rely on a DIY Arduino sensor for life safety. A real fire alarm system must be a certified, professionally installed device.
A flame sensor detects specific wavelengths of light emitted by a fire. The sensor module converts this light into an electrical signal, which is then interpreted by a microcontroller such as an Arduino.
The module used in this guide has four pins: VCC, GND, DO (digital output) and AO (analog output). A phototransistor at the front senses the infrared light from the flame; an LM393 comparator chip on the board compares the signal against a threshold set by the onboard sensitivity potentiometer. When flame is detected, the digital output DO goes LOW — that is the signal your Arduino reads. The analog output AO gives a value (0–1023) that falls as the flame gets closer, so you can also measure how near the fire is.

| Component | Purpose | Price / link |
|---|---|---|
| Arduino Uno | Main controller | Arduino UNO R3 DIP — Rs 1,200 |
| IR Flame Sensor Module | Detects the flame | Rs 140 |
| Jumper wires | Connections | Rs 180 |
| 5mm LED | Output indication (optional — the UNO's built-in LED on D13 works too) | Rs 6 |
| Active buzzer | Alarm sound (optional) | Rs 35 |
| Flame sensor / part | Arduino |
|---|---|
| VCC | 5V |
| GND | GND |
| DO (digital output) | D7 |
| Buzzer + | D8 |
| Buzzer − | GND |
| LED | D13 (the UNO's built-in LED — no extra wiring needed) |

The digital output of the flame sensor is active-low: DO is HIGH when there is no flame, and goes LOW when flame is detected. That is the one thing students get wrong most often — if your code checks for HIGH, the alarm will sound when there is no fire and stay silent when there is one.
int flamePin = 7; // Flame sensor DO
int buzzerPin = 8; // Buzzer +
int ledPin = 13; // UNO built-in LED
void setup() {
pinMode(flamePin, INPUT);
pinMode(buzzerPin, OUTPUT);
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
int flameState = digitalRead(flamePin);
if (flameState == LOW) { // LOW = flame detected (active-low output)
digitalWrite(ledPin, HIGH);
tone(buzzerPin, 1000); // 1 kHz alarm tone
Serial.println("Fire detected!");
} else {
digitalWrite(ledPin, LOW);
noTone(buzzerPin);
}
delay(1000);
}
analogRead()) falls as the flame gets closer — that is how you measure distance to the fire.For a bigger safety project, see our IoT geyser safety system — it uses the same idea (a sensor, a cut-off, and an alert) on a real appliance. And if you want the alarm to switch a siren or a pump, our relay module guide shows how a relay safely switches a bigger load.
flameState == LOW, not HIGH.The Arduino UNO R3 DIP (Rs 1,200), IR flame sensor module (Rs 140), jumper wires (Rs 180), 5mm LED (Rs 6) and active buzzer (Rs 35) are available at QKZEE Technologies, Shop 20, 1st Floor, Al-Khalil Center, Hall Road, Lahore, and online at qkzeetech.com with delivery all over Pakistan — see the links above.
If the sensor does not detect the flame, or the alarm sounds with no flame, message us — tell us whether the DO pin reads HIGH or LOW with no flame, what distance you are testing at, and whether the sensitivity potentiometer has been adjusted, and we will help you find the fault.
Why does the alarm sound when there is no fire?
Because the sensor output is active-low: DO is HIGH with no flame and LOW with flame. If your code treats HIGH as 'fire detected', the alarm sounds all the time. The condition must be flameState == LOW.
Why does the sensor not detect the flame?
Check the wiring (VCC to 5V, GND to GND, DO to D7), then turn the sensitivity potentiometer slowly while holding a candle in front of the sensor. Also check the detection angle — the sensor only sees about 60–120 degrees in front of it.
Can I use the analog output (AO) instead of DO?
Yes — read it with analogRead() on an analog pin. The value falls as the flame gets closer, so you can set your own threshold in code instead of using the potentiometer. That gives you a distance reading, not just flame / no flame.
Does sunlight trigger the flame sensor?
Yes, it can — the sensor detects infrared light, and sunlight and welding light contain plenty of it. Test indoors, and for a real installation use a sensor with a narrow detection band or combine it with a second sensor type.
Can this replace a real fire alarm?
No. This is a student learning project. A real fire alarm must be a certified, professionally installed device — never rely on a DIY Arduino sensor for life safety.
What is the detection range of the flame sensor?
For the IR module used here, about 760nm–1100nm wavelength, with a detection angle of 60–120 degrees. The practical range depends on the flame size and the sensitivity setting — typically under a metre for a candle flame.
Using a flame sensor with Arduino is an effective way to detect fire and enhance safety. With proper wiring, calibration, and coding, you can build a reliable fire detection system for various applications. Remember the two things that matter most: the sensor output is active-low (LOW means fire), and this is a learning project — not a substitute for a certified fire alarm.