Skip to content
E

Gas & Air Quality

Interfacing MQ 3 Gas & Air Quality with Espressif ESP32

What is the MQ 3?

MQ 3 practical reference

Tuned specifically for detecting alcohol vapor concentration, frequently used in breathalyzer-style hobby projects. The MQ-3 is a metal-oxide semiconductor gas sensor whose surface resistance changes in the presence of ethanol vapor, producing an analog output that increases with alcohol concentration — like other MQ-series sensors it needs a warm-up period and isn't lab-calibrated, so it's best suited for relative/comparative alcohol-detection demos rather than legally-relevant breathalyzer readings.

Key specifications

  • Sensor type: MQ-3 metal-oxide semiconductor (MOS) gas sensor, tuned for alcohol vapor
  • Operating voltage: 5 V DC (heater circuit + sensing circuit both typically run at 5V)
  • Detection range: ~0.05-10 mg/L alcohol vapor concentration
  • Warm-up time: Requires several minutes (some sources recommend 24-48 hours for first-use burn-in) of heater warm-up before stable readings
  • Output: Analog voltage proportional to alcohol vapor concentration, plus a digital threshold output (DO) on breakout modules with an onboard comparator
  • Sensitivity adjustment: Onboard potentiometer sets the digital-output trigger threshold
  • Interface: 1 analog pin (AO) + 1 digital pin (DO, breakout-dependent)

Pinout and connection notes

Like all MQ-series sensors, allow several minutes of warm-up after power-on before trusting readings, since the internal heater element needs time to reach a stable operating temperature; results also drift with humidity and temperature, so treat readings as relative/comparative rather than a precisely calibrated measurement, and never rely on this sensor for legal or medical breath-alcohol determinations.

  • VCC: Power, 5V DC (powers both the internal heater and sensing circuit)
  • GND: Ground
  • AO: Analog output — voltage proportional to alcohol vapor concentration
  • DO: Digital output — threshold-triggered HIGH/LOW based on the onboard potentiometer setting

Integration checklist

  1. Confirm the exact part number and breakout-board revision.
  2. Verify supply voltage, current demand, logic levels, and signal direction against the datasheet.
  3. Check controller pin assignments and bus address or interface mode against the example code.
  4. Power up with external loads disconnected, then test signals before full integration.
  5. If readings or communication fail, check power and ground first, then pin mapping, interface settings, and library initialization.

Troubleshooting and reproducibility

Record the board used, wiring, library/version, supply arrangement, and measured behavior. Use the selected board-specific wiring example as the source of truth. Never assume visually similar modules share identical voltage tolerance or pin order.

Setting Up MQ 3 with Espressif ESP32

Wiring

Component pinEspressif ESP32 pinNote
VCC5V (VIN)Heater needs the full 5V rail — don't power from 3V3
GNDGND
AOGPIO34 (through a voltage divider)AO can swing close to 5V, above the ESP32 ADC's 3.3V limit — use a divider sized for a 5V source
DOGPIO25 (optional)Digital threshold output

Swipe sideways to see every column →

C++
  • Don't skip the voltage divider — MQ-3's analog output isn't 3.3V-safe on its own.
  • Same warm-up and "not a real breathalyzer" caveats apply as on the Arduino Uno — see that board's notes on this page.
  • Average a few ADC samples per reading if you need steadier numbers; the ESP32 ADC is noisier than the Uno's.

Related Components

Related Guides & Projects