Flame detector with Arduino


The Keyes version, KY026, only has a digital output but the code shown will still work. It will show the presence of a flame, but not show the Analog output.

The Flame Detector works by sensing the Infra Red in the flame In the range 760 to 1100nm. Any IR controller, like that used for TV etc, will also operate the detector but the output will be variable as the controller sends a series of pulses rather than a continuous signal.

I have set the sketch so that the sensors four pins can be plugged into the first four Analog pins. A0 is the Analog input, A1 is the digital input. A2 supplies the Gnd and A3 supplies the 5 volts. Before using this sketch make sure your pin out matches mine. Also bear in mind that the KY026 only has three pins, Vcc, Gnd and DO, so will not plug into the Analog pins directly (use connecting leads).

Upload the sketch and plug in the board (check the connections!). Open up the Serial Monitor and the Analog reading should be shown. If the output shows Flame Detected the output from your board is opposite to mine. Check the sketch and unrem the two lines in void loop that will work with an opposite output (REM out the current two lines).

You can test the circuit with a match or lighter, the maximum range is about four to six inches. An infra red controller can be used but the output will be a bit unreliable, probably showing flame detected every five or six times.

I suspect these detectors are used to watch pilot lights in boilers etc, but their short detection range make them unsuitable as a fire detector.

Flame Detector
/*Sensor pin out

Analog out to Arduino pin
Digital out to Arduino pin
Gnd to Arduino Fnd
Vcc to Arduino 5 volts

#define flameDetect_An A0 // analog output
#define flameDetect_Di A1 // digital output
#define GND A2 // Gnd
#define Vcc A3 // 5 volts

int led = 13; // onboard led

void setup() {
pinMode(led, OUTPUT);
pinMode(flameDetect_Di, INPUT); // Digital input
pinMode(GND, OUTPUT);
pinMode(Vcc, OUTPUT);
digitalWrite(GND, LOW); // make pin A2 supply Gnd
digitalWrite(Vcc, HIGH); // make pin A£ supply 5 volts
void loop() {
Serial.print("Sensor Value: ");
Serial.print(1024 - analogRead(flameDetect_An));
if (digitalRead(flameDetect_Di) == LOW){
//if (digitalRead(flameDetect_Di) == HIGH){
Serial.println(" Flame Detected");
digitalWrite(led, HIGH);
digitalWrite(led, LOW);


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: