📋 Overview
The MQ-7 gas sensor detector module is a simple-to-use carbon monoxide (CO) sensor designed to detect CO concentrations in the air from 10 to 1,000 ppm. Carbon monoxide is an odorless, colorless, and potentially lethal gas produced by incomplete combustion — making reliable detection critically important in homes, garages, and industrial environments.
The module is built around the MQ-7 semiconductor gas sensor element mounted on a convenient breakout board with onboard signal conditioning. It provides both an analog output (AO) that varies with CO concentration and a digital TTL output (DO) that triggers when concentration exceeds an adjustable threshold set by the onboard potentiometer.
Unlike other MQ-series sensors, the MQ-7 uses a unique heating/measurement cycle that alternates between a high-voltage cleaning phase and a low-voltage measurement phase for the most accurate CO readings. The module will work on a constant 5V supply for basic detection, but following the proper heating cycle yields significantly better accuracy.
⭐ Key Features
- Carbon Monoxide Detection — Specifically designed for CO gas detection (10–1,000 ppm)
- Dual Signal Output — Analog (AO) and digital TTL (DO) outputs for flexible integration
- Adjustable Threshold — Onboard potentiometer to set the digital output trigger level
- Indicator LEDs — Power LED and digital output (DO) status LED for visual feedback
- Heating/Measurement Cycle — Alternating 5V cleaning and 1.5V measurement phases for high-accuracy readings
- Fast Response & Recovery — Quick detection and return to baseline for reliable monitoring
- Simple Interface — Only 4 pins (VCC, GND, AO, DO) — no library required
- 5V Compatible — Works directly with Arduino, ESP8266, and other 5V development boards
📊 Specifications
| Parameter | Value |
|---|---|
| Operating Voltage | 5V DC (cleaning/reading); 1.5V (heating/measurement phase) |
| Maximum Power Consumption | 800 mW (160 mA at 5V) |
| Detectable Gas | Carbon monoxide (CO) |
| Detectable Concentration | 10–1,000 ppm |
| Analog Output (AO) | 0V to ~5V (proportional to CO concentration) |
| Digital Output (DO) | TTL level — LOW normally, HIGH when CO detected |
| Threshold Adjustment | Onboard potentiometer |
| Preheat / Burn-In Time | 48 hours (initial, at 1.5V); ~2–5 minutes for subsequent power-ons at 5V |
| Indicator LEDs | Power LED, DO (Digital Output) LED |
| Dimensions | Approx. 32 × 20 × 27 mm (1.25 x 0.8 x 1.1 inches) L × W × H |
| Weight | ~7 grams |
📌 Pinout
The MQ-7 module has 4 pins arranged in a single header row:
| Pin | Label | Description |
|---|---|---|
| 1 | VCC | Power supply input — connect to +5V (or PWM-controlled ~1.5V for measurement phase) |
| 2 | GND | Ground — connect to GND |
| 3 | DO | Digital output — TTL HIGH when CO exceeds threshold |
| 4 | AO | Analog output — voltage proportional to CO concentration (0–5V) |
📝 Note: Pin order may vary slightly between manufacturers. Always verify the silkscreen labels printed on your specific module before wiring.
🏗️ Schematic / Circuit Diagram
The schematic below shows the onboard circuit of the MQ-7 carbon monoxide sensor detector module, including the sensor element, comparator (LM393), potentiometer for threshold adjustment, and indicator LEDs.

Key components on the module:
- MQ-7 Sensor Element — The cylindrical metal-mesh component that detects carbon monoxide gas
- LM393 Comparator — Compares the sensor signal against the potentiometer threshold to produce the digital output
- Potentiometer — Adjusts the CO concentration threshold for the digital (DO) output. Turn clockwise to increase sensitivity (trigger at lower concentrations), counter-clockwise to decrease
- Power LED — Illuminates when the module is powered
- DO LED — Illuminates when the digital output is triggered (CO detected above threshold)
🔌 Wiring to Arduino
The MQ-7 module connects to an Arduino Uno (or compatible board) with just 4 wires. No external components are needed for basic operation.
Wiring Table
| MQ-7 Module Pin | Arduino Pin |
|---|---|
| VCC | 5V (basic) or D5 via PWM (advanced — see heating cycle below) |
| GND | GND |
| AO | A0 (Analog Input) |
| DO | D2 (Digital Input) |
⚠️ Important: The MQ-7 sensor element draws up to 160 mA. When powering from an Arduino's 5V pin, make sure you are using USB power or an external supply that can provide sufficient current. If you experience unstable readings, use an external 5V power supply for the module's VCC pin (with a shared GND connection to the Arduino).
🔧 How It Works
The MQ-7 module uses a tin dioxide (SnO₂) semiconductor sensor element. Here's how it operates:
- Heating: The sensor contains a small heater coil that raises the SnO₂ element to its operating temperature. This is why the module draws relatively high current (~160 mA) and requires a warm-up period.
- CO Detection: When carbon monoxide molecules contact the heated SnO₂ surface, the sensor's electrical resistance decreases. Higher CO concentration means lower resistance.
- Analog Output (AO): The onboard voltage divider converts the resistance change into a voltage signal (0–5V). Higher CO concentration produces a higher voltage on the AO pin.
- Digital Output (DO): The LM393 comparator compares the analog signal against a reference voltage set by the potentiometer. When the CO concentration exceeds the threshold, the DO pin goes HIGH and the DO LED illuminates.
⏱️ MQ-7 Heating / Measurement Cycle
Unlike other MQ-series sensors that operate at a constant 5V, the MQ-7 is designed to alternate between two voltage phases for the most accurate CO readings. This is the key difference that sets the MQ-7 apart from the rest of the MQ family.
The Cycle
- Initial Burn-In (first use only): Pre-heat the MQ-7 sensor for 48 hours at 1.5V to condition the sensor element
- Cleaning Phase (60 seconds at 5V): Heat the sensor at full 5V to expel moisture and contaminants from the sensing element
- Measurement Phase (90 seconds at 1.5V): Lower the heater voltage to ~1.5V — this is when the sensor produces its most accurate CO readings
- Reading: Near the end of the 90-second measurement phase, briefly raise the voltage back to 5V and read the analog output — this captures the CO measurement without fully reheating the sensor
- Repeat: Return to step 2 and continue the cycle
Generating 1.5V with PWM
You don't need a separate 1.5V power supply. With an Arduino, you can generate a PWM signal with an effective voltage (True RMS) of approximately 1.5V by using analogWrite() with a calculated duty cycle:
- Target voltage: 1.5V
- Supply voltage: 5V
- Duty cycle: 1.5V ÷ 5V = 0.30 →
analogWrite(pin, 76)(76 out of 255 ≈ 30%)
📝 Note: On 5V alone (constant power), the module does work for basic CO detection, but it will provide more accurate and reliable data when following the heating/measurement cycle described above.
🚀 Step 1: Basic CO Reading (Constant 5V — Simple Mode)
This basic sketch reads the analog output from the MQ-7 sensor running on a constant 5V supply and prints the raw value (0–1023) to the Serial Monitor. This is the simplest way to get started — no PWM or timing logic required.
/*
* MQ-7 CO Sensor — Basic Analog Reading (Constant 5V)
* Envistia Mall - Product Support
*
* Reads the analog output of the MQ-7 sensor
* and prints the value to the Serial Monitor.
* Simple mode — constant 5V, no heating cycle.
*
* Connections:
* MQ-7 VCC -> Arduino 5V
* MQ-7 GND -> Arduino GND
* MQ-7 AO -> Arduino A0
* MQ-7 DO -> Arduino D2 (optional for this sketch)
*/
const int coSensorAnalog = A0; // Analog input pin
void setup() {
Serial.begin(9600);
Serial.println("MQ-7 CO Sensor - Basic Analog Reading");
Serial.println("Warming up sensor (allow 2-5 minutes)...");
Serial.println();
}
void loop() {
int sensorValue = analogRead(coSensorAnalog);
Serial.print("CO Level (raw): ");
Serial.print(sensorValue);
Serial.print(" | Voltage: ");
Serial.print(sensorValue * (5.0 / 1023.0), 2);
Serial.println(" V");
delay(1000); // Read once per second
}
How to Use:
- Wire the MQ-7 module to your Arduino as shown in the wiring table above (VCC to 5V)
- Upload the sketch to your Arduino
- Open the Serial Monitor at 9600 baud
- Allow the sensor 2–5 minutes to warm up — readings will stabilize as the heater reaches operating temperature
- Observe the baseline reading in clean air — the value should be relatively low and stable
🚀 Step 2: Digital Threshold CO Detection with Alarm
This sketch uses both the analog and digital outputs. The digital output (DO) triggers when CO concentration exceeds the threshold set by the onboard potentiometer. This example also demonstrates a simple serial alarm message.
/*
* MQ-7 CO Sensor — Digital Threshold Detection
* Envistia Mall - Product Support
*
* Reads both analog and digital outputs.
* Prints an alarm when CO exceeds the
* potentiometer-set threshold.
*
* Connections:
* MQ-7 VCC -> Arduino 5V
* MQ-7 GND -> Arduino GND
* MQ-7 AO -> Arduino A0
* MQ-7 DO -> Arduino D2
*/
const int coSensorAnalog = A0; // Analog input pin
const int coSensorDigital = 2; // Digital input pin
void setup() {
Serial.begin(9600);
pinMode(coSensorDigital, INPUT);
Serial.println("MQ-7 CO Sensor - Threshold Detection");
Serial.println("Warming up sensor (allow 2-5 minutes)...");
Serial.println();
}
void loop() {
int analogValue = analogRead(coSensorAnalog);
int digitalValue = digitalRead(coSensorDigital);
Serial.print("Analog: ");
Serial.print(analogValue);
Serial.print(" | Digital: ");
Serial.print(digitalValue);
if (digitalValue == HIGH) {
Serial.print(" | *** CO DETECTED! ***");
} else {
Serial.print(" | Normal");
}
Serial.println();
delay(500);
}
How to Use:
- Wire the MQ-7 module to your Arduino including both AO and DO connections
- Upload the sketch to your Arduino
- Open the Serial Monitor at 9600 baud
- Allow the sensor to warm up for 2–5 minutes
- Use a small screwdriver to adjust the onboard potentiometer — turn it to set the threshold where the DO LED just turns off in clean air
- When CO concentration exceeds your threshold, you'll see "CO DETECTED!" in the Serial Monitor and the DO LED will illuminate
🚀 Step 3 (Advanced): Accurate CO Reading with Heating Cycle
This advanced sketch implements the proper MQ-7 heating/measurement cycle using PWM to alternate between 5V (cleaning) and ~1.5V (measurement). This produces the most accurate CO readings.
⚠️ Important: For this sketch, connect the MQ-7 VCC pin to Arduino digital pin D5 (a PWM-capable pin) instead of the 5V rail. The Arduino will control the heater voltage via PWM. The MQ-7 sensor draws up to 160 mA — verify that your Arduino pin can source this current, or use a transistor/MOSFET to switch the power. For an Arduino Uno, pin D5 can typically handle this load when powered via USB or external supply.
/*
* MQ-7 CO Sensor — Heating/Measurement Cycle
* Envistia Mall - Product Support
*
* Implements the proper MQ-7 heating cycle:
* - 60 seconds at 5V (cleaning phase)
* - 90 seconds at ~1.5V via PWM (measurement phase)
* - Reads CO level at the end of measurement phase
*
* Connections:
* MQ-7 VCC -> Arduino D5 (PWM pin)
* MQ-7 GND -> Arduino GND
* MQ-7 AO -> Arduino A0
* MQ-7 DO -> Arduino D2 (optional)
*
* Note: For higher current demands, drive VCC
* through a MOSFET controlled by D5.
*/
const int heaterPin = 5; // PWM pin to control heater voltage
const int coSensorAnalog = A0; // Analog input pin
// Timing
const unsigned long cleanTime = 60000; // 60 seconds at 5V
const unsigned long measureTime = 90000; // 90 seconds at ~1.5V
// PWM values
const int pwmHigh = 255; // 5V (full duty cycle — cleaning)
const int pwmLow = 76; // ~1.5V (30% duty cycle — measurement)
void setup() {
Serial.begin(9600);
pinMode(heaterPin, OUTPUT);
Serial.println("MQ-7 CO Sensor - Heating Cycle Mode");
Serial.println("Starting cleaning phase (60s at 5V)...");
Serial.println();
}
void loop() {
// === CLEANING PHASE: 60 seconds at 5V ===
Serial.println("--- Cleaning Phase (5V for 60s) ---");
analogWrite(heaterPin, pwmHigh);
for (int i = 60; i > 0; i--) {
Serial.print("Cleaning... ");
Serial.print(i);
Serial.println("s remaining");
delay(1000);
}
// === MEASUREMENT PHASE: 90 seconds at ~1.5V ===
Serial.println();
Serial.println("--- Measurement Phase (1.5V for 90s) ---");
analogWrite(heaterPin, pwmLow);
for (int i = 90; i > 0; i--) {
int sensorValue = analogRead(coSensorAnalog);
float voltage = sensorValue * (5.0 / 1023.0);
Serial.print("Measuring... ");
Serial.print(i);
Serial.print("s | CO (raw): ");
Serial.print(sensorValue);
Serial.print(" | Voltage: ");
Serial.print(voltage, 2);
Serial.println(" V");
delay(1000);
}
// === READ FINAL VALUE ===
// Briefly return to 5V to get an accurate ADC reading
analogWrite(heaterPin, pwmHigh);
delay(50); // Brief pulse — just enough to read
int finalReading = analogRead(coSensorAnalog);
float finalVoltage = finalReading * (5.0 / 1023.0);
Serial.println();
Serial.println("=============================");
Serial.print("CO Reading: ");
Serial.print(finalReading);
Serial.print(" | Voltage: ");
Serial.print(finalVoltage, 2);
Serial.println(" V");
Serial.println("=============================");
Serial.println();
// Cycle repeats
}
How to Use:
- Connect the MQ-7 VCC pin to Arduino D5 (not the 5V rail) — the other pins connect as normal
- Upload the sketch to your Arduino
- Open the Serial Monitor at 9600 baud
- The sketch will automatically cycle between cleaning (60s at 5V) and measurement (90s at ~1.5V) phases
- The most accurate CO reading is displayed at the end of each measurement phase
- For the initial burn-in of a brand-new sensor, run the measurement phase (1.5V) continuously for 48 hours before relying on readings
💡 Tips & Best Practices
- Initial Burn-In: The MQ-7 datasheet recommends a 48-hour initial burn-in at 1.5V the first time you use the sensor. This conditions the sensing element for accurate readings. After this initial period, subsequent warm-ups only take about 2–5 minutes.
- Simple vs. Accurate: Running the MQ-7 on constant 5V works for basic "is CO present?" detection. For quantitative or safety-critical readings, always use the heating/measurement cycle.
- Potentiometer Calibration: Adjust the potentiometer in clean air so the DO LED is just off. This sets your baseline. Then test with a known CO source to verify the trigger point.
- Ventilation: After CO exposure, allow the sensor to return to clean air. The readings will gradually return to baseline — this is normal recovery behavior.
- PWM Frequency: The default Arduino PWM frequency on pin D5 (~980 Hz) works well for generating the ~1.5V effective voltage. No special timer configuration is needed.
- High-Current Consideration: If you're concerned about drawing 160 mA through an Arduino I/O pin, use an N-channel MOSFET (such as an IRLZ44N or 2N7000) to switch the sensor's VCC, with the MOSFET gate driven by the Arduino PWM pin.
- Analog Readings: The raw analog value (0–1023) is not a direct PPM measurement. For approximate PPM conversion, you would need to calibrate against a known CO concentration and apply the sensitivity curves from the MQ-7 datasheet.
- Power Supply: If readings seem erratic, try powering the module from an external 5V supply rather than the Arduino's 5V pin. The sensor's heater draws significant current that can affect other components.
⚠️ Important Notes
- The sensor element gets hot during operation. Do not touch the metal mesh cylinder while the module is powered — it can cause burns.
- Carbon monoxide is a deadly gas. This module is intended for CO detection and indication only. It is not a certified safety device and should not be used as the sole protection against carbon monoxide poisoning in life-safety applications. Always use UL/CSA-listed CO detectors for life safety.
- Do not expose the sensor to high concentrations of CO for extended periods, as this can degrade the sensor element over time.
- The MQ-7 has some cross-sensitivity to other reducing gases (such as hydrogen). For applications requiring high specificity, consider using an electrochemical CO sensor.
- Keep the sensor away from direct airflow (fans, HVAC vents) that could dilute CO concentrations and cause missed detections.
- Do not test the sensor by exposing it to vehicle exhaust or other combustion sources in enclosed spaces — this creates a serious health hazard.
🎯 Typical Applications
- Carbon monoxide leak detection (furnace rooms, garages, kitchens)
- Industrial CO monitoring systems
- Arduino and microcontroller safety projects
- Portable CO sniffers and handheld detectors
- Smart home automation — trigger ventilation fans, alarms, or shut-off valves when CO is detected
- Air quality monitoring stations
- Combustion efficiency monitoring
- Educational and STEM projects demonstrating analog sensor interfacing and PWM control
🏪 Where to Buy the MQ-7 Carbon Monoxide CO Sensor Module
This module is available at envistiamall.com.
- 📦 Fast US Shipping
- 🔄 Hassle-Free Returns
- 📧 Responsive Customer Support
📚 Additional Resources
- MQ-7 Gas Sensor Datasheet — Detailed sensitivity curves, temperature characteristics, and electrical specifications
- LM393 Comparator Datasheet — For understanding the digital output circuit on the module
- Arduino analogRead() Reference — Arduino documentation for reading analog sensor values
- Arduino analogWrite() Reference — Arduino documentation for PWM output used in the heating cycle
-
VIDEO: How to use a MQ-7 carbon monoxide detector module by AReResearch on YouTube:
This guide is provided by Envistia Mall for educational and technical reference purposes. The manufacturer and Envistia LLC (dba Envistia Mall) are not responsible for any damages or losses resulting from the use of this product. Always follow proper electrical safety practices when working with electronic components. Specifications are based on manufacturer data and are subject to change without notice.