The flame sensor module, commonly identified by part numbers KY-026 or HW-491, is an electronic component designed to detect the presence of fire by sensing the specific infrared (IR) light wavelengths emitted by flames. It typically consists of an IR receiver diode and a comparator circuit that allows it to provide both analog and digital output signals to a microcontroller.
The Physics of Flame Detection
To understand how the KY-026 works, one must first understand the electromagnetic spectrum of a fire. Most common fires emit a significant amount of radiation in the infrared spectrum, specifically in the range of 760nm to 1100nm. The heart of the flame sensor module is a photodiode or phototransistor that is chemically tuned to be sensitive to these specific wavelengths while ignoring most visible light.
When a flame is present within the sensor's field of view, the IR radiation hits the photodiode, causing a change in its electrical resistance. This change in resistance alters the voltage across the sensor. Because the sensor is designed as a voltage divider, the presence of IR light typically causes the output voltage to drop. This raw electrical change is what the rest of the module processes to determine if a fire is present.
Hardware Components and Circuitry
The module is more than just a sensor; it is a complete circuit board that simplifies the interface between the raw photodiode and a digital processor like an Arduino or ESP32. The primary components include:
- The IR Receiver: A black-tinted diode that filters out visible light to reduce false positives from room lighting.
- The LM393 Comparator: This integrated circuit compares the voltage from the IR receiver against a reference voltage. If the sensor voltage drops below the reference, the comparator flips its output state.
- Potentiometer: A small adjustable screw (trimmer) that allows the user to set the sensitivity threshold. Turning this changes the reference voltage, determining how "strong" a flame must be before the digital pin triggers.
- On-board LEDs: Usually, there are two LEDs—one for power and one that lights up when a flame is detected.
Digital vs. Analog Output
One of the most useful features of the HW-491/KY-026 is that it provides two distinct types of data output. Understanding the difference is critical for designing a reliable system.
The Digital Output (DO) provides a binary signal: HIGH or LOW. This is ideal for simple trigger systems, such as sounding a buzzer or activating a relay. When the IR intensity crosses the threshold set by the potentiometer, the DO pin changes state. This removes the need for the microcontroller to perform complex calculations; it simply checks if the pin is active.
The Analog Output (AO) provides a continuous voltage range. Instead of a simple yes/no, the AO pin tells the microcontroller exactly how much IR radiation is being detected. This is valuable for determining the distance of the fire or the size of the flame. A lower voltage typically indicates a stronger IR source (closer or larger fire), allowing the developer to program different levels of alerts based on the intensity of the signal.
Wiring and Integration Steps
Integrating the module into a project requires a basic understanding of GPIO (General Purpose Input/Output) pins. The module typically has four pins: VCC, GND, DO, and AO.
- Power Connection: Connect VCC to the 5V or 3.3V pin of the microcontroller (depending on the specific module version) and GND to the common ground.
- Signal Connection: Connect the DO pin to a digital input pin on the microcontroller for simple detection, or the AO pin to an Analog-to-Digital Converter (ADC) pin for intensity measurement.
- Calibration: Power the module in an environment without fire. Turn the potentiometer until the indicator LED just turns off. This ensures the sensor is not triggering on ambient infrared noise.
- Testing: Use a controlled flame, such as a lighter, held at a safe distance to verify that the LED triggers and the microcontroller receives the signal.
Common Problems and Troubleshooting
Users often encounter issues where the sensor is either too sensitive or completely unresponsive. Most of these problems stem from environmental factors rather than hardware failure.
Sunlight Interference: The most common cause of false positives is direct sunlight. The sun is a massive emitter of infrared radiation. If the sensor is placed near a window, it may trigger a "fire" alert even in a cold room. To fix this, the sensor should be shielded from direct sunlight or placed in a housing that limits its field of view to the area being monitored.
Incorrect Thresholds: If the digital output never triggers, the potentiometer may be turned too far in one direction. If it is always on, it is turned too far the other way. Calibration must be done in the actual environment where the sensor will be deployed, as ambient IR levels vary between rooms.
Range Limitations: These sensors have a limited effective range, typically between 20cm and 100cm depending on the size of the flame. Attempting to detect a small candle from across a large room will likely fail because the IR intensity drops off according to the inverse square law.
Comparisons with Other Fire Sensors
The KY-026 is an entry-level sensor. For professional or high-stakes applications, other technologies are often used alongside or instead of IR detection.
- Smoke Detectors (Ionization/Photoelectric): While the flame sensor looks for light, smoke detectors look for particles. A flame sensor is faster at detecting an open fire, but a smoke detector is better at detecting a smoldering fire that hasn't produced a visible flame yet.
- Thermistor/Heat Sensors: These detect the rise in ambient temperature. They are much slower than IR sensors but are not fooled by sunlight.
- Gas Sensors (MQ series): These detect combustible gases or carbon monoxide. They provide an early warning before a fire even starts.
In a robust safety system, a "multi-sensor fusion" approach is used, where a trigger is only confirmed if both the IR sensor (flame) and the MQ sensor (gas) or a thermistor (heat) report an anomaly simultaneously.
Safety and Deployment Precautions
When working with flame sensors, it is vital to remember that these modules are generally intended for educational, prototyping, or low-risk hobbyist projects. They should not be the sole reliance for life-safety systems in residential or industrial buildings.
Proper deployment requires considering the "line of sight." Since IR light travels in straight lines, the sensor cannot "see" around corners. If you are monitoring a room, multiple sensors must be placed to cover all angles. Additionally, the sensor's lens can become coated in soot or dust over time, which blocks IR radiation and renders the sensor blind. Regular cleaning of the photodiode is necessary for maintained accuracy.
Frequently Asked Questions
Can the KY-026 detect a candle from 5 meters away?
Generally, no. The IR intensity of a small candle is not strong enough to trigger the photodiode at that distance. These modules are typically effective up to about 1 meter for small flames, though very large fires can be detected from further away.
Why does my sensor trigger when I turn on the lights?
Some incandescent or halogen bulbs emit infrared radiation. If the sensor is pointed directly at these light sources, it may perceive the IR as a flame. Using LED lighting or adjusting the potentiometer sensitivity can mitigate this issue.
Does the module work with 3.3V logic like the ESP32?
Yes, most of these modules can operate at 3.3V. However, you should check the specific voltage rating of the LM393 comparator on your board. If powered at 5V, the digital output will be 5V, which could damage 3.3V-only pins; in such cases, a voltage divider is required on the signal line.
How do I tell if the sensor is broken?
If the power LED is on but the digital output does not change regardless of the potentiometer position or the presence of a flame, the photodiode may be damaged. You can test the raw photodiode with a multimeter to see if its resistance changes when exposed to an IR source.
Can I use this sensor to start a fire-suppression system?
While technically possible, it is not recommended for critical safety. Because IR sensors are prone to false positives from sunlight or heat lamps, a single KY-026 could accidentally trigger a sprinkler or extinguisher. Always use redundant sensors and a confirmation logic circuit for suppression systems.