Component guide · Beginner · 3 min read
MQ-9 CO and Combustible Gas Sensor

Pinout, Wiring and Code
By Geekobot Learning Team · Updated 29 Oct 2026
On this page
The MQ-9 is a metal-oxide gas sensor for carbon monoxide and combustible gases such as methane and LPG. It is designed to cycle its heater between 5 V and 1.5 V, reading gases in the hot phase and CO in the cool phase. Modules give analog and digital outputs. Power it from 5 V and use it for learning, not as a safety alarm.
Key specs at a glance
- Detects
- CO and Combustible Gas
- Range
- CO about 10 to 1,000 ppm (low-heat phase); methane and LPG about 100 to 10,000 ppm (high-heat phase)
- Heater
- 5 V, about 150 mA (about 0.75 W)
- Output
- Analog (AO) and digital threshold (DO) on modules
- Warm-up
- A few minutes before use; 24 to 48 hours of burn-in for stable readings
- Heater cycle
- Datasheet method: 5 V for 60 s (combustible gases), 1.5 V for 90 s (CO)
Models in this guide
These are alternatives. Pick the one that fits your project; you only need one.
What the MQ-9 is
The MQ-9 detects carbon monoxide and combustible gases such as methane and LPG. Like the MQ-7, it is designed for a heater cycle: the high phase measures combustible gases and cleans the sensor, and the low phase measures CO.
Modules with a constant 5 V heater mainly show combustible gas changes. MQ sensors are for hobby and learning projects. They are not certified gas alarms; for safety use an approved detector.
MQ-9 pinout
The pins on the MQ-9 and what each one does.
| Pin | Function |
|---|---|
| VCC | 5 V supply for the heater and the comparator |
| GND | Ground |
| AO | Analog output: rises as the gas level rises |
| DO | Digital output from the LM393 comparator; switches at the level set by the trim pot |
- VCC
- 5 V supply for the heater and the comparator
- GND
- Ground
- AO
- Analog output: rises as the gas level rises
- DO
- Digital output from the LM393 comparator; switches at the level set by the trim pot
Wiring the MQ-9
The heater draws about 150 mA, so power it from the 5 V rail, not a 3.3 V pin. The analog output can reach 5 V, so an ESP32 needs a divider (10 kΩ over 20 kΩ gives a third off) on AO.
| MQ-9 pin | Arduino Uno | ESP32 |
|---|---|---|
| VCC | 5V | 5V (VIN) |
| GND | GND | GND |
| AO | A0 | GPIO 34 through a 10k/20k divider |
| DO | D2 (optional) | GPIO 27 (optional, via divider) |
- VCC
- Arduino Uno:
- 5V
- ESP32:
- 5V (VIN)
- GND
- Arduino Uno:
- GND
- ESP32:
- GND
- AO
- Arduino Uno:
- A0
- ESP32:
- GPIO 34 through a 10k/20k divider
- DO
- Arduino Uno:
- D2 (optional)
- ESP32:
- GPIO 27 (optional, via divider)
Example code
Rs/R0 falls as the gas level rises. Convert it to ppm with the curve in the datasheet; treat the result as an estimate, not a certified reading.
const int AO = A0;
const float RL = 10.0; // load resistor on the module, kOhm (check yours)
const float CLEAN_AIR = 9.6; // Rs/R0 in clean air from the datasheet curve
float R0 = 0;
float readRs() {
long sum = 0;
for (int i = 0; i < 50; i++) { sum += analogRead(AO); delay(5); }
float v = (sum / 50.0) * 5.0 / 1023.0;
return RL * (5.0 - v) / v; // sensor resistance, kOhm
}
void setup() {
Serial.begin(115200);
Serial.println("Warming up 3 minutes in clean air...");
delay(180000);
R0 = readRs() / CLEAN_AIR; // calibrate in clean air
Serial.print("R0 = "); Serial.println(R0);
}
void loop() {
float ratio = readRs() / R0; // lower ratio = more gas
Serial.print("Rs/R0 = "); Serial.println(ratio, 2);
delay(1000);
}Setup and tuning
read combustible gases at the end of the 5 V phase and CO at the end of the 1.5 V phase.
set R0 in clean air (clean-air ratio about 9.6).
for 24 to 48 hours when new.
record readings over a day to see the normal range before setting an alarm level.
What you need
Shop this list6 of 7 found in our store · ₹2,667
MQ-9 CO, methane and LPG gas sensor module: the sensor this guide coversMQ-9 CO, Methane & LPG Gas Sensor Module – 5V DC, Analog & Digital Output₹119Closest match, check the specs
DFRobot Gravity Analog CO/Combustible Gas Sensor MQ9 Module: another version this guide coversDFRobot Gravity Analog CO/Combustible Gas Sensor MQ9 Module₹1,019
Seeed Studio Studio Grove MQ9 Gas Sensor Module for CO & Combustible Gas Detection – Analog Output: another version this guide coversSeeed Studio Grove MQ9 Gas Sensor Module for CO & Combustible Gas Detection – Analog Output₹1,259Closest match, check the specs- Uno R3 development board: the controller used in the wiring tableFind this part
IRLZ44N logic-level MOSFET: to cycle the heaterIRLZ44N Logic-Level N-Channel MOSFET₹42Closest match, check the specs
16x2 LCD with I2C: to show readings on a character display16×2 LCD with I2C (RG1602A)₹179Closest match, check the specs
Dupont jumper wires: for the connectionsDupont Jumper Wires (40 pcs)₹49Closest match, check the specs
Alternatives and when to choose them
- MQ-7: focused on CO.
- MQ-5: focused on LPG.
- MQ gas sensors: the family compared.
Try it: Voltage divider calculator
Change the values and the diagram and results update as you type.
Common mistakes to avoid
- Expecting CO readings with the heater at a constant 5 V.
- Using it as a certified safety detector.
- Not burning in a new sensor.
- Comparing readings from different modules without calibrating each.
Frequently asked questions
What does the MQ-9 detect?
Carbon monoxide in its low-heat phase and methane, LPG and other combustible gases in its high-heat phase.
Do I need the heater cycle?
For CO readings, yes; for combustible gas trends a constant 5 V works.
Is the MQ-9 better than the MQ-7?
It covers more gases; the MQ-7 is more focused on CO.
Can it power from 3.3 V?
No, the heater needs 5 V.
How do I get ppm?
From the datasheet curves using Rs/R0; treat results as estimates.
Parts for this guide
Calculators
Projects that use it
Put this into practice: 9 step-by-step builds in our project library use parts from this guide.
Keep learning
Sources
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.

