• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Circuit Ideas for You

Get free circuit ideas online.

  • Home
  • Privacy Policy
  • About
Home » MQ2 Gas Sensor Circuit with Arduino

MQ2 Gas Sensor Circuit with Arduino

Last updated on 9 November 2025 by Admin-Lavi Leave a Comment

The MQ2 Gas Sensor Circuit with Arduino is a low-cost sensor.

It can catch bad gas in air very quickly.

When we connect it with Arduino, we make small gas alarm system.

It reads gas level, show number on LCD and buzzer make sound when gas goes high.

This circuit is very simple to make and easy to learn.

It is good project for basic gas detection using Arduino.

Arduino Coding:

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,16,2);

int sensorPin = A0;
int buzzerPin = 8;
int gasValue = 0;
int limitValue = 300;

void setup() {
lcd.init();
lcd.backlight();
pinMode(buzzerPin, OUTPUT);
}

void loop() {
gasValue = analogRead(sensorPin);
lcd.setCursor(0,0);
lcd.print("Gas: ");
lcd.print(gasValue);

if(gasValue > limitValue){
digitalWrite(buzzerPin, HIGH);
lcd.setCursor(0,1);
lcd.print("Gas High! ");
} else {
digitalWrite(buzzerPin, LOW);
lcd.setCursor(0,1);
lcd.print("Safe ");
}
delay(300);
}

Coding Explanation:

  • LCD library works with I2C LCD.
  • SensorPin reads analog gas value from MQ2.
  • BuzzerPin becomes HIGH when gasValue is more than limitValue.
  • LCD shows gasValue and warning message.
  • Delay slows loop to read clearly.

Circuit Working:

MQ2 Gas Sensor Circuit Diagram with Arduino

Parts List:

Parts NameQuantity
Arduino UNO1
MQ2 Gas Sensor1
Buzzer 5V1
I2C LCD 16×2 Display1

MQ2 has heater and sensor resistor.

When gas increases, sensor resistance falls.

Arduino reads this as higher analog value.

Code checks value.

If value is high then buzzer turns ON and LCD shows alert.

Formulas:

Below is the formula for MQ2 Gas Sensor Circuit with Arduino:

MQ2 output = voltage across load resistor RL.

Vout = (RL / (RL + RS)) * VCC

where,

  • RL is the load resistor which is a fixed resistor on the sensor.
  • RS is the sensor resistance which changes when gas level changes.
  • VCC is the supply voltage of 5V.

When gas level rises, RS becomes small so Vout becomes high.

How to Build:

To build a MQ2 Gas Sensor Circuit with Arduino follow the below steps:

  • Take all the parts as shown in circuit diagram.
  • MQ2 VCC pin connect to Arduino 5V
  • MQ2 GND pin connect to Arduino GND
  • MQ2 AO pin connect to Arduino A0
  • MQ2 DO pin connect to Arduino digital pin D7
  • Buzzer positive connect to Arduino pin 8
  • Buzzer negative connect to GND
  • I2C LCD VCC pin connect to 5V
  • I2C LCD GND pin connect to GND
  • I2C LCD SDA pin connect to Arduino A4
  • I2C LCD SCL pin connect to Arduino A5

Conclusion:

This is simple project for MQ2 Gas Sensor Circuit with Arduino.

Arduino read sensor value and give warning by buzzer and LCD.

This project is good for safety and for basic learning.

References:

MQ2 gas sensor has high default sensor value

Filed Under: Alarm Circuits, Arduino Projects, Sensors and Detectors

About Admin-Lavi

Lavi is a B.Tech electronics engineer with a passion for designing new electronic circuits. Do you have questions regarding the circuit diagrams presented on this blog? Feel free to comment and solve your queries with quick replies

Previous Post: « Gas Alarm Circuit using MQ Sensor and Buzzer
Next Post: Smoke Detector Circuit using IC LM358 »

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar




Categories

  • Alarm Circuits (47)
  • Amplifier Circuits (67)
  • Arduino Projects (100)
  • Audio Circuits (116)
  • Automobile Circuits (19)
  • Battery Charger Circuits (65)
  • Free Energy (13)
  • Heater and Temperature Controllers (13)
  • High Voltage (1)
  • Indicator Circuits (46)
  • Inverter Circuits (20)
  • IoT projects (1)
  • LDR Circuits (26)
  • LED and Lamps (150)
  • Meters and Testers (31)
  • Motor Controllers (22)
  • Oscillator Circuits (40)
  • Power Supply Circuits (112)
  • Remote Control Circuits (10)
  • Security and Protection (29)
  • Sensors and Detectors (127)
  • Solar Circuits (29)
  • Timer Circuits (41)
  • Transistor Circuits (93)
  • Transmitter Circuit (17)
  • Tutorials (8)
  • Water Level Controller (7)

Recent Posts

  • 12V to 5V Buck Converter Circuit using Transistors
  • IC 7805 12V To 5V 2A Boost Converter Circuit
  • IC LM309 Based 5 Volt Power Supply Circuit
  • 5V 0.5A Regulated Power Supply Circuit
  • Transistor Based 5V Linear Power Supply Circuit

Recent Comments

  1. TDHofstetter on DIY Variable Power Supply Circuit using Arduino
  2. feathbuff on Simple Micro Ampere Meter Circuit
  3. Admin-Lavi on Simple School Project Multimeter Circuit
  4. choke on Simple School Project Multimeter Circuit
  5. Admin-Lavi on Analog to Digital Converter Circuit using IC 555

Copyright © 2026 | New Circuit Ideas