Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
BETTESWORTHConstruction
Arduino

Smoke Detection Using an MQ-2 Gas Sensor with Arduino

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

An MQ-2 can power a useful Arduino smoke-and-gas warning prototype, but it is not a certified smoke alarm or an accurate ppm analyzer. The sensor responds to smoke as well as LPG, propane, butane, methane, hydrogen, alcohol vapour and other combustible vapours. That broad sensitivity makes it suitable for construction-site experiments, workshops and supplementary monitoring—not as a replacement for listed residential or commercial fire protection.

What the MQ-2 detects

The MQ-2 is a heated metal-oxide semiconductor sensor. Its tin-dioxide (SnO2) sensing element changes electrical conductivity when exposed to combustible gases and vapours. An internal heater keeps the element at its operating temperature.

As an Amazon Associate I earn from qualifying purchases.

Because the response is broad, an MQ-2 cannot reliably distinguish smoke from a gas leak, solvent vapour, alcohol, aerosol spray or cooking vapour. A reading should therefore be described as a relative response or threshold crossing, not proof that smoke is present.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Typical target substances include LPG, propane, butane, methane, hydrogen, alcohol vapour and smoke. Datasheets commonly show a nominal combustible-gas range of approximately 300–10,000 ppm, while some module vendors quote 100–10,000 ppm. These figures depend on the target gas and test conditions; they are not a universal calibrated smoke-measurement range. See the MQ-2 datasheet.

#1 Best Overall
ACEIRMC 5pcs MQ-2 Gas and Smoke Analog Sensor Breakout Board for Arduino Raspberry Pi ESP8266 MQ2 5V DC (MQ-2)
  • MQ-2 gas sensor sensitive material used in the clean air low conductivity tin oxide (SnO2). When there is the environment in which the combustible gas sensor, conductivity sensor with increasing concentration of combustible gases in air increases.
  • Using a simple circuit to convert the change in conductivity of the gas concentration corresponding to the output signal.
  • MQ-2 gas sensor high on gas, propane, hydrogen sensitivity of detection of natural gas and other flammable vapors are also very good.
  • This sensor can detect a variety of flammable gas, is a low-cost sensors for a variety of applications.
  • Analog output sensor for measuring changes in H2, LPG, CH4, CO, Alcohol, Smoke or Propane

How an MQ-2 module works

A typical four-pin breakout board combines the sensing element and heater with an analogue output, an LM393-style comparator and an adjustable potentiometer.

  • AO or AOUT: a continuously varying voltage representing the sensor circuit’s response.
  • DO or DOUT: a digital threshold signal from the comparator.
  • Potentiometer: adjusts the level at which DO changes state.
  • LEDs: commonly indicate power and comparator status.

Board designs differ. Some modules pull DO low when the threshold is exceeded; others may present the logic differently. Always verify the actual board with a multimeter or a short serial-monitor test.

Parts required

  • MQ-2 sensor module
  • Arduino Uno or another 5 V-tolerant microcontroller
  • Breadboard and jumper wires
  • Stable 5 V power supply
  • LED and approximately 220 Ω resistor, if an external indicator is required
  • Buzzer and suitable transistor or driver, if needed
  • USB cable for programming and serial output

The heater is a significant load for a small sensor. Datasheet values commonly indicate about 0.8–0.9 W, with heater current often around 150–170 mA at 5 V, although module designs and measurement conditions vary. Do not power the heater from a marginal regulator or assume a weak USB source will be adequate. Check the documentation for the exact module.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Wiring an MQ-2 to an Arduino Uno

For a common four-pin 5 V module, use this connection:

MQ-2 pin Arduino Uno
VCC 5V
GND GND
AO/AOUT A0
DO/DOUT D2, optional

For analogue monitoring, only VCC, GND and AO are required. This gives software access to the changing reading, allowing averaging, filtering, hysteresis and time-qualified alarms. For a simple comparator alarm, connect DO instead, but expect less information and greater dependence on the module’s potentiometer, supply voltage and sensor history.

Rank #2
ACEIRMC 9pcs/Lot Gas Detection Sensor Module MQ-2 MQ-3 MQ-4 MQ-5 MQ-6 MQ-7 MQ-8 MQ-9 MQ-135 Sensor Module Gas Sensor Starter Kit for Arduino Raspberry Pi (9PCS/Lot)
  • MQ-2 gas sensor sensitive material used in the clean air low conductivity tin oxide (SnO2). When there is the environment in which the combustible gas sensor, conductivity sensor with increasing concentration of combustible gases in air increases.
  • Quick response and recovery characteristics
  • The dual signal output (analog output and TTL output)
  • The analog output and increased with the increase of concentration, the higher the concentration higher voltage
  • Has a very high sensitivity to sulfide, benzene vapor, smoke and other harmful gases

Voltage warning for Raspberry Pi and 3.3 V boards

A conventional Raspberry Pi has no analogue input, so AO requires an external ADC. Its GPIO pins are also not 5 V tolerant. Do not connect a 5 V MQ-2 output directly to a 3.3 V GPIO or ADC unless the exact module and interface have been verified. Use level shifting, voltage division or a purpose-built 3.3 V interface such as a compatible RAK12004 module.

Arduino analogue smoke-and-gas warning example

This example reports a relative analogue value. It does not calculate ppm. The threshold values are deliberately illustrative and must be calibrated on the installed module.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const byte MQ2_ANALOG_PIN = A0;
const byte LED_PIN = LED_BUILTIN;
const byte BUZZER_PIN = 8;

const int ALARM_ON  = 650;
const int ALARM_OFF = 600;  // hysteresis

const unsigned long WARMUP_MS = 60000UL; // demonstration only
unsigned long startTime;

int readAverage(byte pin, byte samples = 10) {
  long total = 0;
  for (byte i = 0; i < samples; i++) {
    total += analogRead(pin);
    delay(10);
  }
  return total / samples;
}

void setup() {
  pinMode(LED_PIN, OUTPUT);
  pinMode(BUZZER_PIN, OUTPUT);
  digitalWrite(LED_PIN, LOW);
  digitalWrite(BUZZER_PIN, LOW);

  Serial.begin(9600);
  startTime = millis();
  Serial.println("MQ-2 relative smoke/gas monitor");
  Serial.println("Not a certified life-safety alarm.");
}

void loop() {
  int sensorValue = readAverage(MQ2_ANALOG_PIN);

  Serial.print("MQ-2 reading: ");
  Serial.println(sensorValue);

  static bool alarm = false;

  if (millis() - startTime >= WARMUP_MS) {
    if (!alarm && sensorValue >= ALARM_ON) {
      alarm = true;
    } else if (alarm && sensorValue <= ALARM_OFF) {
      alarm = false;
    }
  }

  digitalWrite(LED_PIN, alarm ? HIGH : LOW);
  digitalWrite(BUZZER_PIN, alarm ? HIGH : LOW);
  delay(250);
}

On an Uno, analogRead() normally returns a 10-bit value from 0 to 1023. That value represents ADC voltage relative to the reference; it is not a gas concentration. Output direction can also vary with the module circuit, so confirm whether exposure makes the reading rise or fall before choosing the comparison.

Do not drive a high-current buzzer directly from an Arduino pin. Use a transistor, MOSFET or other suitable driver when the buzzer exceeds the pin’s safe current capability.

Using the digital output

const byte MQ2_DIGITAL_PIN = 2;
const byte LED_PIN = LED_BUILTIN;
const byte BUZZER_PIN = 8;

void setup() {
  pinMode(MQ2_DIGITAL_PIN, INPUT);
  pinMode(LED_PIN, OUTPUT);
  pinMode(BUZZER_PIN, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  int state = digitalRead(MQ2_DIGITAL_PIN);

  // LOW is common, but verify the actual module.
  bool alarm = (state == LOW);

  digitalWrite(LED_PIN, alarm ? HIGH : LOW);
  digitalWrite(BUZZER_PIN, alarm ? HIGH : LOW);
  Serial.println(alarm ? "Threshold exceeded" : "Normal");
  delay(100);
}

Turn the module’s potentiometer slowly while watching the LED or serial output. Verify the alarm polarity rather than assuming that LOW always means an alarm.

Rank #3
EC Buying 5Pcs MQ-2 Gas Sensor Module, Smoke and Combustible Gas Detection Board with Analog and Digital Output, Adjustable Sensitivity, 5V Operation for MCU Development Projects
  • Semiconductor gas sensor designed to detect smoke and combustible gases.
  • Provides both analog output and digital threshold output for flexible signal processing.
  • Adjustable sensitivity via onboard potentiometer for custom detection levels.
  • Integrated heater element supports stable sensing performance after warm-up.
  • Compatible with 5V microcontroller systems and development boards.

Warm-up, burn-in and calibration

The MQ-2 does not provide a stable reading immediately after power-up. Vendor guidance varies: some modules suggest several minutes for a practical reading, while the underlying datasheet specifies more than 48 hours of initial preheating under standard test conditions. Some current module vendors recommend 10–15 minutes at startup and an initial burn-in period of 48–168 hours.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

These recommendations serve different purposes. A short warm-up may be enough for a classroom demonstration; long conditioning and stabilisation are more appropriate when repeatability matters. Consult the documentation for the exact board, including the Joy-IT SEN-MQ2-V2 guidance.

A practical calibration process

  1. Install the sensor in its intended enclosure and location.
  2. Complete the manufacturer’s initial conditioning period.
  3. Allow the sensor to warm up after every restart.
  4. Record clean-air readings for several minutes and calculate the normal baseline and variation.
  5. Apply a controlled, safe test stimulus and record the size and duration of the response.
  6. Set the alarm above ordinary noise but below a repeatable test response.
  7. Repeat under realistic temperature, humidity, airflow and supply-voltage conditions.

Do not use map() to convert 0–1023 into a claimed ppm value. That creates a display scale, not a gas calibration. Genuine concentration measurement requires a known target gas, controlled conditions, a suitable load resistor, calibration data and an appropriate sensor circuit.

Why accurate ppm measurement is difficult

The sensor response depends on the target gas, sensor resistance, load resistance, heater voltage, temperature, humidity, airflow, conditioning, age, contamination and module-to-module variation. Datasheet sensitivity curves are gas-specific and apply to stated test conditions.

Two MQ-2 modules can therefore produce different readings in the same environment. Use terms such as relative sensor reading, indicative response and threshold exceeded. Avoid statements such as “700 equals 700 ppm” or “the sensor detects only smoke.”

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
2 Pack MQ-2 Smoke LPG Butane Hydrogen Gas Sensor Detector Module
  • MQ-2 Smoke LPG Butane Hydrogen Gas Sensor
  • Input Voltage : DC5V & Power consumption ( current ): 150mA & DO output: TTL digital 0 and 1 ( 0.1 and 5V) & AO output:0.1-0 .3 V ( relative to pollution ) , the maximum concentration of a voltage of about 4V
  • Special note: After the sensor is powered , needs to warm up around 20S, measured data was stable , heat sensor is a normal phenomenon , because the internal heating wire , if hot is not normal .
  • Size: 32(L)x20(W)x22(H)mm/1.26"x0.79"x0.76"
  • Package Include: 2PCS MQ-2 Sensor Module

Safe testing

Never hold a lighter flame against the sensor, release LPG or propane indoors, burn plastic or insulation, or use a gas stove as an uncontrolled calibration source. Direct heat can damage the sensor, and flammable vapours can ignite.

Safer options include a commercially available smoke-alarm test aerosol used exactly as directed, a known non-dangerous test material in a ventilated environment, a controlled laboratory gas source with proper equipment, or an electrical simulation that demonstrates the alarm logic without real smoke or gas.

Placement and enclosure

The MQ-2 heater becomes warm. Keep the sensing element away from combustible materials and do not seal it in an enclosure that blocks diffusion. For smoke experiments, place it where smoke can reach it without exposing it to direct heat. Avoid strong drafts, fans, vents, steam, condensation, cooking vapours, solvents and aerosol sprays.

For a suspected gas leak, placement must consider the target gas’s movement and density. An MQ-2 project should never be the only detector in a home, workshop, plant room or construction facility.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting

The reading is always high or always low

Check VCC, ground, AO wiring and the supply voltage. Allow adequate warm-up, inspect for contamination and confirm that the selected pin matches the code. A weak supply can cause both heater and ADC problems.

Best Value
MERICDA MQ-2 Smoke, LPG, Methane Sensor Module, 5V AO + DO Output (2 Pcs)
  • MQ-2 module for smoke, lpg, methane: SnO2 sensing element heated inside a metal mesh cap
  • Analog output AO rises with gas concentration; digital output DO switches at a level you set
  • 5V DC supply, 4-pin 2.54 mm header (VCC / GND / DO / AO), power and signal LEDs
  • Onboard LM393 comparator and threshold potentiometer, so DO can drive a buzzer or LED with no extra code
  • Two modules per pack; needs warm-up and your own calibration - a prototyping module, not a certified detector

The reading is unstable

Use a stable supply, common ground, short wiring and suitable decoupling. Average multiple samples, add hysteresis and require the threshold to remain exceeded for several seconds before alarming.

The digital output behaves backwards

DO polarity varies by board. Observe the voltage with a multimeter while adjusting the potentiometer, then reverse the software comparison if necessary.

There is no response to smoke

Smoke may not be reaching the element. Check airflow, enclosure openings, warm-up status, threshold setting and sensor condition. Different fires produce different vapours, so an MQ-2 is not a dependable substitute for a smoke-particle detector.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The Arduino resets or readings jump

The heater may be loading the USB source or regulator. Use a stable 5 V supply with adequate current capacity, share the ground correctly and keep heater-current wiring from sensitive analogue wiring where practical.

The sensor is connected to a 3.3 V controller

Stop and check voltage limits before continuing. Do not assume that a module advertised as compatible with a 3.3 V platform has 3.3 V-safe outputs. Use a verified interface or a module designed for that platform.

MQ-2 versus a real smoke alarm

Requirement MQ-2 module More suitable solution
Low-cost Arduino experiment Good MQ-2 or another hobby sensor
Several combustible gases Broad but nonspecific response Gas-specific detector
Smoke-versus-gas discrimination Poor Dedicated smoke alarm plus gas detector
Accurate ppm measurement Poor without extensive calibration Calibrated industrial instrument
Battery operation Challenging because of heater power Low-power or dedicated detector
Residential life safety Not suitable alone Listed smoke alarms installed to local guidance

A certified residential smoke alarm is designed for smoke detection and includes an alarm, enclosure, battery supervision and regulatory testing. In the United States, CPSC guidance recommends working alarms on every level, outside sleeping areas and inside bedrooms; follow the requirements applicable in your jurisdiction. See the CPSC smoke-alarm guidance and NFPA installation guide.

Quick Recap

Bestseller No. 1
ACEIRMC 5pcs MQ-2 Gas and Smoke Analog Sensor Breakout Board for Arduino Raspberry Pi ESP8266 MQ2 5V DC (MQ-2)
ACEIRMC 5pcs MQ-2 Gas and Smoke Analog Sensor Breakout Board for Arduino Raspberry Pi ESP8266 MQ2 5V DC (MQ-2)
Analog output sensor for measuring changes in H2, LPG, CH4, CO, Alcohol, Smoke or Propane
$11.99
Bestseller No. 2
Bestseller No. 3
EC Buying 5Pcs MQ-2 Gas Sensor Module, Smoke and Combustible Gas Detection Board with Analog and Digital Output, Adjustable Sensitivity, 5V Operation for MCU Development Projects
EC Buying 5Pcs MQ-2 Gas Sensor Module, Smoke and Combustible Gas Detection Board with Analog and Digital Output, Adjustable Sensitivity, 5V Operation for MCU Development Projects
Semiconductor gas sensor designed to detect smoke and combustible gases.; Provides both analog output and digital threshold output for flexible signal processing.
$9.99
Bestseller No. 4
2 Pack MQ-2 Smoke LPG Butane Hydrogen Gas Sensor Detector Module
2 Pack MQ-2 Smoke LPG Butane Hydrogen Gas Sensor Detector Module
MQ-2 Smoke LPG Butane Hydrogen Gas Sensor; Size: 32(L)x20(W)x22(H)mm/1.26"x0.79"x0.76"; Package Include: 2PCS MQ-2 Sensor Module
$7.99
Bestseller No. 5
MERICDA MQ-2 Smoke, LPG, Methane Sensor Module, 5V AO + DO Output (2 Pcs)
MERICDA MQ-2 Smoke, LPG, Methane Sensor Module, 5V AO + DO Output (2 Pcs)
MQ-2 module for smoke, lpg, methane: SnO2 sensing element heated inside a metal mesh cap; 5V DC supply, 4-pin 2.54 mm header (VCC / GND / DO / AO), power and signal LEDs
$7.99

When to choose something else

  • Residential fire protection: use listed photoelectric, ionisation or dual-sensor smoke alarms.
  • Natural gas, LPG or propane: use a detector selected and approved for that specific gas and location.
  • Industrial or commercial monitoring: use a calibrated instrument with documented accuracy, alarm levels, maintenance requirements and environmental ratings.
  • Remote notification: monitor the output of a certified smoke alarm rather than replacing its sensing function. An Arduino can provide a supplementary interface, but the certified alarm remains the safety device.
  • Raspberry Pi or 3.3 V IoT projects: use an external ADC, level shifting or a purpose-built compatible module.

Build checklist

  • Use a stable supply sized for the MQ-2 heater.
  • Confirm the exact module pinout and output polarity.
  • Protect 3.3 V inputs from 5 V outputs.
  • Complete appropriate warm-up and initial conditioning.
  • Record a clean-air baseline on the installed unit.
  • Use averaging, hysteresis and a time-qualified alarm.
  • Drive a high-current buzzer through suitable hardware.
  • Test without open flames or uncontrolled flammable gas.
  • Keep the sensor ventilated and away from combustible materials.
  • Install certified smoke alarms independently of the project.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.