Embedded Systems Lab Report: Master of Engineering
Embedded Systems Lab Report: Master of Engineering
MASTER OF ENGINEERING
In
DIGITAL SYSTEMS
Submitted by
2022 - 2024
i
BONAFIDE CERTIFICATE
This is to certify that the Embedded lab report entitled “Smoke Detector using MQ-2
Gas Sensor”, which is being submitted by Kolloju Venkata Vikhyath with Roll
no.100522744104 in partial fulfillment of the award of M.E in Electronics and communication
Engineering, University College of Engineering (Autonomous), Hyderabad is a record of
bonafide work carried out by her under our guidance and supervision in the academic year 2022-
2024
SIGNATURE
Mr.Md.Misbahuddin
Asst.Prof.
Electronics and Communication Engineering
Osmania University
ii
ABSTRACT
A smoke detector is a device that senses smoke typically as an indicator of fire. Smoke
detector basically works on principle of optical detection or on ionization and for increased
sensitivity for smoke detection both the methods are used . By this smoke detectors can be
used to detect the smokers in public places. However these smoke detectors in large
commercial industrial and residential are usually provided by a central fire alarm system.
smoke detection is done by MQ2 analog gas sensor. This sensor is also used to detect LPG,
i-butane , propane, methane ,alcohol, hydrogen ,smoke. There by whenever smoke is
detected by this sensor it gives information to arduino, and the programme in the Arduino
runs and gives the information that smoke detected and buzzer buzzes in caution of smoke.
Coming to design of smoke detectors, these are typically housed in a disc shaped plastic
enclosure about 150mm in diameters and 25mm in thick, but shape can vary by
manufacturer or product line.The voltage that the sensor outputs changes accordingly to the
smoke/gas level that exists in the atmosphere. The sensor outputs a voltage that is
proportional to the concentration of smoke/gas.
iii
CHAPTER NO. TITLE PAGE NO
Certificate ii
Abstract iii
Table of Contents iv
List of Figures v
List of Tables vi
1 INTRODUCTION 1
2
Smoke Detection Using MQ-2 Gas Sensor 3
2.1 Introduction 3
3.1 Conclusion 14
3.2 Future Scope 14
iv
LIST OF FIGURES
v
LIST OF TABLES
vi
CHAPTER 1
INTRODUCTION
1.1 Background and Motivation:
The background and motivation for the Smoke Detection System from the growing
concern for public safety. In our daily life, we come across may incidents that fire engulfed in
industries or in any hospitals. But we don’t focus much on how this gas or smoke or fire was
detected. Here’s the project which describes about how the smoke is being detected and how it
performs operations through logistics available in market in a scientific procedure.In this
project the detection of gases like smoke, butane , propane, alcohol can be detected by a sensor
named MQ-2 gas sensor. When the gas is detected by this MQ-2 sensor , its voltage fluctuates
and when it reaches a value 200 it indicates that as gas .So, this need to be programmed in an
Arduino uno inorder to experiment practically , as Arduino uno is used in various multitasking
purposes , we can use it here for detecting smoke and need to give a cautios buzzer or LED
blinking that smoke is detected . so this Arduino uno is programmed in such a way that when
the smoke senor MQ-2 value reaches 200 or above it needs to give a buzzer or light as output.
Here’s the project which describes about how the smoke is being detected and how it
performs operations through logistics available in market in a scientific procedure. In this
project the detection of gases like smoke, butane , propane, alcohol can be detected by a sensor
named MQ-2 gas sensor. When the gas is detected by this MQ-2 sensor , its voltage fluctuates
and when it reaches a value 200 it indicates that as gas .So, this need to be programmed in an
Arduino uno inorder to experiment practically , as Arduino uno is used in various multitasking
purposes , we can use it here for detecting smoke and need to give a cautious buzzer or LED
blinking that smoke is detected . so this Arduino uno is programmed in such a way that when
the. i smoke senor MQ-2 value reaches 200 or above it needs to give a buzzer or light as output.
1
1.3 Proposed solution:
Design and implement an smoke Detector system that is capable of measuring the
smoke and gas level present in the environment and indicating their level present through LED
lights, and a buzzer. If the smoke level is above a predefined threshold, the system should turn
on the buzzer, and turn on the red LED light. If the smoke level is below the threshold, the
system should turn off the buzzer, and the green LED light glows.
2
CHAPTER 2
2.2Block diagram
Fig.1.Block diagram
The block diagram consists of Arduino Uno, MQ-2 gas sensor, buzzer, and LEDs. To Arduino
Uno, the MQ-2 gas sensor acts as an input- it senses the presence of smoke, gases and gives it
to the Arduino as input. Buzzer, and LEDs acts as outputs.
3
Description of block diagram ARDUINO UNO
Arduino Uno is a microcontroller board based on the ATmega328P microcontroller. It
is one of the most popular boards in the Arduino family and is widely used in various projects
due to its ease of use and affordability. The board is equipped with a USB interface that enables
it to be programmed and powered through a computer.
The Arduino Uno has a total of 14 digital input/output pins, 6 of which can be used as PWM
outputs and 6 analog inputs. It also has a 16 MHz quartz crystal oscillator and a power-saving
sleep mode that allows the board to consume minimal power when idle. It has 14 digital
input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic
resonator (CSTCE16M0V53-R0), a USB connection, a power jack, an ICSP header and a reset
button. It contains everything needed to support the microcontroller.
One of the key features of the Arduino Uno is its open-source nature. This means that
anyone can access the source code and make changes to it, or use it for their projects. The
Arduino platform also comes with a large community of users who share their projects and
offer support to others. There are also a large number of libraries available for the Arduino
platform, which makes it easy to add functionality to projects without having to write complex
code.
4
Programming
The programming of the Arduino UNO is accomplished using the Arduino Software
Integrated Development Environment (IDE). To select the appropriate microcontroller board,
the user must choose "Arduino UNO" from the Tools > Board menu. The ATmega328
microcontroller on the Arduino UNO is pre-equipped with a bootloader, which enables the user
to upload new code to the device without the need for an external hardware programmer.
Power
The Arduino UNO can be powered through either a USB connection or an external
power source, with the source being selected automatically. External power can be provided by
an AC-to-DC adapter or battery, with the adapter connected to the board's power jack and the
battery connected to the GND and Vin pin headers of the POWER connector. The board
operates optimally with an external power supply of 7 to 12 volts, but can range from 6 to 20
volts. If the voltage is less than 7V, the 5V pin may not provide a stable output and if the voltage
is greater than 12V, the voltage regulator may overheat, potentially damaging the board.
• Vin - The input voltage to the Arduino board when it's using an external power source
(as opposed to 5 volts from the USB connection or other regulated power source). You
can supply voltage through this pin, or, if supplying voltage via the power jack, access
it through this pin.
• 5V - This pin outputs a regulated 5V from the regulator on the board. The board can be
supplied with power either from the DC power jack (7 - 12V), the USB connector (5V),
or the VIN pin of the board (7-12V). Supplying voltage via the 5V or 3.3V pins
bypasses the regulator, and can damage your board. We don't advise it.
• 3.3V - A 3.3 volt supply generated by the on-board regulator. Maximum current draw
is 50 mA.
• GND - Ground pins.
• IOREF - This pin on the Arduino board provides the voltage reference with which the
microcontroller operates. A properly configured shield can read the IOREF pin voltage
and select the appropriate power source or enable voltage translators on the outputs to
work with the 5V or 3.3V.
5
Memory
The ATmega328 has 32 KB (with 0.5 KB occupied by the bootloader). It also has 2 KB
of SRAM and 1 KB of EEPROM (which can be read and written with the EEPROM library).
• AREF. Reference voltage for the analog inputs. Used with analogReference().
• Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset
button to shields which block the one on the board.
6
Communication
The Arduino UNO has multiple communication options with computers, other boards,
or microcontrollers. It has a UART TTL serial communication feature through digital pins 0
(RX) and 1 (TX), which is converted to USB communication by the ATmega16U2 on the board
and appears as a virtual COM port to the computer. The Arduino IDE comes with a serial
monitor for sending and receiving simple text data. The RX and TX LEDs on the board flash
when data is transmitted via USB and the computer, but not when communicating through pins
0 and 1.
Technical Specifications
Microcontroller ATmega328P
Operating Voltage 5V
SRAM 2 KB (ATmega328P)
EEPROM 1 KB (ATmega328P)
LED_BUILTIN 13
Length 68.6 mm
Width 53.4 mm
Weight 25 g
7
MQ-2 Gas Sensor
MQ2 gas sensor is an electronic sensor used for sensing the concentration of
gases in the air such as LPG, propane, methane, hydrogen, alcohol, smoke and
carbon monoxide. MQ2 gas sensor is also known as chemiresistor. It contains a
sensing material whose resistance changes when it comes in contact with the gas.
This change in the value of resistance is used for the detection of gas.
Fig.3.MQ-2 Sensor
The MQ2 is a heater-driven sensor. It is therefore covered with two layers of fine stainless steel
mesh known as an “anti-explosion network”. It ensures that the heater element inside the sensor
does not cause an explosion because we are sensing flammable gasses. It also protects the sensor
and filters out suspended particles, allowing only gaseous elements to pass through the chamber.
A copper-plated clamping ring secures the mesh to the rest of the body.
This sensor contains a sensing element, mainly aluminium-oxide based ceramic, coated with Tin
dioxide, enclosed in a stainless -steel mesh. Sensing element has six connecting legs attached to
it. Two leads are responsible for heating the sensing element, the other four are used for output
signals. Oxygen gets adsorbed on the surface of sensing material when it is heated in air at high
temperature. Then donor electrons present in tin oxide are attracted towards this oxygen, thus
preventing the current flow.
When reducing gases are present, these oxygen atoms react with the reducing gases thereby
decreasing the surface density of the adsorbed oxygen. Now current can flow through the sensor,
which generated analog voltage values. These voltage values are measured to know the
concentration of gas. Voltage values are higher when the concentration of gas is high. The MQ2
gas sensor operates on 5V DC and consumes approximately 800mW. It can
detect LPG, Smoke, Alcohol, Propane, Hydrogen, Methane and CarbonMonoxide concentra
tions ranging from 200 to 10000 ppm.
9
Technical Specifications
PARAMETER VALUE
Load resistance 20 KΩ
Heater resistance 33Ω ± 5%
Heating consumption <800mw
Sensing Resistance 10 KΩ – 60 KΩ
Concentration Range 200 – 1000 ppm
Preheat Time Over 24 hour
Operating voltage 5V
Table.2. Technical Specifications of MQ-2 Gas Sensor
• VCC - Supplies power to the module. Connect it to the 5V output of your Arduino.
• GND - It is the ground pin.
• D0 - Indicates the presence of alcohol. D0 becomes LOW when the alcohol
concentration exceeds the threshold value (as set by the potentiometer), and HIGH
otherwise.
• A0 - Produces analog output voltage proportional to alcohol concentration, so a higher
concentration results in a higher voltage and a lower concentration results in a lower
voltage.
In summary, the MQ-2 Gas Sensor detects the presence of smoke and gases in the air, converts
the information into an electrical signal, and sends the signal to a microcontroller or control
device for processing and analysis.
10
Buzzer
A buzzer is an audio signaling device that can produce sound when an electric current
is passed through it. Buzzers are widely used in various applications like alarms, reminders,
and timers.
Fig.7.Buzzer
Hardware Requirements:
1. Arduino board (e.g. Arduino UNO)
2. Buzzer
3. Jumper wires
4. Breadboard (optional) Circuit Connections:
1. Connect one terminal of the buzzer to a digital pin on the Arduino board.
2. Connect the other terminal of the buzzer to the GND (ground) pin on the Arduino board.
3. If using a breadboard, connect the buzzer and the jumper wires to the breadboard.
LEDs
An LED (Light Emitting Diode) is a small electronic component that emits light when
a voltage is applied to it. LEDs are widely used in a variety of applications such as indicator
lights, lighting displays, and flashlights. In this report, we will discuss how to use LEDs with
an Arduino UNO board.
11
Fig.8.LED diagram
Hardware Requirements:
1. Arduino UNO board
2. LED(s)
3. Resistor(s) (to protect the LED from burning out)
4. Jumper wires
5. Breadboard (optional)
Circuit Connections:
1. Connect the positive leg of the LED (the longer one) to a digital pin on the Arduino
UNO board.
2. Connect a resistor to the positive leg of the LED.
3. Connect the other end of the resistor to the 5V pin on the Arduino UNO board.
4. Connect the negative leg of the LED (the shorter one) to the GND (ground) pin on the
Arduino UNO board.
5. If using a breadboard, connect the LED, resistor, and jumper wires to the breadboard.
12
CIRCUIT DIAGRAM
Fig.9.Circuit diagram
WORKING PRINCIPLE
When we turn on the system’s power supply, at the same time the MQ2 gas sensor starts to
sense the smoke level in the air and it gives the output value to the Arduino. Then the Arduino
read this output value and print it on the OLED display in the PPM unit. When the sensor sense
smoke in the air, its output value goes high.
When the sensor is in the fresh air, its output value is under 400 ppm. Then the Arduino
indicates it by turn on the green LED and the “Fresh Air” message is print on the Display. When
the sensor sense smoke in the air, its output value will exceed 400 PPM. Then the Arduino
indicates it by turn on the Red LED and Buzzer, and the “Smoke/ Fire” message is print on the
Display.
13
CHAPTER 3
The conclusions should be drawn from this project are: In order to be saved from major
happening fire or smoke breakouts in industries and in many hospitals and also in household
purposes ,for all these natural or artificial breakouts of fire or smoke , when this device is
uploaded near any ventilator it gives siren that smoke or fire is engulfing the area under it. So
many lives can be saved by using this low-cost smoke sensor. The smoke sensor MQ2 is very
effective towards butane , propane, LPG, smoke and combustible gases and it is cost efficient
and life of this sensor is long, so thus has been a major merit that it can be used in saving many
lives of people. So, in the view of concluding project its main agenda is to cope up with the
moder technology and saving millions of lives and brightening with the useful aspect of this
device. It’s a great device that performs its own activity efficiently and importantly saving lives.
There is potential for the Smoke and Gas Detection device to be improved and applied in
various areas in the future.
• The device could be miniaturized and integrated into personal devices, such as
smartphones or wearable devices, to provide more convenient and personalized smoke
and gas detection.
• The same equipment can be used to monitor any other parameter by simply changing
the sensor.
• Fire accidents and gas leakage accidents can be prevented with this system.
With the potential for further development and improvement, the Smoke and gas Detection
device holds promise as a solution for promoting public safety .
14
Code
void setup() {
pinMode(redLed, OUTPUT);
pinMode(greenLed, OUTPUT);
pinMode(buzzer, OUTPUT);
pinMode(smokeA0, INPUT);
Serial.begin(9600);
}
void loop() {
int analogSensor =
analogRead(smokeA0);
15
else
{
digitalWrite(redLed, LOW);
digitalWrite(greenLed, HIGH);
noTone(buzzer);
}
delay(100);
}
16