LM393 Flame Sensor (3-pin)

A digital-only infrared flame detector: its DO pin goes LOW when a flame is in view.

  • PinsVCC, GND, DO
  • OutputDigital DO, pulled HIGH, LOW with the DO LED lit on a flame
  • ComparatorLM393 dual comparator, open-collector output
  • LM393 supply range2 V to 30 V
LM393 Flame Sensor (3-pin), A digital-only infrared flame detector: its DO pin goes LOW when a flame is in view.
In short

The 3-pin flame sensor is an infrared phototransistor and an LM393 comparator on one board: its DO pin is pulled HIGH and switches LOW, lighting the DO LED, when the infrared from a flame passes the threshold set on its potentiometer. Wire VCC to 3.3 V or 5 V (the LM393 runs from 2 V to 30 V, TI LM393 datasheet, p. 4), GND to GND and DO to any digital pin; use the same supply as your board's logic so DO never exceeds the GPIO's voltage.

This is the common blue three-pin flame sensor: an infrared-sensitive phototransistor in a dark epoxy package at the end of the board, an LM393 comparator, a sensitivity potentiometer, a power LED and a DO LED. The header is VCC, GND and DO. It is sold under many names (IR flame sensor module, fire sensor module) and has no maker datasheet, so its behaviour is read from the board's circuit and from TI's LM393 datasheet.

When infrared light reaches the phototransistor, the sensing node drops below the potentiometer's reference and the LM393's open-collector output pulls DO LOW; the DO LED lights at the same time. With no flame, the on-board pull-up holds DO HIGH. There is no analog output, so it reports only flame or no flame.

It sees infrared light, not fire itself. Sunlight and incandescent bulbs emit infrared too and can trip it, so it suits flame-presence demos, fire-fighting robot contests and candle detectors rather than safety alarms. If you need a flame level as well as an alarm, the four-pin KY-026 adds an analog output.

LM393 Flame Sensor (3-pin) pinout

tinkered.ai/components/flame-sensor-lm393LM393 Flame Senso…VCCPowerGNDGroundDODigital
PinFunctionType
VCCVCC (3.3-5.5 V)3.3–5 Vpower in
GNDGNDpower in
DODigitaloutput

How to wire the LM393 Flame Sensor (3-pin)

Pin by pin, for the board you have.

LM393 Flame Sensor (3-pin)Arduino UnoNote
VCC5V
GNDGND
DOD2
Open this circuit on an Arduino UnoThe full Arduino Uno guide

LM393 Flame Sensor (3-pin) code

Every example here compiles for its board.

No library needed
// LM393 Flame Sensor (3-pin) on Arduino Uno: wiring and a free simulation at https://www.tinkered.ai/components/flame-sensor-lm393
const int DO_PIN = 2;     // flame module DO: LOW while it sees a flame
const int LED_PIN = 13;   // the alarm LED

int lowReads = 0;         // consecutive reads with DO LOW
bool alarmOn = false;     // not `alarm`: the ESP32 cores declare alarm()

void setup() {
  Serial.begin(9600);
  pinMode(DO_PIN, INPUT); // the module has its own pull-up
  pinMode(LED_PIN, OUTPUT);
  Serial.println("Flame sensor ready");
}

void loop() {
  if (digitalRead(DO_PIN) == LOW) lowReads++;
  else lowReads = 0;

  // a flame for 5 reads in a row (50 ms), gone for one: the alarm follows
  bool now = lowReads >= 5;
  if (now != alarmOn) {
    alarmOn = now;
    digitalWrite(LED_PIN, alarmOn ? HIGH : LOW);
    Serial.println(alarmOn ? "FLAME detected" : "clear");
  }
  delay(10);
}
Compiled for arduino:avr:uno on 2026-10-29

Before you wire it

Do
  • VCC to the board's 5 V on an Uno, Nano, Mega or UNO R4; to 3V3 on an ESP32, ESP32-S3, ESP32-C3, ESP8266 or Pico (DO is pulled up to VCC: on 5 V it reaches 5 V, over a 3.3 V pin's limit). GND to GND.
  • DO to a digital input with pinMode(pin, INPUT): the module has its own pull-up. LOW means flame.
  • Treat a flame as DO LOW for a few consecutive reads (20-50 ms) before alarming: a real flame near the edge of its range makes DO flicker.
  • For an interrupt, use attachInterrupt(digitalPinToInterrupt(pin), isr, FALLING) (the flame appearing) and keep the ISR to setting a flag.
Don’t
  • No analogRead() of this module: it has no AO pin. For a flame level use the KY-026.
  • No "DO HIGH means flame" on this module (that is the KY-026's DO).
  • No 5 V on VCC with a 3.3 V board (ESP32, ESP8266, Pico).
  • No extra pull-up or pull-down on DO: the module has its own 10 kΩ.
  • Do not call it a smoke, heat or fire-safety detector: it sees infrared light only, and sunlight or a bulb trips it.
  • Power VCC from the same voltage as your microcontroller's logic: 5 V on an Uno or Nano, 3.3 V on an ESP32, ESP8266 or Raspberry Pi Pico. DO is pulled up to VCC, so on 5 V it would exceed a 3.3 V GPIO's limit.
  • Read DO with pinMode(pin, INPUT). The board already has its pull-up; do not add another. LOW means flame.
  • Treat a flame as DO LOW for several consecutive reads before alarming: a flicker near the edge of its range makes DO toggle.
  • Turn the potentiometer clockwise for more sensitivity. Turned to the end, the reference can leave the LM393's input range (0 V to VCC minus 1.5 V, TI LM393 datasheet, p. 8) and DO sticks LOW; back it off until the DO LED is out with no flame.

Specifications

Pins
VCC, GND, DOModule board (no maker datasheet)
Output
Digital DO, pulled HIGH, LOW with the DO LED lit on a flameModule board (no maker datasheet)
Comparator
LM393 dual comparator, open-collector outputTI LM393 datasheet (SLCS005AH), p. 17
LM393 supply range
2 V to 30 VTI LM393 datasheet (SLCS005AH), p. 4
LM393 supply current
1 mA maximum at 5 VTI LM393 datasheet (SLCS005AH), p. 8
LM393 output sink current
6 mA minimum at VOL = 1.5 VTI LM393 datasheet (SLCS005AH), p. 8
LM393 input range
0 V to VCC minus 1.5 V at 25 °CTI LM393 datasheet (SLCS005AH), p. 8
LM393 response time
1.3 µs typicalTI LM393 datasheet (SLCS005AH), p. 1
LM393 operating temperature
0 °C to 70 °CTI LM393 datasheet (SLCS005AH), p. 4
Supply voltage
3.3–5 V
Maximum supply voltage
5.5 V
Interface
Digital
Dimensions
14.2 × 8.6 × 46.6 mm
Weight
2.5 g

From the Generic (LM393 flame module)'s datasheet, published by Generic (LM393 flame module).

Common mistakes

  1. Waiting for DO to go HIGH

    On this three-pin board DO is active LOW: it drops when a flame is seen. The four-pin KY-026 does the opposite, so code copied from a KY-026 tutorial reads it backwards.

  2. Trying analogRead() on it

    There is no analog pin, only DO. For a flame level use a KY-026, whose AO pin gives one.

  3. False alarms in daylight

    Sunlight and incandescent bulbs are strong infrared sources. Point the sensor away from windows and lamps, and turn the potentiometer back until DO stays HIGH in the room with no flame.

  4. DO LED always on

    The potentiometer is turned too far, so the comparator reference sits outside the LM393's working input range (TI LM393 datasheet, p. 8). Turn it back until the LED goes out, then a little further.

  5. 5 V module on a 3.3 V board

    DO swings to the module's VCC. Powered from 5 V and read by an ESP32 or Pico, it overdrives the input. Run the module from the 3.3 V pin instead.

LM393 Flame Sensor (3-pin) questions

Can I use the 3-pin flame sensor with an ESP32 or Raspberry Pi Pico?

Yes. Power it from 3.3 V, well inside the LM393's 2 V to 30 V range (TI LM393 datasheet, p. 4), and wire DO to any digital GPIO. Powering it from 3.3 V keeps DO at a safe level for the 3.3 V input.

Is DO HIGH or LOW when the flame sensor detects fire?

LOW. The comparator's open-collector output (TI LM393 datasheet, p. 17) pulls DO down and the DO LED lights while a flame is in view; with no flame the pull-up holds DO HIGH.

Why does my flame sensor trigger with no flame?

Infrared from sunlight, a window or an incandescent bulb is reaching it, or the potentiometer is turned too far. Shade the sensor and turn the potentiometer back until the DO LED goes out.

How do I make the flame sensor more sensitive?

Turn the potentiometer clockwise to detect a flame from farther away, stopping before the DO LED stays on with no flame. Keep the flame roughly in front of the sensor: the dark-epoxy phototransistor sees best straight ahead.

3-pin flame sensor or KY-026: which should I use?

Use the 3-pin module when an on or off alarm is enough. Choose the KY-026 when you also want a flame level: it adds an analog AO output, and its DO goes HIGH rather than LOW on detection (Joy-IT SensorKit, KY-026).

Build something with the LM393 Flame Sensor (3-pin)

  • Flame alarm

    Sound a buzzer and flash an LED while DO is LOW.

    Build this
  • Fire-fighting robot

    Use several sensors around a robot to find the side the flame is on, then drive toward it and switch on a fan.

    Build this
  • Gas stove watcher

    Warn when a burner flame goes out while the gas is meant to be on.

    Build this
  • Candle-out detector

    Notice the moment a candle is blown out by watching DO return HIGH.

    Build this
For AI assistants

This page as plain Markdown, for ChatGPT, Claude or your own agent. /components/flame-sensor-lm393.md

What will you build with it?