Gas Sensor (MQ Series)

What is MQ-Series?
Gas sensors in the MQ series are devices that detect the presence of toxic, flammable, or combustible gases in the air. They are widely used for home air quality monitoring, gas leak alarms, and industrial exhaust safety systems.
Each MQ model (e.g., MQ-2 for methane/butane, MQ-7 for carbon monoxide, and MQ-135 for air quality) uses an internal heating element and an electrochemical substrate, outputting both analog voltage data and a simple digital threshold signal.
Key Features
Dual Output
Provides analog output (0-5V) for precise gas levels and digital output (TTL) for simple threshold alarms.
Wide Detection Range
Detects various gases (Smoke, LPG, CO, Alcohol, Methane, etc.) depending on the MQ model used.
Adjustable Threshold
Onboard potentiometer lets users calibrate digital trigger sensitivity easily.
Fast Response
Responsive sensor that reacts to gas concentration changes within seconds.
Long Operational Life
Simple and robust construction provides long-term reliability and stability.
Easy Integration
Directly interfaces with Arduino and ESP32 analog/digital pins without complex libraries.
Pin Configuration
VCC
5V Power Supply. Required to drive the internal heating element. Do not use 3.3V.
GND
Ground Connection. Connect to the common ground reference of the board.
AO
Analog Output. Outputs a voltage (0-5V) directly proportional to the gas concentration in the air.
DO
Digital Output. Digital trigger that outputs HIGH/LOW based on the onboard potentiometer limit.
How It Works
The Science Behind It
Gas sensors like the MQ-2 use a Metal Oxide Semiconductor (SnO2) layer. When the sensor is heated, it interacts with gas molecules in the air.
In clean air, the sensor has high resistance. When combustible gases are present, the gas molecules react with the oxygen on the SnO2 surface, releasing electrons and decreasing the resistance of the sensor.
Chemi-resistance & Output:
Clean Air = High Resistance (Rs/Ro is high)
Gas Present = Low Resistance (Rs/Ro drops below 1)
Output Voltage (V_AO) = VCC ร [RL / (Rs + RL)]Wiring Tips & Best Practices
Burn-in Period
The internal heater needs a 24-48 hour initial burn-in period to stabilize sensor readings before accurate calibration.
High Current Draw
The internal heater consumes around 150mA. Avoid powering multiple MQ sensors directly from Arduino 5V pins.
Warm-up Time
After power-up, the sensor needs 1-2 minutes to warm up and stabilize. Readings during this time will be inaccurate.
Temp & Humidity
Gas readings are sensitive to temperature and humidity. Incorporate a DHT11 sensor to compensate for ambient changes in code.
Physical Protection
Keep the sensor away from dust, water droplets, and corrosive chemicals, which can coat the SnO2 layer and permanently degrade sensitivity.
Potentiometer Calibration
Rotate the onboard potentiometer to set the trigger threshold in clean air, adjusting it until the digital output LED turns off.