Projects with an MQ-2 gas sensor
4 Mokxi projects use an MQ-2 gas sensor (3 beginner and 1 intermediate). They run on Arduino Uno and Raspberry Pi boards, and 1 needs no board at all. Here are all of them, from “Gas leak detector with an MQ-2” to “MQ-2 gas sensor on a Pi with an MCP3008”. Each card says what the project does, the board and parts it needs and its level, and Open in the simulator runs it in your browser in one click, with no account.
How to pick your first one
- Start with “Gas sensor module on A0”, a beginner project that needs an MQ-2 gas sensor.
- Arduino Uno runs 2 of them, Raspberry Pi 1 and 1 needs no board at all. Start on the board you have, or on an Arduino Uno if you are buying one.
- The parts used most here are the LED (2 projects), the buzzer (1) and the FC-51 IR obstacle sensor (1). With those on hand, most of this list is open to you.
- Before you build one on a real bench, open the MQ-2 gas sensor part page for its pins and what each one does.
4 projects ready to run

Gas leak detector with an MQ-2
An MQ-2 on A0 waits out its warm-up, then shows the gas level on a 16x2 I2C LCD and a traffic light, and a buzzer beeps when LPG passes the limit.
- Board
- Arduino Uno R3
- Parts
- Traffic light module, buzzer, MQ-2 gas sensor, I2C LCD
- Level
- Beginner

Gas sensor module on A0
An MQ-2 gas sensor’s analog output on A0, printed twice a second: the more gas, the higher the reading. The heater takes a while to warm up first.
- Board
- Arduino Uno R3
- Parts
- MQ-2 gas sensor
- Level
- Beginner

Comparator boards
An MQ-2, a flame sensor, a TCRT5000 and an FC-51, each lighting a lamp from DO with no board. The same LM393 under four sensors, and DO goes low.
- Board
- No board
- Parts
- MQ-2 gas sensor, flame sensor, TCRT5000 line sensor, FC-51 IR obstacle sensor, LED, +1 more
- Level
- Beginner

MQ-2 gas sensor on a Pi with an MCP3008
An MQ-2 on a Raspberry Pi 5: its 5 V output divided down to 3.3 V, read through an MCP3008 with gpiozero.
- Board
- Raspberry Pi 5
- Parts
- Eight-channel ADC, MQ-2 gas sensor, resistor, LED
- Level
- Intermediate