MQ gas sensors: MQ-3 to MQ-137
Ten more MQ gas sensors on the MQ-2's comparator board, from alcohol and carbon monoxide to ozone and ammonia, each read off its own datasheet chart.
The rest of the MQ family on the same four-pin comparator board as the MQ-2: the MQ-3 (alcohol), MQ-4 (methane), MQ-5 (LPG and natural gas), MQ-6 (LPG), MQ-7 (carbon monoxide), MQ-8 (hydrogen), MQ-9 (CO and flammable gas), MQ-131 (ozone), MQ-135 (air quality) and MQ-137 (ammonia). Aliases: alcohol sensor, breathalyzer, CO sensor, air quality sensor, ammonia sensor.
Every one is the same thing inside: a heated metal-oxide element whose resistance follows the gas, over a load resistor to ground, with an LM393 comparing the result with a trimmer. What differs is the chart on each datasheet, and that is what each part here is.
Pins
| Pin | What it does |
|---|---|
VCC |
Supply, 5 V. The heaters are specified at 5.0 V and draw about 150 mA. |
GND |
Ground. |
DO |
Low when the gas is past the trimmer (the MQ-131: when the ozone is). Open collector with a 10 k pull-up. |
AO |
The sensor over the load resistor. Higher means more gas, except on the MQ-131. |
The charts
Each datasheet plots Rs / R0 against the gas on log-log paper: a straight line per
gas, R0 defined at one point of one line, and a flat line for clean air. The lines
here are the fits the MQUnifiedsensor library ships for each sensor
(ppm = a x (Rs/R0)^b), checked against the Hanwei charts, so a sketch that calibrates
with the library reads back what the slider says.
| Part | R0 is Rs in | Clean air | Gases (default first) | Slider |
|---|---|---|---|---|
mq3 |
0.4 mg/L alcohol | 60 | alcohol, benzine | 0 to 10 mg/L |
mq4 |
1000 ppm methane | 4.4 | methane, LPG | 0 to 10 000 ppm |
mq5 |
1000 ppm hydrogen | 6.5 | LPG, methane, hydrogen | 0 to 10 000 ppm |
mq6 |
1000 ppm LPG | 10 | LPG, methane, hydrogen | 0 to 10 000 ppm |
mq7 |
100 ppm CO | 27.5 | CO, hydrogen | 0 to 4000 ppm |
mq8 |
1000 ppm hydrogen | 70 | hydrogen, alcohol | 0 to 10 000 ppm |
mq9 |
1000 ppm LPG | 9.6 | CO, LPG, methane | 0 to 10 000 ppm |
mq131 |
clean air | 1 | ozone | 0 to 1000 ppb |
mq135 |
100 ppm NH3 | 3.6 | CO2, NH3, alcohol, toluene, acetone, CO | 0 to 1000 ppm |
mq137 |
clean air | 1 | ammonia | 0 to 500 ppm |
The MQ-3's chart is in milligrams per liter, not ppm, and so is its slider. The MQ-131
is Winsen's low-concentration sensor, read in parts per billion. Ozone is an oxidizing
gas: it raises the resistance, so on the MQ-131 AO falls as the ozone rises and
DO trips on a low AO. Its line, and the MQ-137's, are least-squares fits to
readings of Winsen's charts (the library has neither), within 13% and 3% of every
reading.
Properties
gas picks which gas is in the room, from that sensor's chart. r0 is R0 in ohms:
the bottom of the sheet's spread where it gives one (1 MOhm on the MQ-3, 10 k on the
MQ-4 to MQ-9, 30 k on the MQ-135). The sheets give none for the MQ-131 and MQ-137;
1 MOhm and 47 k are assumptions that put clean air in the useful part of the ADC.
rl is the load resistor: 1 k, the blue board's "102", except the MQ-3 (200 k, its
sheet's), the MQ-131 (1 MOhm) and the MQ-137 (4.7 k), which are the loads Winsen
tested them on. threshold is the trimmer as a fraction of the supply, and warmup
the heater's settling time, 20 seconds. Measure R0 in clean air, as the library's
examples do: every real sensor is different.
While it runs
Drag the slider to let gas into the room. As on the MQ-2, the slider is squared, the can glows while the heater warms up, and the reading starts high and sinks.
What it does not model
The MQ-7's and MQ-9's heater cycle. Their sheets run the heater at 5 V for 60 s, then 1.4 V (MQ-7) or 1.5 V (MQ-9) for 90 s, and read CO at the end of the low phase; the CO line is that phase's. The blue boards have no circuit for the cycle and hold the heater at 5 V, where the real element does not follow its CO line at all. This model reads the CO line all the time, and the part's description says so. The cycle is not simulated yet.
CO2 on the MQ-135. The chart's CO2 line runs from 10 to 200 ppm, but the air
already holds about 420 ppm, which the sensor reads as part of clean air. The slider is
CO2 above that, which is how the library's CO2 example takes it (it adds 400). The
MQ-135 cannot tell CO2 from ammonia, alcohol or a breath; one gas at a time is
modeled, the one in gas.
Everything the MQ-2 page lists: the 24 to 48 hour burn-in the sheets ask for, the heater's current, humidity and temperature, mixtures of gases.
Common mistakes
Reading the MQ-135 as a CO2 meter. It is an air quality sensor: anything that burns or smells moves it. For CO2 itself, an SCD4x measures it optically.
Reading the MQ-3 in ppm. Its sheet, and so its slider, are in mg/L. One mg/L of ethanol vapor is about 530 ppm.
Trusting the MQ-7 on a blue board. Without the heater cycle its CO reading is not the datasheet's.
See it in action
Alcohol sensor on A0 (the Keyestudio kit's project 23) reads an MQ-3 on A0. Open it
at /templates.
The Breathalyzer with an MQ-3 calibrates R0 in clean air against the Uno's 1.1 V reference and shows milligrams per liter with MQUnifiedsensor.