The main objective of this tutorial is to develop a flame detection system capable of identifying the presence of a flame or intense heat source using the KY-026 flame sensor, while employing the ESP8266 NodeMCU microcontroller for data processing and control.
This project aims to:
- detect a flame or fire in the environment by monitoring the analog and digital signals from the KY-026 sensor.
- use the ESP8266 NodeMCU to read sensor data and determine whether a flame is present.
- activate visual (LED) and audible (buzzer) indicators when a flame is detected, providing immediate alerts.
- display system status and sensor readings on an LCD I2C screen for real-time monitoring.
- demonstrate how the system can be easily integrated into a smart home or fire safety IoT project.
Through this tutorial, learners will understand the working principle of the KY-026 sensor, how to interface it with the ESP8266, and how to write a MicroPython program to control the alert mechanisms and display relevant data.
The flame detection system works by continuously monitoring the environment for the presence of a flame or infrared (IR) light emitted by a fire source using the KY-026 flame sensor.
1- Flame Detection:
The KY-026 sensor detects infrared radiation within a wavelength range of approximately 760 nm to 1100 nm.
When a flame or heat source is brought near the sensor, it generates an analog signal proportional to the intensity of the detected light and a digital signal indicating the presence of a flame.
2- Signal Processing by ESP8266 NodeMCU:
The ESP8266 NodeMCU reads the analog value from the sensor through its ADC (analog-to-digital converter) pin.
It compares this value with a predefined threshold to determine whether a flame is detected.
3- Visual and Audible Alerts:
When a flame is detected, the LED turns ON to provide a visual indication.
Simultaneously, the buzzer is activated to generate an audible alarm, signaling the presence of fire or heat.
When no flame is present, the LED remains OFF and the buzzer stays silent.
The I2C LCD screen displays alert message such as: “Flame Detected!”
1- ESP8266 NodeMCU

The ESP8266 NodeMCU is the main microcontroller that reads data from the KY-026 sensor, processes it, and controls the output devices (LED, buzzer, and LCD).
2- KY-026 Flame Sensor Module

The KY-026 Flame Sensor Module Detects the presence of a flame or infrared light and provides both analog and digital outputs.
3- I2C LCD Screen (20x4)

The I2C LCD Screen displays alert message such as: “Flame Detected!”.
4- Red LED
![]()
The red LED serves as a visual indicator when a flame is detected.
5- Buzzer

The Buzzer produces an audible alarm to alert when the system detects a flame.
6- Breadboard (Plaque d’essai)

La plaque d'essai provides an easy platform for connecting all components without soldering.
7- Jumper Wires

The jumper wires are Used for making the necessary connections between the ESP8266, sensor, LED, buzzer, and LCD.


Educational robotics refers to the use of robots and robotics technology to promote learning in educational settings. It involves the integration of technology, engineering, and computer science into the classroom, allowing students to engage in hands-on, project-based learning experiences.
In this context, our website represents an excellent resource for parents, teachers and children who wish to discover robotics.
Zaouiet Kontech-Jemmel-Monastir-Tunisia
+216 92 886 231
medaliprof@gmail.com
Robotic site created by MedAli-Teacher info