What it is: The MQ-7 detects carbon monoxide (CO), the invisible, odourless gas from incomplete combustion. Useful for garage, boiler and stove safety projects.
How it works: The MQ-7 is designed to be cycled between a high (5V) and low (1.4V) heater voltage for best accuracy, but for a simple relative indicator you can run it at 5V and read AO as an analog level. This sketch shows a relative 0–100 CO level plus raw ADC.
Wiring:
MQ-7 AO -> GPIO0
MQ-7 VCC -> 5V
MQ-7 GND -> GND
OLED VCC=3V3, GND=GND, SDA=GPIO4, SCL=GPIO5
VOLTAGE WARNING: divide AO down to under 3.3V for the ESP32-C3 ADC.
Libraries: only "Adafruit SSD1306" and "Adafruit GFX Library".
On screen / Serial: relative CO level (0–100) and raw ADC.
Gotchas: For accurate CO ppm you must implement the high/low heater cycle and calibrate — beyond this intro. Do not rely on a hobby MQ-7 as a life-safety CO alarm; buy a certified detector for that.