MQ Sensors EN: 두 판 사이의 차이
(새 문서: {{#seo:|title=Arduino Wiki: Arduino MQ Gas Sensor Guide|title_mode=append|keywords=Arduino, Computer Science, Maker Education, Performance Assessment, MQ Gas Sensor, Arduino Projects, Capstone Project, Arduino Example Code|description=Learn how to use the MQ gas sensor with Arduino (basic info, circuit, example code). Useful for CS and maker classes.}}center|class=coders100 == '''Overview''' == The MQ sensor is a low-cost electronic sensor that...) |
잔글 (→2. Using a Library) |
||
| 142번째 줄: | 142번째 줄: | ||
Uses the MQUnifiedsensor library by Miguel Califa. | Uses the MQUnifiedsensor library by Miguel Califa. | ||
See the [[Arduino | See the [[Arduino Libraries|Library Usage Guide]] for installation and usage instructions. | ||
[[File:Mq6 예제 라이브러리.png|center|class=coders100]] | [[File:Mq6 예제 라이브러리.png|center|class=coders100]] | ||
2025년 3월 27일 (목) 19:05 기준 최신판

Overview
The MQ sensor is a low-cost electronic sensor that can detect various gas concentrations. Each sensor is designed to detect specific gases and can be easily used with microcontrollers like Arduino. It is widely used in air quality monitoring, gas leak detection, industrial safety, and other applications.
Main Models
The MQ series includes a variety of models, each detecting different gases.
Most sensors require a preheating time of around 24 hours. Considering measurement range and accuracy, they are better used for gas presence detection than precise safety applications.
Sensitivity can be adjusted via a variable resistor on the back.
| Sensor Type | Detected Gas | Preheat Time | Detection Range | Operating Voltage | Output Type |
|---|---|---|---|---|---|
| MQ-2 | LPG, Propane, Hydrogen, Methane, Alcohol, Smoke | 24 hours | 300–10000 ppm | 5V | Analog |
| MQ-3 | Alcohol, Benzene, CH4, Hexane, CO | 24 hours | 25–500 ppm (Alcohol) | 5V | Analog |
| MQ-4 | Methane, CNG | 24 hours | 200–10000 ppm | 5V | Analog |
| MQ-5 | LPG, Natural Gas, Town Gas | 24 hours | 200–10000 ppm | 5V | Analog |
| MQ-6 | LPG, Butane, Isobutane, Propane | 24 hours | 200–10000 ppm | 5V | Analog |
| MQ-7 | Carbon Monoxide | 24 hours | 20–2000 ppm | 5V | Analog |
| MQ-8 | Hydrogen | 24 hours | 100–10000 ppm | 5V | Analog |
| MQ-9 | Carbon Monoxide, Methane, LPG | 24 hours | 10–10000 ppm (CO), 100–10000 ppm (flammable gas) | 5V | Analog |
| MQ-135 | Ammonia, Benzene, Alcohol, Smoke | 24 hours | 10–1000 ppm (NH3, Alcohol, Benzene) | 5V | Analog |
Working Principle
MQ sensors contain a heater and a gas-sensitive component. When gas contacts the sensor, the resistance of the material changes, allowing gas concentration to be measured. The sensor element is usually made of SnO₂ (tin dioxide), whose resistance varies with the surrounding gas.
Electrical Characteristics
- Power supply: 5V (some models 3.3V)
- Output: Analog voltage (some models also support digital output)
- Heater current: ~150mA
- Response time: 1–2 minutes (for sensor stabilization)
Example Application
Example Hardware
- Arduino board
- Jumper wires
- MQ-6 module
Wiring
Digital pins are not used in this example but are included as a reference.
| Arduino Uno | MQ-6 |
| 5V | VCC |
| GND | GND |
| A0 | AO |
| D7 | DO |

Example Code
1. Basic Value Reading
int sensorPin = A0;
int sensorValue = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
sensorValue = analogRead(sensorPin);
Serial.println(sensorValue);
delay(1000);
}
You can observe increasing values when gas is introduced.
2. Using a Library
Uses the MQUnifiedsensor library by Miguel Califa.
See the Library Usage Guide for installation and usage instructions.

Library Example Output
When gas is detected, the LED on the back of the sensor lights up.

The rightmost PPM value increases when exposed to lighter gas.
Application Fields
- Gas Leak Detection: Detect leaks in kitchens, factories, etc.
- Air Quality Monitoring: Monitor harmful gases in indoor environments.
- Alcohol Detection: Measure alcohol concentration for breathalyzers.
- Industrial Safety: Protect workers by detecting harmful gases in workplaces.