Skip to content
Buy 10+ on select items — save 10% auto-applied
Free US shipping on orders $35+
Order by 3pm ET — ships same-day from the US
Skip to main content

Arduino Nano MQ-7 Sensor: CO Readings and Buzzer Alarm | ShillehTek

August 21, 2026 10 views

Arduino Nano MQ-7 Sensor: CO Readings and Buzzer Alarm | ShillehTek
Project

Build an Arduino Nano MQ-7 carbon monoxide monitor that streams analog CO readings and can trigger a buzzer alarm for safer trend tracking with ShillehTek.

45 min Beginner6 parts

Project Overview

Arduino Nano + MQ-7 CO Sensor: Read carbon monoxide levels on an analog pin, visualize spikes in the Serial Plotter, then turn the readings into a buzzer alarm when air quality gets worse.

  • Time: ~45 minutes
  • Skill level: Beginner
  • What you will build: A three-wire CO monitor on an Arduino Nano, plus an optional temperature + buzzer alarm upgrade.
MQ-7 carbon monoxide (CO) sensor element used for Arduino gas sensing
The MQ-7: a heated tin-oxide element whose resistance drops in the presence of CO.

Safety note: A DIY sensor is a great learning tool and trend monitor, but it is not a certified life-safety device. Keep a UL-listed CO alarm where people sleep.

Parts List

From ShillehTek

External

  • None - though a 10 kΩ resistor is worth knowing about if you ever use a bare MQ-7 without a carrier board

Note: The original build soldered a bare MQ-7 onto a Pololu carrier with a 10 kΩ load resistor. The ShillehTek module has the carrier circuitry (load resistor, indicator LEDs, and both analog and digital outputs) already on board, so you skip the soldering entirely.

Step-by-Step Guide

Step 1 - Prepare the Sensor

Goal: Get the MQ-7 electrically ready.

What to do: On a bare sensor, you would solder it to a carrier PCB with a 10 kΩ load resistor. Orientation does not matter because the pinout is symmetric with no polarity. With the ready-made module, inspect the pins: VCC, GND, A0 (analog out), and D0 (digital threshold out).

Bare MQ-7 sensor soldered onto a carrier PCB with a load resistor
The original approach: bare MQ-7 soldered to a carrier with its 10 kΩ load resistor.

Expected result: A sensor with clean 3-wire access: power, ground, analog signal.

Step 2 - Wire It (3 Wires)

Goal: Connect the sensor output to the Arduino ADC.

What to do: VCC to 5V, GND to GND, A0 to A0. That is the whole circuit. The heater inside the sensor draws real current, so power from USB or a solid 5V rail.

Arduino Nano wired to an MQ-7 module on a breadboard using 5V, GND, and A0
5V, GND, A0 - the simplest gas-sensing circuit.

Expected result: Sensor powered and warming up (this is normal and necessary).

Step 3 - Read It with AnalogReadSerial

Goal: Stream raw CO readings over Serial.

What to do: The stock Arduino example is enough to start:

// AnalogReadSerial - reads A0 and prints to Serial
// (File  Examples  01.Basics  AnalogReadSerial)

void setup() {
  Serial.begin(9600);
}

void loop() {
  int sensorValue = analogRead(A0);
  Serial.println(sensorValue);
  delay(100);
}

Open the Serial Monitor and let the sensor warm up for a few minutes. Values settle as the heater reaches temperature.

Arduino IDE Serial Monitor showing stable MQ-7 analog readings
Stable baseline readings in the Serial Monitor.

Expected result: A steady baseline number that reflects clean air.

Step 4 - The Breath Test (Serial Plotter)

Goal: See the sensor respond in real time.

What to do: Switch to Tools to Serial Plotter and breathe gently on the sensor. Exhaled air contains trace CO and changes the element resistance. The plot jumps immediately, then decays back to baseline.

Arduino IDE Serial Plotter showing an MQ-7 reading spike after breathing on the sensor
The breath test: an instant, visible spike in the Serial Plotter.

Expected result: Confirmed sensitivity as the sensor reacts to changes in the air within about a second.

Step 5 - Practical Example: CO + Temperature Alarm

Goal: Turn readings into an actual warning device.

What to do: Pair the MQ-7 with a Dallas DS18B20 temperature sensor and a buzzer. When the CO reading crosses a threshold, the buzzer sounds. Set the threshold based on your clean-air baseline plus margin.

#include <OneWire.h>
#include <DallasTemperature.h>

#define CO_PIN     A0
#define BUZZER_PIN 8
#define ONE_WIRE   2
#define CO_LIMIT   400   // pick from YOUR clean-air baseline + margin

OneWire oneWire(ONE_WIRE);
DallasTemperature tempSensor(&oneWire);

void setup() {
  Serial.begin(9600);
  pinMode(BUZZER_PIN, OUTPUT);
  tempSensor.begin();
}

void loop() {
  int co = analogRead(CO_PIN);
  tempSensor.requestTemperatures();
  float tempC = tempSensor.getTempCByIndex(0);

  Serial.print("CO: ");   Serial.print(co);
  Serial.print("  T: ");  Serial.println(tempC);

  if (co > CO_LIMIT) {
    tone(BUZZER_PIN, 1000);   // alarm!
  } else {
    noTone(BUZZER_PIN);
  }
  delay(250);
}
Arduino Nano MQ-7 CO sensor with DS18B20 temperature probe and buzzer on a breadboard
The practical build: MQ-7 + DS18B20 + buzzer watching over the heater.

Expected result: A room monitor that sounds when CO rises above your chosen threshold.

Step 6 - Understand the Limits

Goal: Use the readings honestly.

What to do: Raw ADC values are relative, not calibrated ppm. For trends and threshold alarms they work well. For datasheet-accurate CO concentration, the MQ-7 typically uses a cycled heater voltage (5 V / 1.4 V phases) and calibration in known air. Set your alarm threshold from your own clean-air baseline plus a healthy margin.

Expected result: A useful monitor and realistic expectations about what the MQ-7 readings mean.

Conclusion

With an Arduino Nano and an MQ-7 module, you can read live CO values using a simple analog input sketch, then build up to a buzzer alarm by comparing readings against your baseline threshold. Adding a DS18B20 temperature probe is an easy upgrade for richer room monitoring.

Want the exact parts used in this build? Grab them from ShillehTek.com. If you want help customizing this project or building something for your product, check out our IoT consulting services.

Credits

All photos and images in this tutorial are credited to Ingo Lohs on Hackster.io. The original guide by Ingo Lohs served as the reference for this ShillehTek version. We thank him for his excellent work in the maker community.