9529 – MQ-2 Gas Sensor/en
Erscheinungsbild
Documentation notice: This technical documentation was independently rewritten from an archived supplier source. Check technical details and commands against the product version and manufacturer documentation before use.
Summary
The MQ-2 gas sensor uses tin dioxide (SnO2) as the sensitive material. Conductivity rises with the concentration of flammable gases such as LPG, propane and hydrogen. The module provides analog and digital outputs and is connected to a Raspberry Pi Pico, STM32 or Arduino UNO.
Related products at JW Tech
Technical overview
- Sensitive material: tin dioxide (SnO2); low conductivity in clean air
- High sensitivity to liquefied petroleum gas (LPG), propane and hydrogen; also suitable for natural gas and other combustible vapors
- Analog output AOUT produces a voltage that increases with rising gas concentration
- Digital output DOUT provides a threshold signal
- Power supply 2.5 V to 5.0 V; boost chip PT1301
- Module dimensions 40.0 mm × 21.0 mm; mounting holes 2.0 mm
- Example code provided for Raspberry Pi Pico (C and MicroPython), STM32F103RBT6 / STM32H743 and Arduino UNO
- Pico connection: VCC to 3.3 V, GND to GND, AOUT to GP26, DOUT to GP22
- STM32 connection: VCC to 3.3 V, GND to GND, AOUT to PA6, DOUT to PA4
- Arduino connection: VCC to 5 V, GND to GND, AOUT to A0, DOUT to D2
Commands and examples – verify before use:
sudo apt-get install p7zip-full
cd ~
sudo wget https://files.waveshare.com/upload/f/f2/MQ-2-Gas-Sensor-code.7z
7z x MQ-2-Gas-Sensor-code.7z -o./MQ-2-Gas-Sensor-code
cd ~/MQ-2-Gas-Sensor-code/Pico/c/build/
export PICO_SDK_PATH=../../pico-sdk
cmake ..
make -j9
cp main.uf2 /media/pi/RPI-RP2/
sudo apt upgrade thonny
Notes and version constraints
- Before measuring, the sensor must preheat for about one minute so the sensitive material reaches operating temperature.
- The provided examples are based on specific boards (Pico, STM32F103RB, Arduino UNO). For other boards, connections and code may need to be adapted.
- Heating of the sensor during operation is normal because the sensitivity material must be heated.
- For other STM32 boards, the code may need to be ported manually.
- Exact threshold values for the digital output are not specified in the source; they must be calibrated per application.
Source and revision record
- MQ-2 Gas Sensor - Waveshare Wiki
- Source revision: 68902
- Captured: 2026-08-29T09:40:01+00:00
- SHA-256:
da1348f553419a2f2d267d7396668e8c072769b464908b9727da1d14d745c2f4