MQ-7 Gas Sensor - Waveshare Wiki
| ||
Contents
- 1 Overview
- 1.1 Features
- 1.2 Specification
- 1.3 Pinouts
- 2 Configure Pico
- 2.1 Hardware connection
- 2.2 Examples
- 2.2.1 Download the example
- 2.2.2 C
- 2.2.3 Python examples
- 2.3 Expected result
- 3 STM32
- 3.1 Hardware connection
- 3.2 Examples
- 3.3 Expected result
- 4 Arduino
- 4.1 Hardware connection
- 4.2 Examples
- 4.3 Expected result
- 5 Resources
- 6 FAQ
- 7 Support
The gas sensing material used in the MQ-7 gas sensor is tin dioxide (SnO2), which has low conductivity in clean air. When carbon monoxide gas exists in the environment where the sensor is located, the conductivity of the sensor increases with the increase of carbon monoxide gas concentration in the air.
Features
- Sensitive for carbon monoxide
- Output voltage boosts along with the concentration of the measured gases increases
- Fast response and recovery
- Adjustable sensitivity
- Signal output indicator
Specification
- Power: 2.5V ~ 5.0V
- Dimension: 40.0mm * 21.0mm
- Mounting holes size: 2.0mm
- Boost Chips: PT1301
Pinouts
| PIN | Description |
| DOUT | Digital data output |
| AOUT | Analog data output |
| GND | Ground |
| VCC | Power input (2.5V ~ 5.0V) |
MicroPython and C examples are provided for this sensor, to use it with Pico, you need to first flash firmware to the Pico according to the example. Please refer to the guides of Raspberry Pi about how to flash the firmware. We recommend you use the firmware from the Demo codes archive.
- C/C++ guide of Pico
- Micropython guide of Pico
Hardware connection
| MQ7 | Pico | Description |
|---|---|---|
| VCC | 3.3V | Power input |
| GND | GND | Ground |
| AOUT | GP26 | Analog data output |
| DOUT | GP22 | Digital data output |
Examples
Download the example
Open the terminal of Raspberry Pi and run the following command to download the example:
sudo apt-get install p7zip-full cd ~ sudo wget https://files.waveshare.com/upload/4/48/MQ-7-Gas-Sensor-code.7z 7z x MQ-7-Gas-Sensor-code.7z -o./MQ-7-Gas-Sensor-code cd ~/MQ-7-Gas-Sensor-code cd Pico/c/build/C
Here we use the Raspberry Pi board to flash the Pico.
- Compile the c examples:
- Go into the directory of C examples
- Generate Makefile by cmake command.
- Compile the codes by the command make.
- After compiling, a uf2 file is generated.
- Hold the button of the Pico board, and connect the Pico board to Raspberry Pi by USB cable.
- After connecting, release the button, and a portable disk (RPI_RP2) is recognized.
- Copy the main.uf2 file generated which locates in the build folder to the portable disk (RPI-RP2).
Python examples
In Windows PC- Hold the BOOTSET button of the PICO board, and connect the Pico board to Raspberry Pi by USB cable.
- After connecting, release the button, and a portable disk (RPI-RP2) is recognized.
- Copy the rp2-pico-20210418-v1.15.uf2 file to the portable disk (RPI-RP2).
- Open the Thonny IDE (Please install the newest version which supports the Pico board or update).
- Choose Tools -> Options -> Interpreter, and choose the Pico and the port.
- Download the demo codes, unzip and find the MicroPython example.
- Choose File -> Open -> MQ7 Gas Sensor.py and run it.
- Flash the uf2 file to the Pico board just like in the Windows PC.
- Open the Thonny IDE of Pi, make sure that it is the newest version, or update it.
- Choose Tools -> Options... -> Interpreter.
- Choose Pico and the Port
- If your Thonny IDE cannot support the Pico board, you can update it and try again.
- Choose File -> Open... -> python/MQ7 Gas Sensor.py and run it.
Expected result
- The sensor needs to preheat for about a minute to heat the internal sensitive materials of the sensor.
- Put the sensor inside the device containing sensitive gas, and the indicator on the module lights up. The indicator goes off when the sensor is removed from the device.
The examples provided are based on the STM32F103RBT6 and the STM32H743, the connection provided is based on the STM32F103RB. If you want to use other STM32 boards, please change the connection and you may need to port the codes yourself.
STM32Hardware connection
| MQ7 | STM32 | Description |
|---|---|---|
| VCC | 3.3V | Power input |
| GND | GND | Ground |
| AOUT | PA6 | Analog data output |
| DOUT | PA4 | Digital data output |
Examples
The examples are based on the HAL library. Please download the demo codes, unzip them, and find the STM32 examples.
- Open the project from MQ-7-Gas-Sensor-code\STM32\STM32F103RB\MDK-ARM by Keil.
- Build the project and program it to the STM32 board.
- Connect the UART1 of the STM32 board to the PC and check the serial data by SCCOM software.
Expected result
- The sensor needs to preheat for about a minute to heat the internal sensitive materials of the sensor.
- Put the sensor inside the device containing sensitive gas, and the indicator on the module lights up. The indicator goes off when the sensor is removed from the device.
The examples provided are based on the Arduino UNO, if you need to use other Arduino boards, please check if the board is compatible with the UNO.
ArduinoHardware connection
| MQ7 | Arduino | Description |
|---|---|---|
| VCC | 5V | Power input |
| GND | GND | Ground |
| AOUT | A0 | Analog data output |
| DOUT | D2 | Digital data output |
Examples
- Please download and install Arduino IDE to your PC.
- Arduino Website
- Download the demo codes, unzip and find the Arduino examples.
- Open the Gas_Sensor.ino file by the Arduino IDE.
- Build and upload the codes to the UNO board.
- After downloading, you can run SSCOM to connect the MQ2 module so as to check the sensor.
Expected result
- The sensor needs to preheat for about a minute to heat the internal sensitive materials of the sensor.
- Put the sensor inside the device containing sensitive gas, and the indicator on the module lights up. The indicator goes off when the sensor is removed from the device.
- Datasheet
- User Manual
- Schematic
- Demo Code
- Software
Question:Is it normal that the gas sensor becomes hot in the course of operating?
Answer: Don't worry, it is normal. Because the sensitivity material in the sensor should be heated for operating. {{{3}}} {{{4}}}{{{5}}}
SupportTechnical Support
If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue. Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)
Submit Now
Từ khóa » Cảm Biến Mq
-
Cảm Biến Khí Metan MQ-4 - Nshop
-
Cảm Biến Khí Gas (LPG/CO/CH4) MQ-2 - Nshop
-
Module Cảm Biến Khí Gas MQ-2, MQ-4, MQ-5, MQ-6, MQ-7 ... - Shopee
-
Hướng Dẫn Sử Dụng Module Cảm Biến Khí CO (MQ-7 Sensor) - MLAB
-
Cảm Biến Chất Lượng Không Khí MQ-135
-
Cảm Biến Nồng độ Cồn MQ-3
-
Cảm Biến Khí Gas MQ-7 Gas Sensor | Điện Tử ProE
-
MODULE CẢM BIẾN KHÍ - ĐIỆN TỬ LÊ NGUYÊN
-
MODULE CẢM BIẾN KHÍ GAS MQ-6 - Linh Kiện Quốc Thái
-
Module Cảm Biến Khí Hydro MQ-8 - Linh Kiện 888
-
Module Cảm Biến Khí Gas MQ-2 - Dosangtao
-
MQ Sensor | Products - SparkFun Electronics
-
Module Cảm Biến Khí Gas MQ-2 (MQ2)