MQ-7 carbon monoxide (CO) sensor module
MQ-7 CO sensor module pinout, the 5 V / 1.4 V heater cycle the cheap module skips, keeping AO safe on 3.3 V boards, and why it is not a CO alarm.
Community draft — report a mistake
3.3 V or 5 V? The heater needs 5 V. AO can reach about 5 V, so on ESP32 and Pico feed AO through a 10 kΩ / 20 kΩ divider to stay under 3.3 V. DO swings to VCC too — divide it on 3.3 V boards.
The MQ-7 is a tin-dioxide sensor tuned for carbon monoxide (about 20–2000 ppm). CO is the silent danger from generators, charcoal sigris and gas geysers in closed bathrooms, which makes this a popular student project.
The heater cycle matters. The datasheet runs the heater at 5 V for 60 s (burning off absorbed gas) and then 1.4 V for 90 s, reading CO at the end of the low phase. The common module wires the heater straight to 5 V, so out of the box it behaves like a general gas sensor. For a meaningful CO reading, switch the heater with a MOSFET (PWM gives the low phase) and time the read in code.
Not a certified CO alarm. CO can kill while you sleep. Use a DIY MQ-7 only as an extra indicator next to a certified CO detector, never as the only protection near a generator, geyser or stove.
Prices are indicative (Nov 2026) and vary by seller.
Pinout
| Pin | What it does |
|---|---|
VCC | 5 V supply — the heater draws about 150 mA |
GND | Ground |
DO | Comparator output: changes state when the reading crosses the pot setting |
AO | Analog output rising with gas concentration (0–~5 V) |
Use it with
Common errors
Reading barely changes near a CO source
The module keeps the heater at a constant 5 V, but the MQ-7 is designed to sense CO during a low-heat phase (1.4 V for 90 s after 5 V for 60 s). Without that cycle it mostly responds to other gases. Switch the heater with a logic-level MOSFET and follow the datasheet cycle.
Value drifts for hours after installing a new sensor
Burn it in for 48 hours powered on, then record a clean-air baseline and compare against that.
ESP32 ADC stuck at 4095
AO is above 3.3 V. Add the divider and use an ADC1 pin.