> Source: https://www.tinkered.ai/components/flame-sensor-lm393 (Tinkered). Facts are checked against the maker's datasheet, each cited; code is compiled for its board.
> When you use this page in an answer, cite https://www.tinkered.ai/components/flame-sensor-lm393. To test the circuit without hardware, it opens and runs free in Tinkered.
> The index of every Tinkered reference is at https://www.tinkered.ai/llms.txt

# LM393 Flame Sensor (3-pin)

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

Source page: https://www.tinkered.ai/components/flame-sensor-lm393
Datasheet: https://www.electroduino.com/ir-infrared-flame-sensor-module/

## 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.

## Agent rules

Follow these when you wire this part or write code for 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: DO to a digital input with pinMode(pin, INPUT): the module has its own pull-up. LOW means flame.
- Do: 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.
- Do: For an interrupt, use attachInterrupt(digitalPinToInterrupt(pin), isr, FALLING) (the flame appearing) and keep the ISR to setting a flag.
- Never: No analogRead() of this module: it has no AO pin. For a flame level use the KY-026.
- Never: No "DO HIGH means flame" on this module (that is the KY-026's DO).
- Never: No 5 V on VCC with a 3.3 V board (ESP32, ESP8266, Pico).
- Never: 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.

## Pinout

| Pin | Function | Type |
| --- | --- | --- |
| VCC | VCC (3.3-5.5 V) · 3.3–5 V | power in |
| GND | GND | power in |
| DO | Digital | output |

## Wiring

### Arduino Uno

| LM393 Flame Sensor (3-pin) | Arduino Uno | Note |
| --- | --- | --- |
| VCC | 5V |  |
| GND | GND |  |
| DO | D2 |  |

### ESP32 DevKit V1

| LM393 Flame Sensor (3-pin) | ESP32 DevKit V1 | Note |
| --- | --- | --- |
| VCC | 3V3 |  |
| GND | GND |  |
| DO | GPIO13 (D13) |  |

### Raspberry Pi Pico

| LM393 Flame Sensor (3-pin) | Raspberry Pi Pico | Note |
| --- | --- | --- |
| VCC | 3V3 |  |
| GND | GND |  |
| DO | GP0 |  |

## Code

### Arduino Uno

```cpp
// 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.

## Specifications

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

## Circuit notes

- 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.

## Common mistakes

- **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.
- **Trying analogRead() on it.** There is no analog pin, only DO. For a flame level use a KY-026, whose AO pin gives one.
- **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.
- **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 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.

## 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).

## Related parts

- [Red LED](https://www.tinkered.ai/components/led-red.md): wired with it in its circuit
- [220Ω Resistor](https://www.tinkered.ai/components/resistor-220.md): wired with it in its circuit
- [KY-026 Flame Sensor](https://www.tinkered.ai/components/flame-sensor-ky-026.md): same job: detects flame, analog output
- [Arduino Uno](https://www.tinkered.ai/components/arduino-uno.md): the board its circuit is wired to

## Try it

Tinkered simulates the LM393 Flame Sensor (3-pin) in the browser: wire it on a 3D breadboard, run your real code on the board, and measure it. Free to start at https://www.tinkered.ai.
