Arduino Project

Arduino Gas Leak Detector with MQ-2 Sensor V1

Course Introduction

This Arduino project simulates a basic gas leak detection system using an MQ-2 gas sensor, a red LED, and a buzzer.

The sensor continuously monitors gas concentration. If the reading exceeds a set threshold, the buzzer sounds and the LED blinks to indicate danger.

Otherwise, the system remains silent and the LED stays off.

Note

If this is your first time working with an Arduino project, we recommend downloading and reviewing the basic materials first.

1.1 Install Arduino IDE(Important)
1.2 Introduction of Arduino IDE

Required Components

In this project, we need the following components:

SN

COMPONENT INTRODUCTION

QUANTITY

PURCHASE LINK

1

Arduino UNO R4 WIFI

1

2

USB Type-C cable

1

×

3

Breadboard

1

BUY

4

Wires

Several

5

Buzzer Modudle

1

6

LED

1

7

MQ-2 Gas Sensor Module

1

8

220Ω resistor

1

Wiring

3.png__PID:26b65c34-a912-4e17-ae50-c21905d27bf0

Common Connections:

MQ-2 Gas Sensor Module
A0:
Connect to A0 on the Arduino.
GND: Connect to breadboard’s negative power bus.
VCC: Connect to breadboard’s red power bus.

Buzzer Modudle
I/O:
Connect to 9 on the Arduino.
GND: Connect to breadboard’s negative power bus.
VCC:Connect to breadboard’s red power bus.

LED
Connect the LED anode to 2 on the Arduino, and the cathode to a 220Ω resistor, then to the negative power bus on the breadboard.

Writing the Code

Note
You can copy this code into Arduino IDE.
Don’t forget to select the board(Arduino UNO R4 Minima) and the correct port before clicking the Upload button.