How to Use LM393 IR Flame Sensor with Arduino
By Kunkune | Published: 2026-10-24
Category: How-to Guides
Learn how to wire and program the LM393 IR flame detection module with Arduino. Step-by-step guide with code, common mistakes, and troubleshooting tips.
Quick answer
Connect the LM393 IR flame sensor's VCC pin to Arduino 5V, GND to GND, and the digital output pin to a digital input pin like D2. Use the provided code to read the sensor and trigger an action when flame is detected.
How the LM393 IR Flame Sensor Works
The LM393 module detects infrared light from a flame (typically in the 760–1100 nm range). It outputs a digital HIGH signal when flame is present and LOW when not. The onboard LM393 comparator chip processes the IR receiver's signal, so you don't need an analog-to-digital conversion on the Arduino side.
The module has a 4-pin interface: VCC (power), GND (ground), DO (digital output), and AO (analog output). For most projects, you only need the digital output pin. The analog output can be used for more precise flame distance estimation, but the digital output is simpler and sufficient for basic detection.
Common Pitfall: Power Supply Voltage
The LM393 module is rated for 3.3–5V input. Do not connect it to the Arduino's 5V pin directly if you are using a 5V Arduino board—that's fine. However, if you use a 3.3V Arduino board (like some Arduino clones), use the 3.3V pin instead. Supplying more than 5V can damage the module.
Step-by-step wiring and code
- Wire the sensor to Arduino: Connect VCC (pin 1) to Arduino 5V, GND (pin 2) to GND, DO (pin 3) to digital pin 2. Leave AO (pin 4) unconnected for this guide. Double-check that VCC goes to 5V, not 3.3V, unless your board only provides 3.3V.
- Upload the test sketch: Open the Arduino IDE and upload this code: const int flamePin = 2; void setup() { pinMode(flamePin, INPUT); Serial.begin(9600); } void loop() { int flame = digitalRead(flamePin); if (flame == HIGH) { Serial.println("Flame detected!"); } else { Serial.println("No flame"); } delay(500); } If you see continuous 'Flame detected!' even without a flame, the sensor may be picking up sunlight or other IR sources. Test in a dimmer environment.
- Test with a flame source: Hold a lighter (unlit) or a candle flame about 10–20 cm from the sensor. The serial monitor should show 'Flame detected!'. Move the flame farther away to see the detection range. Do not place the sensor directly in the flame—it can melt the plastic housing. Keep a safe distance.
- Add an action (optional): To trigger something when flame is detected, modify the loop: if (flame == HIGH) { digitalWrite(ledPin, HIGH); // turn on an LED or buzzer delay(1000); digitalWrite(ledPin, LOW); } Make sure the output device (LED, buzzer) is wired to a separate pin and that you have declared it in setup().
Product used in this guide
- LM393 IR Flame Detection Sensor Module Fire Detector: LM393 4 Pin IR Flame Detection Sensor Module Fire Detector Infrared Receiver Module for Arduino This module gives you a ready-to-use IR flame detector with both digital and analog outputs, so you can focus on your project instead of building the sensor circuit from scratch.

LM393 IR Flame Detection Sensor Module Fire Detector
