Zum Inhalt springen

9531 – MQ-5 Gas Sensor/en

Aus JW Tech Wiki

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-5 uses tin dioxide (SnO2) as the sensitive material. Conductivity rises with the concentration of flammable gases such as butane, propane and methane. The module provides an analog output (AOUT) and a digital threshold output (DOUT).

Related products at JW Tech

Technical overview

  • Operating voltage: 2.5 V to 5.0 V.
  • Module size: 40.0 mm × 21.0 mm; mounting hole diameter 2.0 mm.
  • Pins: VCC, GND, AOUT (analog), DOUT (digital).
  • Raspberry Pi Pico wiring: VCC → 3.3 V, GND → GND, AOUT → GP26, DOUT → GP22.
  • STM32F103RBT6 wiring: VCC → 3.3 V, GND → GND, AOUT → PA6, DOUT → PA4.
  • Arduino UNO wiring: VCC → 5 V, GND → GND, AOUT → A0, DOUT → D2.
  • Example projects are provided for Pico (C/C++ and MicroPython), STM32 (HAL library, Keil) and Arduino IDE.
  • The module needs about one minute of preheat time so the sensitive material reaches operating temperature.

Commands and examples – verify before use: 

sudo apt-get install p7zip-full
cd ~
sudo wget https://files.waveshare.com/upload/6/63/MQ-5-Gas-Sensor-code.7z
7z x MQ-5-Gas-Sensor-code.7z -o./MQ-5-Gas-Sensor-code
cd ~/MQ-5-Gas-Sensor-code/Pico/c/
cmake ..
make -j9
cp main.uf2 /media/pi/RPI-RP2/

Notes and version constraints

  • The provided examples are based on fixed boards (Pico, STM32F103RB, Arduino UNO). For other boards, connections and code may need adaptation.
  • For the Pico, suitable firmware must be flashed first; the exact firmware version depends on the example archive.
  • The exact threshold setting of the digital output is not described in the source; please verify against the datasheet.
  • No calibration, accuracy or certification data are given in the source; do not state values that are not present.

Source and revision record

  • MQ-5 Gas Sensor - Waveshare Wiki
  • Source revision: 68897
  • Captured: 2026-08-29T09:42:28+00:00
  • SHA-256: 386a9d43b360c7be35d137f839960a2f98c4405552bb9629a004c07a869c9822