Advances in gas detection have revolutionized home and industrial electronics, providing affordable and simple devices for monitoring the environment and protecting health and safety. In this field, MQ series chemoresistive sensors They have become a must-have reference for both electronics enthusiasts and professionals interested in air quality control, risk prevention, or the design of new IoT applications.
If you have come this far you are probably curious to know exactly What is a chemoresistive sensor?, how specific models such as the MQ-135, MQ-9 or MQ-3, and what practical differences exist between them. Brace yourself because this article goes far beyond a simple definition: here you'll find a detailed explanation, real-life examples, connection instructions and calibration details, as well as all the keys to understanding and integrating these devices into your own projects.
What is a chemoresistive sensor?
Un A chemoresistive sensor is a device capable of detecting and measuring the concentration of certain gases or chemical compounds in the air. By changing its internal electrical resistance. When the sensor is exposed to a specific substance—such as carbon monoxide, ammonia, alcohol, or benzene, among others—the electrical resistance of a sensitive material (usually tin oxide, SnO₂, doped with other compounds) changes proportionally to the concentration of that gas.
These sensors, widely adopted for their low cost, reliability, and ease of integration, are used in environmental quality control, home automation, leak alarms, poison control, and hundreds of other applications.
How a chemoresistive sensor works

The basic principle of chemoresistive sensors, common to the MQ family, is based on three main elements:
- Sensitive material: A layer of material, usually tin oxide, is deposited on a ceramic surface. This material reacts chemically with the surrounding gases, measurably altering its conductivity.
- Internal heater: A small filament acts as a heater, keeping the sensor's temperature at the optimal temperature for fast and accurate chemical reactions.
- Voltage divider circuit: The sensor works as a variable resistor, forming a voltage divider together with a resistor (RL), which allows the variations to be read by a microcontroller, analog-digital converter or simply through a threshold comparator.
The process is as follows: by applying voltage, the heater heats the sensitive pellet. When the target gas is present, the internal resistance (Rs) varies. By measuring the output voltage, the concentration of the gas present can be inferred. Unlike purely digital sensors, the MQ family typically provides both a analog output proportional to the detected levelAs a digital alarm output which is activated when a threshold adjustable with a potentiometer is exceeded.
MQ Family: Sensor Types and Their Applications
The MQ sensor range is extensive, and each model specializes in detecting one or more substances. This makes them extremely versatile, but it also requires a thorough understanding of each sensor's sensitivity to select the right one for each need.
The following table lists the most common models and the gases for which they are optimized, as well as the recommended voltage for the heater:
| Córdoba | Gases Detected | Heater Feeding |
|---|---|---|
| MQ-2 | Methane, Butane, LPG, Smoke | 5V |
| MQ-3 | Alcohol, Ethanol, Smoke | 5V |
| MQ-4 | Methane, Natural Gas | 5V |
| MQ-5 | Natural gas, LPG | 5V |
| MQ-6 | Butane, LPG | 5V |
| MQ-7 | Carbon monoxide | Alternates 5V / 1.4V |
| MQ-8 | Hydrogen | 5V |
| MQ-9 | Carbon monoxide, Flammable gases | Alternates 5V / 1.5V |
| MQ-131 | Ozone | 6V |
| MQ-135 | Benzene, Alcohol, Smoke, Air Quality | 5V |
Among these, the MQ-3, MQ-9 and MQ-135 are especially popular for specific applications:
- MQ-3: Detection of alcohol, ethanol, and to a lesser extent, smoke and benzene. Common in breathalyzers and access control systems.
- MQ-9: For detecting carbon monoxide (CO) and flammable gases such as LPG, ideal for leak alarms in kitchens and workshops.
- MQ-135: It analyzes air quality, detecting ammonia (NH₃), nitrogen oxides (NOx), benzene, CO₂, smoke and alcohol vapor, making it highly versatile in urban and laboratory environments.
Common features of MQ sensors
Beyond the differences between models, most MQ sensors have a few similar technical and usage characteristics:
- Multi-gas sensitivity: Although each sensor is optimized for specific gases, most react to more than one compound, with varying intensity.
- Double output: They include analog output (value proportional to the concentration) and digital output (activated when a threshold adjustable by potentiometer is exceeded).
- They require warming up: The internal heater must reach temperature for accurate measurements. An initial burn-in of minutes to hours is recommended, followed by a few minutes of preheating each time after stabilization.
- Appreciable consumption: The heater can consume up to 800 mW, so a suitable power supply is recommended if multiple sensors are used.
- Stability and shelf life: Thanks to their robust construction and electrochemical design, they offer long life when used as directed, especially in terms of temperature and humidity.
- Adjustable sensitivity: Using the integrated potentiometer, allowing the digital alarm threshold to be modified.
Practical operation: from sensor to measurement
Using MQ sensors is simple but requires some care to obtain reliable data. The basic connection includes:
- The sensor receives 5V (varies on some models).
- The GND pin connects to system ground.
- The analog output (A0/AOUT) is linked to an analog input of the microcontroller or to an external ADC if required.
- The digital output (D0/DOUT) connects to a digital input for alarms or events.
Signal processing varies depending on the output type:
- Digital reading: It works like a switch, activating when the concentration exceeds the set threshold. Ideal for simple alarms.
- Analog reading: Allows monitoring of gas levels on a continuous scale, useful for proportional actions or visualization.
Important! Although MQ sensors are accurate in detecting presence, their use as quantitative meters requires specific calibration in each environment and with each sensor, consulting the manufacturer's datasheets.
Calibration, sensitivity curve and concentration calculation in PPM
One of the main challenges is to transform reading into reliable concentration, usually in PPMEach sensor has a specific sensitivity curve, documented in its data sheet, which relates the sensor's resistance at different concentrations.
- A: Sensor resistance in the gas sample.
- Tranquility: Clean air resistance or reference after initial burn-in.
The Rs/Ro ratio allows you to estimate the concentration in ppm using the datasheet curve. The basic calibration steps are:
- Operate in clean air during initial stabilization (where Ro is obtained).
- Measure the voltage under these conditions and calculate Ro with: Ro = (RL x (Vcc – Vout)) / Vout.
- Measure in the presence of the gas and calculate Rs with the same formula, using the corresponding Vout.
- Calculate Rs/Ro and look it up on the curve to determine the estimated concentration.
This process can be automated in microcontrollers, allowing continuous monitoring and periodic calibration to maintain accuracy.
Detailed example of calibration and use with the MQ-3 (Alcohol) sensor
El sensor MQ-3 It is widely used to detect alcohol in the air, in breathalyzers, or in access controls. Its operation is similar to other MQs, tuned for ethanol and alcohol in general.
To build a system with Arduino, it is recommended:
- Connect following the usual scheme (VCC, GND, AOUT to analog input, DOUT to digital).
- Do the initial “burn-in” for 24 to 48 hours to stabilize.
- Calculate Ro in clean air with the previous formula, using RL = 1kΩ (typical).
- Measure Rs in each sample, calculate Rs/Ro and convert to concentration using the curve in the datasheet.
The Arduino algorithm can implement measurement, calculation, and display functions to facilitate control and data acquisition in environmental monitoring or breathalyzer projects.
Practical advantages and limitations of MQ sensors
Advantages:
- Low cost and availability: They are inexpensive and easy to obtain, allowing their use in multiple sensors.
- Versatility: Specialized models for many gases, opening up many possibilities in different fields.
- Ease of integration: With standard modules and compatible libraries, incorporating them into systems is easy.
- Double outputs: Digital for alarms and analog for continuous monitoring.
- Extensive documentation and community: Facilitates learning, problem solving and development.
Limitations and precautions:
- Limited precision: They are not a substitute for professional equipment when absolute accuracy is required.
- Cross-sensitivity: They detect multiple gases, and can falsify results in environments with varied compositions.
- Non-instant response: Thermal and chemical inertia means that the reaction is relatively slow and recovery can be prolonged.
- periodic calibration: It is essential to maintain reliability and accuracy.
- Energy consumption: The heater can consume up to 800 mW, which requires consideration in systems with multiple sensors.
- Environmental conditions: Temperature and humidity affect accuracy, so use should be in accordance with the manufacturer's specifications.
Integration and code examples for Arduino and microcontrollers
Integrating MQ sensors into platforms like Arduino is very simple, with examples and libraries available. Below are some basic examples:
Digital readout
const int MQ_PIN = 2; // Pin conectado a DOUT del sensor
const int MQ_DELAY = 2000;
void setup() {
Serial.begin(9600);
}
void loop() {
bool estado = digitalRead(MQ_PIN);
if (!estado) {
Serial.println("Detección de gas");
} else {
Serial.println("No detectado");
}
delay(MQ_DELAY);
}
Analog reading
const int MQ_PIN = A0; // Pin conectado a AOUT del sensor
const int MQ_DELAY = 2000;
void setup() {
Serial.begin(9600);
}
void loop() {
int valor_adc = analogRead(MQ_PIN);
float voltaje = valor_adc * (5.0 / 1023.0);
Serial.print("Valor ADC:");
Serial.print(valor_adc);
Serial.print(" V:");
Serial.println(voltaje);
delay(MQ_DELAY);
}
Concentration calculation (PPM)
const int MQ_PIN = A0;
const int RL = 1; // kΩ, resistencia del circuito
float Ro = 10.0; // Valor calibrado en aire limpio
void setup() {
Serial.begin(9600);
}
void loop() {
int adc_value = analogRead(MQ_PIN);
float voltaje = adc_value * (5.0 / 1023.0);
float Rs = RL * (5.0 - voltaje) / voltaje;
float ratio = Rs / Ro;
// Consultar curva del fabricante para convertir ratio en PPM
Serial.print("Voltaje:");
Serial.print(voltaje);
Serial.print(" Rs:");
Serial.print(Rs);
Serial.print(" Ratio Rs/Ro:");
Serial.println(ratio);
delay(1000);
}
To obtain concentration in PPM, compare the ratio with the logarithmic curve specific to the sensor and interpolate according to the datasheet.
Advanced calculations and sensor management classes
For systems with multiple MQ sensors, it's advisable to encapsulate the logic in specific classes or functions, managing parameters such as RO, curves, timing, thresholds, and burn-in cycle management. This facilitates system maintenance, calibration, and reliability, while also enabling additional features such as alarm monitoring, IoT integration, and data visualization.