KY-026 Flame Sensor Module
The KY-026 is a flame sensor module capable of detecting light in the 760 nm to 1100 nm wavelength range. It offers both analog and digital outputs, with adjustable sensitivity via an onboard potentiometer, making it suitable for various flame detection applications.

On this page
KY-026 pinout
The KY-026 is a 4-pin flame sensor module with dual outputs:
| Pin | Type | Description | Notes |
|---|---|---|---|
| GND | Power | Ground connection | |
| +V | Power | Power supply | 3.3V or 5V |
| D0 | Communication | Digital output | HIGH when flame intensity exceeds threshold |
| A0 | Communication | Analog output | Voltage proportional to flame intensity |
Interface: Dual output (analog + digital with comparator)
Sensor: Infrared phototransistor (760-1100nm wavelength detection)
Analog Output: Continuous flame intensity measurement
Digital Output: Threshold-based fire alarm trigger (adjustable via potentiometer)
Power: 3.3V or 5V operation
Detection Range: 60-100cm (varies with flame size)
Detection Angle: Approximately 60° cone
Applications: Fire detection systems, flame alarms, firefighting robots, safety monitors
Wiring the KY-026 to ESP32
To interface the KY-026 with an ESP32 for flame detection:
| KY-026 pin | ESP32 pin | Purpose |
|---|---|---|
| GND | GND | Ground |
| +V | 3.3V or 5V | Power supply |
| D0 | GPIO17 | Digital input (any GPIO) · optional |
| A0 | GPIO36 | Analog input (ADC pin) · optional |
Digital Mode: Use D0 for simple fire alarm (flame detected/not detected)
Analog Mode: Use A0 for flame intensity measurement and proximity estimation
ADC Pins: Use GPIO32-39 for analog input on ESP32
Voltage: 3.3V recommended for ESP32 ADC compatibility
Adjustment: Turn onboard potentiometer to set fire detection threshold
IR Sensitivity: Detects 760-1100nm wavelength (near-infrared range)
False Positives: May respond to sunlight, halogen lamps, or hot objects
LED Indicators: Power LED and detection status LED onboard
KY-026 code examples
KY-026 Arduino example
Copy// Declaration and initialization of the input pins
int analog_input = 36; // Analog output of the sensor (GPIO36, matches the wiring above)
int digital_input = 17; // Digital output of the sensor (GPIO17)
void setup() {
pinMode(digital_input, INPUT);
Serial.begin(115200);
Serial.println("KY-026 Flame detection");
}
void loop() {
// Read current values and convert to voltage (ESP32: 12-bit ADC, 3.3V)
float analog_value = analogRead(analog_input) * (3.3 / 4095.0);
int digital_value = digitalRead(digital_input);
Serial.print("Analog voltage value: ");
Serial.print(analog_value, 4);
Serial.print(" V, Threshold value: ");
if (digital_value == 1) {
Serial.println("reached");
} else {
Serial.println("not reached");
}
Serial.println("-------------------------------");
delay(1000);
}This Arduino code reads the analog voltage from the KY-026 sensor's analog output and checks the digital output to determine if the flame intensity has surpassed the set threshold. The results are printed to the serial monitor every second.
KY-026 ESP-IDF example
Copy#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/adc.h"
#include "driver/gpio.h"
#define FLAME_SENSOR_ANALOG_PIN ADC1_CHANNEL_0 // GPIO36
#define FLAME_SENSOR_DIGITAL_PIN GPIO_NUM_17
void app_main(void) {
adc1_config_width(ADC_WIDTH_BIT_12);
adc1_config_channel_atten(FLAME_SENSOR_ANALOG_PIN, ADC_ATTEN_DB_11);
gpio_set_direction(FLAME_SENSOR_DIGITAL_PIN, GPIO_MODE_INPUT);
printf("KY-026 Flame Detection\n");
while (1) {
int analog_value = adc1_get_raw(FLAME_SENSOR_ANALOG_PIN);
int digital_value = gpio_get_level(FLAME_SENSOR_DIGITAL_PIN);
printf("Analog Value: %d, Digital Threshold: %s\n", analog_value, digital_value ? "Flame Detected" : "No Flame");
vTaskDelay(pdMS_TO_TICKS(1000));
}
}This ESP-IDF code reads the analog value from the KY-026 sensor using ADC on GPIO36 and monitors the digital output on GPIO17 to determine if the flame intensity threshold is exceeded. The results are printed every second.
KY-026 ESPHome example
Copysensor:
- platform: adc
pin: GPIO36
name: "KY-026 Flame Intensity"
update_interval: 1s
binary_sensor:
- platform: gpio
pin:
number: GPIO17
mode: INPUT_PULLUP
name: "KY-026 Flame Detection"This ESPHome configuration reads the KY-026 sensor's analog output on GPIO36 and detects the flame threshold trigger using GPIO17 as a binary sensor. Updates are logged every second.
KY-026 PlatformIO example
Copy[env:esp32]
platform = espressif32
board = esp32dev
framework = arduino#include <Arduino.h>
#define FLAME_SENSOR_ANALOG_PIN A0
#define FLAME_SENSOR_DIGITAL_PIN 17
void setup() {
pinMode(FLAME_SENSOR_DIGITAL_PIN, INPUT);
Serial.begin(115200);
Serial.println("KY-026 Flame Sensor Test");
}
void loop() {
int analog_value = analogRead(FLAME_SENSOR_ANALOG_PIN);
int digital_value = digitalRead(FLAME_SENSOR_DIGITAL_PIN);
Serial.printf("Analog: %d, Digital: %s\n", analog_value, digital_value ? "Flame Detected" : "No Flame");
delay(1000);
}This PlatformIO code reads the KY-026 sensor's analog output and monitors the digital flame detection trigger. The values are printed every second.
KY-026 MicroPython example
Copyimport machine
import time
FLAME_SENSOR_ANALOG_PIN = machine.ADC(machine.Pin(36))
FLAME_SENSOR_ANALOG_PIN.atten(machine.ADC.ATTN_11DB)
FLAME_SENSOR_DIGITAL_PIN = machine.Pin(17, machine.Pin.IN, machine.Pin.PULL_UP)
while True:
analog_value = FLAME_SENSOR_ANALOG_PIN.read()
digital_value = FLAME_SENSOR_DIGITAL_PIN.value()
print("Analog:", analog_value, "Digital:", "Flame Detected" if digital_value else "No Flame")
time.sleep(1)This MicroPython script reads the KY-026 sensor's analog signal using ADC on GPIO36 and monitors the digital output on GPIO17. The readings are printed every second.
KY-026 specifications
About the KY-026
The KY-026 centers on a YG1006 NPN phototransistor, sensitive to the 760-1100 nm near-infrared band that open flames radiate strongly in, mounted on the same LM393-comparator-plus-potentiometer board format as the KY-024 and KY-025 modules. The digital pin trips once the sensed IR intensity crosses whatever threshold the trim pot is set to, and the analog pin exposes the phototransistor’s raw signal for anything that wants a continuous reading instead of a simple trigger.
Some listings market this as suitable for “fire alarm” or “fire detection system” use, which is worth pushing back on: it’s an uncalibrated few-dollar phototransistor with no flame-flicker verification, no smoke sensing, and no certification behind it, and it responds to any strong near-IR source - direct sunlight, incandescent or halogen bulbs, even a warm object held close - not flame specifically. It’s a fun sensor for a demo or a hobby robot that reacts to a candle, but it shouldn’t stand in for an actual certified smoke or heat detector in anything meant to protect people or property.
KY-026 troubleshooting
No Response from Sensor
›
Issue: The sensor does not provide any output when exposed to a flame.
Solutions:
- Verify all connections are secure and correctly placed.
- Ensure the module is receiving the appropriate voltage (3.3V or 5V).
- Adjust the potentiometer to set the correct sensitivity threshold.
- Test the sensor with a known flame source to confirm functionality.
False Positives
›
Issue: The sensor triggers without the presence of a flame.
Solutions:
- Reduce the sensitivity by adjusting the potentiometer.
- Avoid exposing the sensor to direct sunlight or other strong light sources.
- Ensure there are no reflective surfaces causing stray light to reach the sensor.
Where to buy the KY-026

Similar sensors





