Dhaksha
Dhaksha
The satisfaction that accompanies the successful completion of this project would be
incomplete without the mention of the people who made it possible, without whose constant guidance
and encouragement would have made efforts go in vain.
I would like to express my thanks to Dr.K Ezhilarasan, Assistant Professor and Head, Department
of Electronics and Communication Engineering, School of Engineering and Technology, CMR
University, Bangalore, for his encouragement that motivated me for the successful completion of
Project work.
I express my thanks to my Internal Project Guide Prof. Silpa Sivan P, Assistant Professor,
Department of Electronics and communication Engineering, School of Engineering and Technology,
CMR University for her constant support.
R.DHAKSHAYANI(22BBTCA129)
R.M.NAVANEETHA(22BBTCA132)
This project explores the integration of the MQ2 gas sensor with an Arduino Uno to develop a cost-
effective and efficient gas detection system. The MQ2 sensor is capable of detecting a variety of gases
including methane, butane, LPG, and smoke. The primary objective is to leverage the Arduino Uno
microcontroller to monitor air quality and detect hazardous gas concentrations, triggering alarms when
dangerous levels are reached.
The project involves setting up the MQ2 sensor, connecting it to the Arduino Uno, and programming the
microcontroller to read sensor data. Additionally, an LCD display is used to show real-time gas
concentration levels, and a buzzer is employed to alert users of potential gas leaks. The implementation
aims to provide a practical solution for gas leak detection in residential and industrial environments,
enhancing safety measures and preventing potential accidents.
Overall, the project demonstrates the effectiveness of using Arduino in conjunction with gas sensors for
developing reliable, low-cost gas detection systems. The system's ability to provide real-time monitoring
and alerts makes it a valuable tool in ensuring safety and mitigating risks associated with gas leaks.
3 METHODOLOGY 15-17
3.1 Hardware Description 15
2.1.5 Potentiometer 10
1.1 INTRODUCTION
The integration of the MQ2 gas sensor with the Arduino Uno microcontroller represents a
significant advancement in the field of environmental monitoring and safety. The MQ2 sensor,
known for its ability to detect a wide range of gases including methane, butane, LPG, and smoke,
is a versatile component ideal for creating gas detection systems. These systems are crucial in
various applications, from industrial safety to home automation, where monitoring air quality
and detecting hazardous gas levels is essential.
The Arduino Uno, a widely used open-source microcontroller, serves as the perfect platform for
interfacing with the MQ2 sensor due to its ease of use, flexibility, and extensive community
support. This project focuses on developing a gas detection system that utilizes the MQ2 sensor
to continuously monitor the air for harmful gases and trigger alerts when dangerous
concentrations are detected. By leveraging the capabilities of the Arduino Uno, the system can
process sensor data in real-time, display gas levels on an LCD screen, and activate a buzzer
alarm when necessary.
The primary goal of this project is to create a cost-effective, reliable, and user-friendly gas
detection system. Such a system not only enhances safety in residential and commercial
environments but also provides an accessible solution for DIY enthusiasts and educational
purposes. The combination of the MQ2 gas sensor and Arduino Uno demonstrates how modern
technology can be harnessed to improve safety and awareness regarding air quality and gas
leaks. Through this project, users can gain practical experience in electronics, programming, and
environmental monitoring, contributing to a safer and more informed community.
CHAPTER-02
Hardware and Software Requirements
(b)MQ2 Sensor
The MQ2 sensor is a gas sensor that is commonly used to detect various gases like LPG,
propane, hydrogen, and smoke. It is widely used in gas leakage alarms and gas detectors. The
sensor works based on the principle of detecting changes in resistance when exposed to
different gases. When a particular gas is detected, the resistance of the sensor changes, and this
change is used to determine the presence of the gas.
c)16*2 I2C
The 16*2 LCD with I2C is a popular combination used in many electronics projects. The 16*2
indicates the dimensions of the LCD screen, which is 16 characters in each of the 2 rows. The
I2C module is added to the LCD to simplify the connections needed to control the display. By
using I2C communication, you can reduce the number of wires required to connect the LCD to a
microcontroller, making it more convenient to use in projects.
d)LCD Display
The LCD display, which stands for Liquid Crystal Display, is a type of flat panel display
commonly used in electronic devices such as TVs, monitors, and smartphones. It utilizes the
properties of liquid crystals to create images and text by manipulating light passing through
them. LCD displays are known for their low power consumption, lightweight, and ability to
display information clearly.
e)Potentiometer
A potentiometer, often referred to as a pot, is a variable resistor that can be adjusted to control
electrical resistance. It typically has three terminals and a dial or knob that allows you to change the
resistance value by turning it. Potentiometers are commonly used in electronics to control things like
volume in audio equipment, brightness in displays, or as control inputs for microcontrollers and
other electronic circuits.
f) Bread Board
A breadboard is a flat, rectangular platform used for building and testing electronic circuits without
soldering. It has a grid of interconnected holes into which electronic components and wires can be
inserted to create temporary circuits. Breadboards are widely used in prototyping and educational
settings because they allow for easy modifications and troubleshooting of circuit designs.
g) Jumper Wires
Jumper wires are electrical wires used to make connections between components on a breadboard
or other prototyping tools. They come with male or female connectors at each end, allowing them
to be easily inserted into breadboard holes or connected to other components. Jumper wires are
typically used in electronics projects to create temporary circuit connections. They are available
in various lengths and colors for organization and clarity.
h) USB Cable:
A USB cable connects computers and devices for data transfer and power. It includes types like
USB-A, USB-B, Micro-USB, Mini-USB, and USB-C, which vary in shape and size. USB cables
are widely used for charging devices, connecting peripherals, and transferring data. The USB-C
type is known for its reversible connector and faster data and power capabilities.
Arduino IDE software is an opensource software to which a hobbyist can connect the AT mega
chips. In this software the code can be written and uploaded to any AT mega chip and then the
code can be executed on the chip. Many 3D printed electronics and Arduino- compatible use
AT mega chip and hence the user can upload the program. Arduino can also be used firmware
any electronics. Sketch is the window in which the program is to be written.
The Arduino platform has become quite popular with people just starting out with electronics,
and for good reason. Unlike most previous programmable circuit boards, the Arduino does not
need a separate piece of hardware (called a programmer) in order to load a new code onto the
board – you can simply use a USB cable. Additionally, the Arduino IDE uses a simplified
version of C++, making it easier to learn the program. Finally, Arduino provides a standard form
factor that breaks out the functions of the micro-controller into a more accessible package.
CHAPTER-03
METHODOLOGY
3.1 HARDWARE DESCRIPTION:
The MQ2 gas sensor is a versatile device capable of detecting a range of gases, including LPG, i-
butane, propane, methane, alcohol, hydrogen, and smoke. When integrated with an Arduino Uno,
it forms an efficient gas detection system suitable for various applications such as gas leakage
detection, smoke detection, and air quality monitoring. The MQ2 sensor operates on a 5V power
supply and features both analog and digital outputs, making it adaptable for different project
needs. To connect the MQ2 sensor to the Arduino Uno, you need to connect the VCC pin to the
Arduino's 5V pin, the GND pin to the GND pin on the Arduino, and the analog output (AO) to
one of the Arduino's analog input pins (e.g., A0). Optionally, the digital output (DO) can be
connected to a digital pin on the Arduino (e.g., D2) if digital signal processing is required. A
simple Arduino code can read the analog values from the MQ2 sensor and display them on the
Serial Monitor, providing real-time gas concentration levels. For accurate readings, it is crucial
to allow the sensor to preheat for about 24 hours and to calibrate it correctly. The onboard
potentiometer can be used to adjust the sensor's sensitivity. Proper handling and understanding of
the sensor’s characteristics, along with considering environmental factors like temperature and
humidity, are essential for reliable and precise gas detection.
The MQ2 gas sensor is a highly versatile device that plays a crucial role in detecting various
gases, including LPG, i-butane, propane, methane, alcohol, hydrogen, and smoke. This sensor,
when combined with an Arduino Uno microcontroller, can create an efficient and reliable gas
detection system, suitable for applications ranging from home safety devices to industrial
monitoring systems.
Block Diagram
Circuit Diagram
The MQ2 gas sensor, used for detecting gases like LPG, smoke, alcohol, propane, hydrogen,
methane, and carbon monoxide, can be integrated with an Arduino Uno for effective gas level
monitoring. In this setup, the MQ2 sensor is connected to the Arduino Uno using a breadboard
and jumper wires. The sensor's VCC pin is connected to the 5V pin on the Arduino Uno to
supply power, and the GND pin is connected to the Arduino's GND pin to complete the circuit.
The analog output (AO) pin of the MQ2 sensor is connected to the A0 analog input pin on the
Arduino Uno, allowing the Arduino to read the sensor's analog signal, which varies with the gas
concentration. Optionally, a 10kΩ pull-down resistor can be used between the AO pin and GND
to stabilize the readings. This configuration enables the Arduino to process the gas sensor data
and trigger alerts or actions when gas levels exceed specified thresholds, making it useful for
applications like gas leak detection and air quality monitoring.
CHAPTER-04
4. SOFTWARE DESCRIPTION
MQ2 mq2(Analog_Input);
void setup(){
Serial.begin(9600);
lcd.begin();//Defining 16 columns and 2 rows of lcd display
lcd.backlight();
mq2.begin();
}
void loop(){
float* values= mq2.read(true); //set it false if you don't want to print the values in the Serial
//lpg = values[0];
lpg = mq2.readLPG();
//co = values[1];
co = mq2.readCO();
//smoke = values[2];
smoke = mq2.readSmoke();
lcd.setCursor(0,0);
lcd.print("LPG:");
lcd.print(lpg);
lcd.print(" CO:");
lcd.print(co);
lcd.setCursor(0,1);
lcd.print("SMOKE:");
lcd.print((smoke*100)/1000000);
lcd.print(" %");
delay(1000);
}
CHAPTER-05
The circuit diagram and the block diagrams are shown once the components were connected to
each other. All the components are connected to each other and thus the system setup which
helps one to understand the steps in simple and easy way.
Operating at a standard 5V with a current consumption of 150 mA, the MQ2 sensor has a
detecting range of 200 to 10,000 ppm (parts per million), providing an analog output that can be
easily interfaced with microcontrollers or ADCs for further processing. The sensor works based
on the change in resistance of its sensing material, typically tin dioxide (SnO2), when exposed to
target gases. The oxidation of these gases on the sensor’s surface alters its resistance, producing
an analog signal proportional to the gas concentration.
This sensor is extensively used in gas leak detection systems to ensure safety in homes, offices,
and industrial settings by alerting users to the presence of potentially hazardous gases. It is also
utilized in fire detection systems due to its ability to detect smoke, enhancing early warning
capabilities. Additionally, the MQ2 sensor finds applications in breath analyzers for measuring
alcohol levels and in air quality monitoring systems to assess and ensure healthy air conditions.
Its wide detection range, high sensitivity, and robust performance make it an essential
component in various gas detection and safety systems.
5.2 Result
The result of the project is a functional radar system that uses an Arduino Uno, an HC-SR04
ultrasonic sensor, and a servo motor to scan an area and measure distances to objects. The sensor,
mounted on the servo, sweeps back and forth, and the distance data is displayed on a serial monitor
or LCD screen, effectively mapping out the detected objects within the scanned area.
CHAPTER-06
CONCLUSION
In conclusion, the MQ2 gas sensor stands out as a reliable and versatile device for gas detection
applications. With its wide detection range covering gases like LPG, i-butane, propane, methane,
alcohol, hydrogen, and smoke, the sensor proves valuable in ensuring safety and environmental
monitoring across residential and industrial settings.
The sensor's operational characteristics, including its 5V operating voltage, 150 mA current
consumption, and analog output, make it easy to integrate into systems requiring gas detection
capabilities. Its high sensitivity and fast response time enhance its effectiveness in detecting gas
leaks, smoke, and alcohol levels, contributing significantly to safety measures and air quality
monitoring efforts.
Overall, the MQ2 gas sensor's robust performance, long lifespan, and cost-effectiveness make it
a standout choice for projects requiring reliable gas detection and environmental monitoring
capabilities.
CHAPTER-07
7.REFERENCE
[1] https://www.electronicsforu.com/
[2] https://wokwi.com/
[3] https://www.tinkercad.com/
[4] https://1drv.ms/w/c/