Smoke and fire early-warning alarm
Read AOUT with an Arduino and sound a buzzer and flash an LED when the level crosses a set point, giving an early alert for smoke or a smoldering fault.
MQ-2 is a low-cost tin-dioxide (SnO2) semiconductor sensor that detects combustible gases and smoke (LPG, propane, methane, hydrogen, alcohol) and reports concentration as an analog voltage.

The MQ-2 is a metal-oxide semiconductor (MOS) gas sensor built around a tin-dioxide (SnO2) sensing layer deposited on a small heated ceramic tube. It responds to a broad group of combustible gases and smoke, including LPG, propane, butane, methane, hydrogen, and alcohol vapor, across roughly 300 to 10,000 ppm. On the common breakout module the sensor is paired with support circuitry and exposed through four pins: VCC, GND, an analog output (AOUT), and a digital output (DOUT).
An internal heater keeps the SnO2 layer hot so gas molecules can react at its surface. When combustible (reducing) gas is present, the sensing resistance Rs drops, and the module converts that change into a rising voltage on AOUT that tracks concentration. A separate onboard LM393 comparator plus a blue trimmer potentiometer produce the DOUT signal, which simply flips state when the concentration crosses the threshold you dial in with the pot.
The MQ-2 measures relative gas concentration rather than calibrated ppm out of the box. Deriving an actual ppm figure requires establishing the sensor's clean-air baseline resistance (R0) and applying the per-gas sensitivity curves from the datasheet. It also needs warm-up time: the heater must stabilize before readings are trustworthy, and a brand-new sensor benefits from an extended initial burn-in before its baseline settles.
| Pin | Function | Type |
|---|---|---|
AOUT AOUT / AO | Analog gas concentration voltage | Digital output |
DOUT DOUT / DO | Digital comparator threshold output | Digital output |
GND GND | Power | Power in |
VCC VCC (5V) | Power | Power in |
Verified from the Tinkered component library · Hanwei / generic breakout module.
The MQ-2 Gas Sensor connects to any of the microcontrollers supported in Tinkered. Mind the 5 V logic level on 3.3 V boards.
The MQ-2 outputs a relative signal, not a ready-made ppm value. To estimate concentration you must first measure the clean-air baseline resistance (R0), then apply the datasheet's Rs/R0 sensitivity curve for the specific gas you care about.
The heated SnO2 layer needs time to stabilize. Values drift noticeably for the first seconds to minutes after power-up, and a brand-new sensor needs a long initial burn-in. Sampling immediately gives readings that keep sliding as the element heats.
DOUT is only a comparator flag whose trip level you set with the onboard potentiometer. It tells you 'above/below the threshold,' not how much gas is present. Use AOUT and the ADC when you actually want to measure or graph concentration.
The heater pulls around 150mA and needs a steady 5V. Running several sensors, or the sensor plus other loads, from a thin USB cable or shared regulator causes voltage sag, unstable readings, and resets.
The MQ-2 is broadband: it responds to LPG, propane, methane, hydrogen, alcohol, and smoke together and cannot tell them apart. A high reading means 'combustible gas or smoke present,' not which gas it is.
Read AOUT with an Arduino and sound a buzzer and flash an LED when the level crosses a set point, giving an early alert for smoke or a smoldering fault.
Mount the sensor near a stove or gas line and trigger an alarm or a relay-driven shutoff when combustible-gas concentration climbs above a safe threshold.
Show the analog reading in real time on an LCD or OLED and log the trend, useful for watching air quality in a workshop or enclosed space.
Pair the MQ-2 with an ESP-class board to push notifications or dashboard updates when gas or smoke is detected in an unattended room.
Drop the MQ-2 Gas Sensor into a circuit, write firmware, and simulate it in your browser, then deploy to real hardware. All in one editable Tinkered project.