Table of Contents
To program the gas sensor to operate with the microprocessor in the event of a gas leak
To utilize a stepper motor to turn off the gas source immediately as a leak is detected
To program the flame sensor to operate with the microprocessor in the event of a flame.
To program a buzzer to alert persons in the building of danger.
To program a fan to ventilate smoke from the building to reduce the casualties caused by the hazard of smoke inhalation.
To program an LCD to display the status of the system.
This project is based on preventing gas leakage and reducing/preventing casualties in the event of a fire. It does not take much doing for an accident to happen. How many times in daily life we might leave the gas cooker unattended just for a minute and sometimes a bad connection from the gas supply can cause leakage. This was the case when three people from Madurai, India 1 were injured from a fire that resulted due to a LPG cylinder leak according to an article by the Times of India the replacement gas cylinder was not installed properly which led to the fire. Another instance in a report by the Delhi times 2 thirteen people were injured when the cylinder burst due to gas leakage. These tragic accidents could have been prevented if the leakage was detected earlier.
The proposed project will use microprocessor technology to create a relatively inexpensive solution. The system is designed to read input signals from various sensors (gas/smoke and flame) connected to the microcontroller, process and send signals to various outputs (Fan, Stepper Motor LED,s etc..)
1 CITATION TNN16 l 1033 (TNN, 2016)2 CITATION Pre10 l 1033 (Press Trust of India, 2010)3 CITATION Vmo17 l 1033 (Vmoksha IoT Bootcamp, 2017)The Gas Sensor (MQ2)
The MQ-2 Gas Sensor module used in this project can detect gas leakage in home and industry. The MQ2 sensor is useful in detection of several gases such as LPG, Methane, Propane, Hydrogen, I-butane, Alcohol and Smoke 4. The electrochemical sensor contained in the MQ2 is what changes its resistance for different concentrations of the various gases. A variable resistor is connected in series with the sensor with to form a voltage divider circuit (Fig 1), and the variable resistor is used to change sensitivity 4. The sensor has a preheat duration of 20 seconds then when any one of the gases come into contact with the sensor after heating, the sensor’s resistance changes.
The resistance change varies the voltage across the sensor which can then be read by the microcontroller (Arduino Mega 2560) which will be introduced later. The voltage value can be used to find the resistance of the sensor by knowing the reference voltage and the other resistor’s resistance 4. The sensor has different sensitivity for different types of gases. The sensitivity characteristic curve (Fig 3) is shown shows the typical sensitivity characteristics of the MQ-2 for the different type of gases in particles per million (PPM).
3781425252730Fig 2 : MQ2 Pinout Diagram
00Fig 2 : MQ2 Pinout Diagram
438150261620Fig SEQ Figure * ARABIC 1: Voltage Divider Circuit
00Fig SEQ Figure * ARABIC 1: Voltage Divider Circuit
193357510160Fig 3 : Sensitivity Characteristics Curve
00Fig 3 : Sensitivity Characteristics Curve
The following table fig 4 provides a brief description of the pin functions of the Module.
1656608170394Fig 4 : Pin Description of Gas Sensor
00Fig 4 : Pin Description of Gas Sensor
Features of the MQ2 according to data sheet :
Operating Voltage is +5V
Can be used to Measure or detect LPG, Alcohol, Propane, Hydrogen etc.
Analog output voltage: 0V to 5V
Digital Output Voltage: 0V or 5V (TTL Logic)
Preheat duration 20 seconds
Can be used as a Digital or analog sensor
The Sensitivity of Digital pin can be varied using the potentiometer
Some applications of the MQ2 include :
Detects or measure smoke or Gases like LPG, Alcohol, Propane, Hydrogen, CO and even methane
Air quality monitor
Gas leak alarm
Safety standard maintenance
Maintaining environment standards in hospitals
-635237490Caution : The sensor becomes hot after preheating duration avoid touching it to experience burn.
00Caution : The sensor becomes hot after preheating duration avoid touching it to experience burn.
The Flame Sensor
A flame sensor detects the presence of fire or flames but to understand the flame sensor we need to know some of the characteristics that all flames have in common 6 some of which are :
Production of heat
Expansion of gases
Production of by-product of combustion
Emission of light (infrared or ultraviolet)
Ionization of the atmosphere in and around the flame
Many flame detection devices designed for domestic heating systems use the thermal effect of the flame (heat) as the method of detection 6 . In extremely hazardous environments such as a petrochemical processing plant, flame sensors work to reduce the risks associated with fire because failure to detect gas leaks, fires or explosions could prove fatal.
There are many different types of flame sensor – some will raise an alarm while others may activate a fire suppression system or deactivate a combustible fuel line. Our system hopes to achieve a combination of purposes. Optical flame sensors are divided into three groups including Visible light sensors, Infrared sensors and Ultraviolet sensors depending on which range of the total radiation band they are designed to detect. Infrared flame sensors and ultraviolet flame sensors being some of the most notable.
Infrared (IR) Detector
“An IR detector is a pyroelectric sensor that is capable of detecting thermal radiation and is rather sensitive to variations of the received light signal” AZO Sensors 7. The detector is sensitive to a narrow band of radiation around the 4.4 micron range which is a predominant emission band for hydrocarbon fueled fires. Single frequency detectors use a pyroelectric sensor, which responds to changes in IR radiation intensity. In addition they incorporate a low frequency band pass filter, which limits their response to those frequencies that are characteristic of a flickering fire AZO Sensors 7. When a fire signal is received from the sensor, electronic circuitry in the detector generates an output signal, before it is interpreted by the microcontroller.
Many flame detection devices designed for domestic heating systems use the thermal effect of the flame (heat) as the method of detection BDC 6. IR sensors can be used with either oil or gas flames. Subsequently more than 90% of the flame’s total radiation is infrared, these detectors receive sufficient radiation of very high intensity and will operate with either weaker flames or extremely hot flames BDC 6.
Special application requirements for infrared detectors can be summarized as follows:
The cell must have a clear view of the flame.
The cell must be protected from excessive hot refractory.
The cell must be protected from temperatures exceeding 125 ° F.
Correct wiring procedures must be used for the flame detector leads.
Shown below are the advantages and disadvantages of the flame sensor
High immunity to optical contaminants like oil, dirt, and dust
High response time about under 30 milliseconds for some brands
Insensitive to solar, welding, lightning, X-rays, sparks, arcs and corona
Generally not suitable for non-carbon fires
Some brands will respond to modulated infra-red sources example signals from a tv remote which may overlap the signals which had to be detected and cause false alarms.
Rain, ice and water vapor on the detector lens will inhibit detection
Sensitive to aqueous environments like frost, fog, etc.
-69185173101000According to AZO Sensors 7 In order to protect against this strong sensitivity and prevent false alarms, several sensors are now being used in a single device (Multi IR). The benefits of this are that they are more reliable and cheaper than a UV detector, this device has a longer lifetime before failure. The diagram below fig 5 shows the pin configuration of the flame sensor used.
354520536874Notice: The flame sensor is designed to detect fire only, but it is not fireproof itself. When using it, please keep a safe distance from the fire to avoid burning out.
00Notice: The flame sensor is designed to detect fire only, but it is not fireproof itself. When using it, please keep a safe distance from the fire to avoid burning out.
505430208280Fig 5 : Pin Configuration of Flame Sensor
00Fig 5 : Pin Configuration of Flame Sensor
These are some of the applications of the flame sensor
Fire Detection System
Engine test facilities
Fire Alarm System
Generator and Storage Tanks
Fire-Fighting Robot *
Dry Powder Extinguisher
In association with the flame sensor will be an automated system to extinguish the fire when a flame is detected by the sensor. This will be the case for an electrical fire. Normally for a class C fire according to “Strike First Usa” 8 a Carbon dioxide (CO2) extinguisher is best suited for an electrical fire. Except we wont be strictly dealing with electrical fires but more of a hybrid type fire. We used the “ABC Dry Powder” (or Dry Chemical) fire extinguisher which is a multi-purpose extinguisher and can handle Classes A, B ; C fires. However “Fire and safety Centre” 9 stated it can also be used on electrical fires but it leaves a residue that may damage delicate electronics. They restated that “often times a dry chemical fire extinguisher can be used on class A, B, and C fires” which agrees with our selection as the best choice for the hybrid fire according to the table below fig 5.1.
The reason we did not opt for the Carbon dioxide (CO2) extinguisher is because in our system the ventilation fan would potentially spread this gas and according to “Fire and safety Centre” 9 it states that “Co2 is a gas and can asphyxiate if inhaled by persons and care should be taken when using in confined spaces”. Also mentioned is that “they do not work by cooling the fire and therefore not recommended for controlling Class A fires involving solids” which rules it out as the ideal choice for the hybrid fire.
1228725168021000How the ABC Dry Powder works according to an article by the Capital Fire Protection LTD entitled “The ABC’s of Fire Extinguishers” 10 is to douse ” the fire by coating the fuel with a thin layer of dust, separating the fuel from the oxygen in the air”. The powder interrupt the chemical combustion reaction of fire, making these extinguishers an effective solution.
1819275380365Fig 5.1 : Fire Extinguisher Chart
00Fig 5.1 : Fire Extinguisher Chart
The Microcontroller (Arduino Mega 2560)
http://www.mantech.co.za/datasheets/products/A000047.pdfThis project utilizes the Arduino Mega 2560 which is a microcontroller board based on the ATmega2560. It has 54 digital input/output pins shown below (of which 14 can be used as PWM outputs),16 analog inputs,4 UARTs (hardware serial ports), a 16 MHz crystal oscillator, a USB connection for connection to a computer via USB cable, a power jack for powering it with a AC-to-DC adapter or battery, an ICSP header, and a reset button simply everything needed to support the microcontroller according to the Mega 2560 manual 11 . Represented below fig 6 is a diagram showing the various pin layout of the Mega 2560. (Source Arduino manual)
199072570677Fig 6 : Pin Layout of the Arduino Mega 2560
00Fig 6 : Pin Layout of the Arduino Mega 2560
Programming the Arduino
The Arduino Mega2560 can be programmed with the Arduino software (Arduino IDE). The programming language used is C/C++ and is stored in the microcontrollers’ 256 KB of flash memory, for storing code in the form of a “sketch” used by the Arduino IDE software. For components like the flame sensor , gas sensor , LCD Display and Stepper Motor, digital libraries can be added to simplify the process of coding and the code itself will be explained later on. The 54 digital pins on the Mega can be used as an input or output, using functions like pin Mode (to define a pin as input or output), digital Write (To send a high or low signal to the pin), and digital Read (to read the state of the pin) functions. They are each operated at 5 volts.
More to be added and explained with the entire code
The LCD Display with Inter- Integrated Circuit Communications (I2C) Bus
For displaying system status a 16*2 LCD Display was used. Normally using the LCD display with the Liquid Crystal Digital library works fine however it uses several I/O connections the Arduino. So to reduce the number of connections to the LCD an I2C Bus is used freeing up some port for use elsewhere. It was first developed by Phillips Semiconductor in 1982 for communications between integrated circuits and televisions 12. The I2C not only drives an LCD but can link several Microcontrollers and similar devices to each other. Shown below are the I2C adapter fig 7 and the connection of it to the LCD fig 8 which made the LCD easy to work with due to less connections needed to the Arduino.
36195033655000The I2C adapter has four pins which is as follows :
Pin Name Description
VCC Power of 3.3V or 5V
SDA Stores Serial Data
SCL Serial Clock Signal
79057552070Figure 7 : I2C Adapter
00Figure 7 : I2C Adapter
725717279400Figure 8 : I2C Adapter connected to rear of LCD
00Figure 8 : I2C Adapter connected to rear of LCD
The Stepper Motor
1476375135890Fig 9 Stepper Motor + ULN2003 Driver Board
00Fig 9 Stepper Motor + ULN2003 Driver Board
Where to use 28-BYJ48 Stepper Motor
The stepper motor utilized in this project is the most commonly used 28-BYJ48 Stepper Motor shown above fig 9. The motor has a 4 coil unipolar arrangement and each coil is rated for +5V and can be easily controlled with any basic microcontroller. You can find this (or similar) motors in your some basic everyday items such as those listed below.
Stepper Motor Applications
•Precise control machines
•Car side mirror tilt
•Closing a valve for this project
This motor has a stride angle of 5.625°/64, this means that the motor will have to make 64 steps to complete one rotation and for every step it will cover a 5.625° hence the level of control is quite high. These motors run only on 5V so don’t expect very high torque, for a high torque application you should consider the Nema17 motors. Normally you would have seen servo motors being used to shut off valves in industrial applications . Now the stepper motor can do the same job with greater control in terms of flexibility and is cheaper, not taking anything away from the servo motor.
How to use 28-BYJ48 Stepper Motor
These stepper motors consume high current and hence a driver IC like the ULN2003 is mandatory. To understand how this motor rotates we look into the coil diagram fig 10 below.
2133600237490Fig 10 Stepper Motor Coils
00Fig 10 Stepper Motor Coils
There are four coils in the motor and one end of all the coil is tied to +5V (Red) and the other ends (Orange, Pink, Yellow and Blue) are taken out as wires. The Red wire is constantly provided with a +5V supply which will be across (energize) the coil only if the other end of the coil is grounded. The motor can be made to rotate only if the coils are energized in a logical sequence. This logical sequence is programmed using the microcontroller. The sequence in which each coil should be triggered is shown in the table below. Here “1” represent the coil is held at +5V, since both the ends of coil is at +5V (red and other end) the coil will not be energized. Similarly “0” represents the coil is held to ground, now one end will be +5V and the other one is grounded so the coil will be energized. The table below fig 11 summarizes the operation in sequence.
1762125236855Fig 11 Stepper Motor Coils Logic Sequence
00Fig 11 Stepper Motor Coils Logic Sequence
https://components101.com/motors/28byj-48-stepper-motorThe Ventilation Fan
A ventilation fan is used in this project for the purpose of extracting gases from the building. Fire ventilation can have several purposes, for example to reduce the effect of smoke which can cause choking and heat exposure on trapped people in the event of a fire and to improve working conditions for the firefighting crew according to “Fire Ventilation by Stefan Svensson 5. The objective of fire ventilation is to release heat and fire gases into the open away from the affected building.
Mentioned in the article are some of the reasons we use fire ventilation as follows :
Reducing the impact of fire gases and heat on trapped civilians, and to enable their safe evacuation from the building.
Assist the fire department search and rescue operation by reducing the thermal load, and to improve visibility in the building for the firefighting crew and civilians.
Prevent or contain the fire spread or fire gases by a decrease of the impact of pressure and heat in the building.
Implementation of fire ventilation
Fire ventilation can be employed in three different ways, among other things reliant on the relative arrangement of inlets (openings where fresh air flows in) and outlets (openings where fire gases flow out), both in terms of distance and height, and also dependent on which other resources are used 5 . Discussed below are the three types:
Horizontal fire ventilation
Where the outlets are found on the same level with the fire, so the flow of fire gases will take place horizontally. An example of this is in an apartment fire or in particular types of industrial buildings where it is tough to make openings on the roof and where there isn’t any vents or skylights.
Vertical fire ventilation
Where the outlets are overhead the fire, often as high as possible in the building so that the flow of fire gases takes place vertically. The outlet is usually employed by creating an opening on the roof surface, or via existing vents (windows or vents/shutters).
Mechanical fire ventilation
This can primarily be used as either positive pressure ventilation or negative pressure ventilation. The mechanical ventilation must be combined with creating openings, so as to achieve horizontal or vertical ventilation.
designing mechanical ventilation systems to:
prevent or limit the spread of fire gases in the building
facilitate the firefighting operation.
Also mentioned were steps in designing a fire ventilation system :
Identify the design fire size and fire characteristics, expected smoke yield(s) for the fuel material(s), heat(s) of combustion, fire dimensions etc.
Prepare a qualitative analysis of worst case fires (at least one fire per zone is normally required). Identify the location of fire brigade entry points to enclosed parking levels and where dry risers etc. are located. How are fire fighters going to enter the building? Can we protect them by operating the ventilation system in a certain way?
Decide how far smoke is permitted to spread before being controlled. Normally 10 meters upstream of the fire is recommended.
Create an initial fan layout and zone strategy according to guidelines recommended by the building codes and / or fan manufacturer.
Mr. Svensson 5 concluded that the result of fire ventilation depends to a large extent on whether the fire is ventilation controlled or fuel controlled when the measure is implemented.
Mechanical ventilation systems can designed as follows:
• Supply air systems. Fans supply air through the ventilation ducts. The exhaust air is pressed out through gaps in the room or to adjoining rooms so the system creates positive pressure in the fire compartments.
• Exhaust air systems. Fans suck out air through the ventilation ducts. The supply air is drawn in through gaps in the room or from adjacent rooms and the system creates negative pressure in the fire compartments.
• Closed supply and exhaust air systems. Fans connected to the rooms, supply them with both supply air and exhaust air through ventilation ducts.
• Open supply and exhaust air systems. Fans connected to the rooms, supply them with both supply air and exhaust air through ducts. The exhaust air is also allowed to flow through gaps both to the surroundings and to adjoining rooms.
An example is shown in fig 13
1885950281305Fig 13 Mechanical Ventilation System
00Fig 13 Mechanical Ventilation System
System Operation replace with final system code
Main Objective : to reduce casualties in event of a fire .
Turn on LCD and display system monitoringRead gas sensor and flame sensor inputs
Case 1 lpg leak
If gas sensor value > 200ppm
Display gas detected on LCD ,
Turn on alarm
turn on led row 3 (alarm)
turn on stepper motor (close valve),
turn on fan while gas sensor value > 200ppm (to ventilate lpg or smoke)
turn on led row 1(gas sensor )
turn on led row 4 (fan)
else LCD display system monitoring
Case 2 electrical fire
If flame sensor = high
Display flame detected on LCD ,
Turn on Foam Spray
Turn on alarm
turn on led row 3 (alarm)
turn on fan
turn on led row 4 (fan)
else LCD display system monitoring
The Complete System Operation
In this section the connection of the circuits involved in the project are explained in the order of progress made during testing.
-266700441642500Using the MQ sensor to detect LPG gas is as follows. To communicate with the Mega 2560 either the digital pin D0 or the analog pin A0 can be used but we used the analog pin. The MQ2 is powered through it’s (+) by the 5V pin on the Mega 2560, the GND pin of the MQ2 is connected to any GND in the power section of the Mega 2560 and lastly the A0 pin is connected to the A0 pin on the Mega 2560. For now the microprocessor takes power from the PC via usb cable, upon uploading the code you should see the power POWERLED on the MQ2 turn on and when no gas it detected the output OUTLED will remains off meaning that analog output pin A0 will be written low. Keep in mind the preheat duration approximately 20 secs (mentioned in features above) before it can detect anything. Now we can expose the MQ2 to LPG and upon sensing it you should notice the OUTLED go high if not the potentiometer behind the module can adjust the sensitivity until the output gets high. Now every time sensor gets exposure to this gas at this particular concentration A0 will be high else it will remain low.
4057650307975Fig 14 MQ2 Connections
00Fig 14 MQ2 Connections
-1809753949700Using the KY-026 flame sensor to detect a flame is as follows. To communicate with the Mega 2560 the digital pin D0 was used. The flame sensor is powered through it’s (+) by the 5V pin on the Mega 2560, the G pin of the flame sensor is connected to any GND in the power section of the Mega 2560 and lastly the D0 pin is connected to the D2 pin(any other digital can work) on the Mega 2560. As with the MQ2 upon uploading the code you should see the power POWERLED on the flame sensor turn on and when no flame is in range the output OUTLED will remains off meaning that digital output pin D2 will be written low. Keep in mind the preheat duration approximately 20 secs (mentioned in features above) before it can detect anything. Now we can expose the MQ2 to LPG and upon sensing it you should notice the OUTLED go high if not the potentiometer behind the module can adjust the sensitivity until the output gets high. Now every time sensor gets exposure to any flame for up to 2 meters D0 will be high else it will remain low.
1743075208915Fig 14 KY-026 Connections
00Fig 14 KY-026 Connections
-949505165474900-1038225158115000-638175148951700-638175163830000Next we added a breadboard, buzzer as an alarm, an LCD to display system status and more importantly the stepper motor and ventilation fan. The MQ2 and the stepper motor function together in sequence so that when gas is detected the stepper can complete a full revolution representing turning off a gas supply. Similarly when the flame sensor detects a flame it will activate a foam spray then turn on a ventilation fan to extract smoke.
1 CITATION TNN16 l 1033 (TNN, 2016)2 CITATION Pre10 l 1033 (Press Trust of India, 2010)3 CITATION Vmo17 l 1033 (Vmoksha IoT Bootcamp, 2017)4 Atal Tinkering Lab Resources. 1/30/18. MQ-2 Gas Sensor ( Smoke detector ). Retrieved from HYPERLINK “http://tinkerfest.in/mq-2-smoke-sensor/” http://tinkerfest.in/mq-2-smoke-sensor/
5 Components101. (n.d). MQ2 Gas Sensor. Retrieved from HYPERLINK “https://components101.com/mq2-gas-sensor” https://components101.com/mq2-gas-sensor
6 BDC. (n.d). The Basics Of Flame Sensors. Retrieved from http://www.gobdc.com/basics-flame-sensors/7 AZO Sensors. 7/3/17. A Guide to Optical Flame Detection – How UV, IR and Imaging Detectors Work. Retrieved from https://www.azosensors.com/article.aspx?ArticleID=8158 STRIKEFIRST USA. (2016). Class C Fire Extinguishers: For Electrical Fires Retrieved from http://www.strikefirstusa.com/2016/06/class-c-fire-extinguishers-electrical-fires/
9 The Fire and Safety Centre. (2017). Fire Extinguisher Usage Guide. Retrieved from https://www.fireandsafetycentre.co.uk/advice-centre/fire-extinguisher-chart/10 Capital Fire Protection LTD. (n.d). The ABC’s of Fire Extinguishers. Retrieved from https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=4&ved=2ahUKEwinrKDvtZPcAhUO3VMKHfm-AyMQFjADegQIARAO&url=https%3A%2F%2Fwww.uregina.ca%2Fhr%2Fhsw%2Fassets%2Fdocs%2Fpdf%2FEmergency-Management%2FThe-ABCs-of-Fire-Extinguishers.pdf&usg=AOvVaw2peZYbQxsl58yEtYwKJB3e11 Mega 2560 User Manual
12 Wikipedia contributors. (2018, June 14). I²C. In Wikipedia, The Free Encyclopedia. Retrieved 02:10, July 11, 2018, from https://en.wikipedia.org/w/index.php?title=I%C2%B2C&oldid=845797753