Arduino Project
Arduino Gas Leak Detector with MQ-2 Sensor
Kit purchase
Looking for parts? Check out our all-in-one kits below — packed with components, beginner-friendly guides, and tons of fun.

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
Please follow the steps in the tutorial below to complete the binding and setup of Arduino Cloud and the Arduino WiFi board.
1.4 Arduino IoT Cloud
Wiring

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 6 on the Arduino, and the cathode to a 1kΩ resistor, then to the negative power bus on the breadboard.
Create a New IoT Project
After configuring the Arduino Cloud and the Arduino WiFi board, follow the steps below to complete the Arduino Cloud project setup

Edit Value



Follow the steps below to configure the dashboard.
1.Create New Dashboard

2.Add Widgets

3.Link Variable


4.Remember to click Done

After completing the above configuration, return to the Things page and open the sketch.

When you have completed the configuration of the Things and Dashboard, as well as the connection and network setup of the Arduino WiFi board, the thingProperties.h and Sketch Secrets files will be generated automatically. If Sketch Secrets is not generated, please manually enter the connected SSID and OPTIONAL_PASS
Copy this code into Arduino Cloud.

Don’t forget to select the board(Arduino UNO R4 WIFI) and the correct port before clicking the Upload button.
