GAS LEAKAGE DETECTION SYSTEM By Martin C. Mbae COM/B/01-02160/2016 For the award of Bachelor’s Degree in Computer Science Masinde Muliro University of Science and Technology SCHOOL OF COMPUTING AND INFORMATICS Department of Computer Science June 2020 Acknowledgements The success of this project would not be without the help I received from lecturers and my fellow students. I would like to express special thanks to the University’s School of Computing and Informatics for their decision to invite an Internet of Things(IoT) team whom without, I would not have done this project. I would also like to express thanks to students who helped me research on the project and gauge the possibility of its implementation. I acknowledge my parents and siblings who gave me a quiet time to work and test on this project. And great thanks to God Almighty for bringing this idea to a reality. i Abstract In most developing countries, like Kenya, people are starting to appreciate the ease of cooking using gas cookers. Many people have therefore started using these gas cookers. Though these gas cookers make it easy and quick to cook, they can also be likened to a ticking time bomb. A little leakage and they can easily cause deaths or catastrophic damages. It is to curb this problem that I decided to come up with a system that can automatically detect gas leakage in a house and alert the user about the leakage. ii Table of content. 1 Chapter 1: INTRODUCTION ..................................................................... 1 1.1 Introduction ................................................................................................ 1 1.2 Statement of the problem ........................................................................... 2 1.3 Main aim of the project .............................................................................. 3 1.4 Objectives of the project ............................................................................ 4 1.5 Research questions ..................................................................................... 5 1.6 Scope of the project .................................................................................... 6 1.7 Limitations of this system .......................................................................... 7 1.8 Project justification .................................................................................... 8 2 Chapter 2: LITERATURE REVIEW .......................................................... 9 2.1 Introduction ................................................................................................ 9 2.2 Effects of gas leakages. ............................................................................ 11 2.3 What causes these gas leakages? .............................................................. 12 2.4 Existing System ........................................................................................ 13 2.5 Weakness of the current system ............................................................... 13 2.6 How does this system work? .................................................................... 14 2.7 Advantages of this system over the current system ................................. 14 2.8 Areas of application of the new system. .................................................. 15 2.8.1 Underground Parking ........................................................................ 15 2.8.2 Nuclear power plants:........................................................................ 15 2.8.3 Laboratories ....................................................................................... 15 2.8.4 Homes................................................................................................ 16 2.8.5 Hospitals ............................................................................................ 16 iii 3 Chapter 3: METHODOLOGY .................................................................. 17 3.1 Target Users ............................................................................................. 17 3.2 Hardware requirements ............................................................................ 17 3.2.1 Arduino UNO .................................................................................... 18 3.2.2 LPG Gas Sensor module ................................................................... 19 3.2.3 Buzzer................................................................................................ 20 3.2.4 Transistor........................................................................................... 21 3.2.5 LCD ................................................................................................... 22 3.2.6 Resistor .............................................................................................. 22 3.2.7 Bread Board....................................................................................... 23 3.2.8 Jumper cables .................................................................................... 24 3.2.9 Gas Lighter ........................................................................................ 24 3.3 Software Requirements ............................................................................ 26 4 Chapter 4: Front-End Design and Development ....................................... 27 4.1 How does the mobile application work? .................................................. 27 4.2 Mobile Application Screenshots .............................................................. 28 5 Summary ................................................................................................... 32 5.1 Advantages of the system......................................................................... 32 5.2 Weaknesses of the system ........................................................................ 33 5.3 Possible Improvements on the system ..................................................... 34 5.4 Conclusions .............................................................................................. 35 6 References ................................................................................................. 36 iv Table of figures Figure 1Arduino UNO .................................................................................... 18 Figure 2MQ5 Sensor ....................................................................................... 19 Figure 3Potentiometer ..................................................................................... 19 Figure 4 Buzzer ............................................................................................... 20 Figure 5 Transistor .......................................................................................... 21 Figure 6 LCD .................................................................................................. 22 Figure 7 Resistor ............................................................................................. 22 Figure 8 Breadboard ....................................................................................... 23 Figure 9 Jumper Cables .................................................................................. 24 Figure 10 Gas Lighter ..................................................................................... 24 Figure 11 Final Set up ..................................................................................... 25 Figure 12 Mobile app without connection to sensor ....................................... 28 Figure 13 Mobile app when connected to sensor........................................... 29 Figure 14 Notification sent when Gas leakage is detected ............................. 30 Figure 15Notification sent when there is no more gas leakage ...................... 31 v Abbreviations USA – United States of America CO/NO2 – Carbon Monoxide or Nitrogen gas ICU – Intensive Care Unit IoT – Internet of Things vi 1 Chapter 1: INTRODUCTION 1.1 Introduction The world is changing fast. Everything from the way we dress, to how we travel, to how we sleep, to how we socialize is changing. A look at hundred years ago and the collective change in the way things are done is unbelievable. A look at our African culture one cannot miss to see the fast acceptance and incorporation of technology into our day to day lives. To be a bit specific, this project is mainly concerned with the change in the way of cooking in our African society. Long gone are the days when cow dung was the best known fuel used in most of our homes. Gone are the days when fire would be ‘borrowed’ from neighbors as starting a fire was an unimaginable task. We are now living in a transitioning phase, where most people are either using firewood as their main source of fuel or gas cookers. In most home a combination of these methods are mainly used. On this project I am going to focus more on the rise of use of gas cookers in our homes. Almost every home in the urban and rural areas is now using gas cookers to cook their food. This has been a great change and proof that we as a community are progressing. Gas cookers have come with quite a number of advantages including but not limited to; Helps to start fire quickly Faster cooking of food Reduction of smoke in the house compared to the older methods Saving of space dedicated to cooking Clean appeal in the house. 1 1.2 Statement of the problem Regardless of all the above mentioned advantages that gas cookers have come with, they have also brought with a portion of disadvantages. The major disadvantage is the expose to danger that this cookers bring. Unlike the other olden methods, the possibility of death as a result of fuel has risen drastically. The Kenyan Daily Nation once wrote an article and referred to these gas cookers as a ticking time-bomb. Almost all of the accidents caused by these cookers can all be traced down to gas leaking. Gas leaking is such a major problem that even most gas companies spend lots of resources adding a pungent smell into the odorless methane gas to help users easily smell if there is any gas leakage. The sad thing is that even with this change, gasses still leak. Luckily most gas leakages happen when users are around their homes. They are able to learn of the leakages by the smell of the gas and quickly rectify the problem. In some cases, when the users are not around their homes, these leakages are not noticed and inevitably ends up causing huge damages. The leakages can also happen when the users are around but they fail to notice about it. In this case, the risk also involves death. 2 1.3 Main aim of the project Having learnt the dangers that these gases cookers come with, and knowing how fatal a simple leakage can be, I decided to develop a system that can automatically and with no human-intervention detect occurrences of gas leakage in homes and warn the users in advance. This document will explain the development and design of a gas detecting system that can be used at our home or offices. 3 1.4 Objectives of the project i. Develop a gas sensor linked to database – For the above to work, I need to develop a system that can be able to sense when there is gas leaking. The system should also be linked to a database. ii. Design and develop an android application and link it to database – This android application will be linked to the same database that the gas sensor will be linked to. The mobile application will be the link between the user and the system. The app will receive notifications and warning from the gas sensor system. 4 1.5 Research questions By the end of this project, this project should provide the answer to the following research questions; i. Is there an existing method to detect gas leakages? ii. If there is, what are the limitations of the existing system? iii. Is my project going to solve the limitations of the existing system? iv. What are the strong points of my project? v. What are the weaknesses of my project? vi. What are the possible future advancements of my project? 5 1.6 Scope of the project This project is to develop a fully working gas leakage sensor with an alert system connected to the phone. By the end of this project there will be and android app for showing notifications, a database to store gas level history and a physical sensor that will continuously keep sensing for gas level changes. In addition to the above, there will be an alert system that will contain trigger an alarm to indicate that there is gas leakage. The development of the above consumed about six weeks 6 1.7 Limitations of this system The gas leakage detecting system that is discussed in this document has the following limitations. i. The system cannot prevent leakage – This system is only able to detect when there is gas leakage. The system is not able to directly prevent leakage of the gas. ii. The system cannot rectify gas leakage – Just like in the above case, when this system detects the occurrence of gas leakage, It cannot do anything about it except warn the users to check the problem. This system is not equipped with the mechanical ability to turn off a gas during leaking. iii. This system is not specific – Assuming that this system is installed in a house that has several gas cookers, in the case of leakage, this system does not have the capacity to pinpoint to one gas cooker that is leaking. It is upon the user to check the actual cause of leakage. iv. This system is WI-FI dependent – As shall be later observed the detectors used in this project need WI-FI to communicated to the database. Without wifi this communication will not be possible. 7 1.8 Project justification As previously discussed, gas leakage is a growing concern in most of our homes. The loss and danger that can be caused as a result of leakage is enormous. This project comes with a possible solution to this possible catastrophe. The solution will not only help save lives but also save on the cost of gases by reducing gas wastage. 8 2 Chapter 2: LITERATURE REVIEW 2.1 Introduction Gas Leakage Detection System is a system developed to alert users once the system detects gas leakage in the house. The system can also be modified to detect gas leakage in pipes carrying methane gas. In some developed nations like the USA and China, the largest sources of air pollution are natural gas and leaking petroleum systems. Globally, these two are the second largest sources of air pollution. Natural gas is mainly made up of Methane gas which is about forty percent more powerful than carbon dioxide. Due to this composition, natural gas becomes one of the most destructive component of greenhouse gas. The complex and complicated network of gas and fuel pipelines continue to leak worldwide on daily basis and release all this harmful gasses to the atmosphere. Detecting these leakages is very hard mainly due to the fact that most leakages are only detected by their smell. Leakages that are located in places with sparse population are hard to detect. It becomes even harder to detect these leakages if the leakage is of pure unaltered natural gas which has no smell. Most of these leakages are not harmful save for their contribution to the greenhouse gasses. However, some leakages may end up being catastrophic. Several incidences have shaken the world simply due to the leakage of this gases. In USA for example, an explosion which claimed the lives of about three hundred people in the late 1930s was caused by gas leakage. Most of the victims were pupils as the explosion happened in a school. In another instance, close to a hundred people lost their lives in the year 2011 after a pipeline which was carrying gas leaked before exploding. The infamous Bhopal catastrophe left about four thousand people dead and many more were left without homes thanks to gas leakage. Still on gas related tragedies, the well known Vishakhapatnam refinery tragedy left a death toll of about thirty people and left many with minor and major injuries. 9 The nature and amount of loss caused by these gas leakages is overwhelming. There is a need to come with ways of detecting these leakages before the situation goes out of hand. This will help in save lives by minimizing the frequencies of these accidents. In the case of the above explained Vishakhapatnam refinery tragedy, a leakage detection system had been installed. The sensor system was very mechanical and an interconnection of wires was used to send messages to the control room. In the day of the explosion the large interconnection of wires had gotten damaged by Though a gas and fire detection system was present which is connected to the sensors using large number of wires that run from the control room to various plant areas. On the day the catastrophe happened, the wires had unfortunately gotten damaged and although the gas leakage was well sensed, information never reached the control room which in turn would have alarmed the authorities in time and the catastrophe could have been avoided. A proper sensing system should therefore be wide and consider a wide range of possibilities. In my view, a good leakage detecting system should both have mechanical ways of sending warning e.g. Wires as well as wireless method of sending alarming message. This will prepare the system to have a backup way in case one of the ways is not available. Back the above case of Vishakhapatnam refinery tragedy, after the mechanical system had failed, a wireless system would have detected the failure and as a backup the information about the leakage would have been sent via internet. Maybe the tragedy could not have happened. 10 2.2 Effects of gas leakages. These leakages are economically expensive. The amount of fuel lost due to leaking can only be quantified in tonnes. A tonne of harmful gas in the air contributes to more serious problems which include but not limited to: Acid rain which corrodes metal and iron sheets Greenhouse effect Decreased quality of air Air related ailments like asthma and bronchitis In addition to the cost incurred, the leakages cause death in case of an explosion. The situation is worse when an explosion kills the bread winners of the family. Children left will suffer hunger and sometime lack basic needs like education which they would have gotten. These explosions do not only kill but also leaves scores injured in hospitals. People are displaced from their homes due to these explosions. 11 2.3 What causes these gas leakages? Gas leakages mainly occur in pipes ferrying the gas. Gas is mainly ferried across by pipeline systems because this mode of transportation has proven beyond doubt to be the fastest and safest way of transporting this explosive gasses compared to any other mode of transport. However, the pipeline system comes with a number of challenges. The major challenge of this mode is that the pipes that carry this gas deteriorates little by little over time. As this deterioration continue so does the rate of corrosion accelerates. This increases the chances of failure of the pipes due to fatigue cracking. The fatigue cracks then provide paths for the gas to escape considering the fact that this gas is pumped into this pipes under pressure. This creates a need for regular inspection of this pipes. In the cases when this regular inspection is not available, the pipeline system loses its integrity over time. 12 2.4 Existing System Currently gas leakage is detected mainly when in under large scale. Companied that fill and process gas have made complicated sensors that are able to alert workers when there is gas leakage. However, in small scale usage of gas, there is little to no way of detecting gas leakages. In most ways gas leakage is only detected by its smell. 2.5 Weakness of the current system The current sensing of gas leakage in homes is so questionable. By relying only on the smell of the gas, it then requires that a person be always around. This is dangerous and cannot be relied on always. 13 2.6 How does this system work? The aim of this project is to develop a gas leakage detector for homes. The system is based on Arduino sensors. The sensors will be attached in strategic positions in homes and will keep reading the gas concentration levels of the place. These readings are then sent to a database in real-time. Once the data has been saved in the database, an android system that is also connected to the system reads the values and determines if the gas concentration is normal. In cases when the gas concentration exceeds the optimal values, the android quickly notifies the user about the leakage detected. Consequently, an alarm system that is located in the user’s house will quickly go off and anyone near can then fix the leakage. If the leakage has been rectified, the system will the detect that there is no more leakage and the alarm system will not turn off and a message is sent to the user informing them that the leakage previously detected has been solved. The paper has three parts, first, gives the overall system design, and then provides the approaches on both hardware and software to achieve it. 2.7 Advantages of this system over the current system This new system is installed close to the gas cooker. It therefore eliminates the need of a person to be always available. It works regardless of the distance. In times when gas may be leaking and the user is not around, this new system will still alert them regardless of their physical location. 14 2.8 Areas of application of the new system. This new system can be applied in different areas. Below are a few areas where this system can be applied in: 2.8.1 Underground Parking In the area of underground car parks, gas detection is useful to regulate and maintain the flow and measurement of CO/NO2. Cars in these parking are left for long and they may react with the available gasses. Installation of gas sensors will inevitably contribute to having an ideal car park and prevent erosive of the car by reactive gasses. 2.8.2 Nuclear power plants: Most combustions in nuclear plants use flammable gasses as their fuel. The containers that hold these gasses may leak and cause wastage of gases or even explosions. To reduce the chances of this happening gas sensors can be installed in this areas. 2.8.3 Laboratories Gas leakages in laboratories can be fatal. Gas detectors can be installed in laboratories to detect and alert laboratory technicians if there is any kind of gas leakage. 15 2.8.4 Homes Most urban homes and a few rural homes rely solely on gas for their household activities. The dangers that these gas cookers bring can cause huge damages. Installing of gas leakage sensors will highly reduce the possible risk. 2.8.5 Hospitals The ICU department of many hospitals uses gas tanks to store the much needed oxygen for their patients. Leakage of these gases can not only be expensive but also may lead to death of the patients. These facilities may highly need to have gas leakage detector sensor. 16 3 Chapter 3: METHODOLOGY 3.1 Target Users During the development of this project, I aimed at making it as simple as possible to enable any person who uses gas cookers to understand and use the system effortlessly. This project requires little or no training for users to start using it. On the other hand, users who may want to use this system to detect for the presence of any other gas apart from methane can accomplish it by simply replacing a few sensors. To develop and implement this project, I needed both hardware and software components. 3.2 Hardware requirements Gas leakage detection system is an IoT project and required a lot of hardware components. Below is a list of the components I used to come up with this project; Arduino UNO LPG Gas Sensor Module Buzzer Transistor LCD 1K Resistor Bread Board 9 Voltage Battery Jumper Cables Lighter 17 3.2.1 Arduino UNO Arduino is a small computer that can be programmed. Arduino is made of a circuit board called a microcontroller. To program this board I preferred to use the Arduino IDE. Arduino IDE is used to write Arduino codes as it able to convert the code to binary and upload the code to the Arduino board which then executes the code Below is an image of Arduino Board UNO. Figure 1Arduino UNO 18 3.2.2 LPG Gas Sensor module The actual devices that do the sensing of the LPG gases are collectively called the LPG Gas Sensor Module. The components of this module are: MQ5 Sensor – The MQ5 sensor is the sensor that actually detects the presence of LPG gas in the air. Figure 2MQ5 Sensor A potentiometer – potentiometer is a knob that controls the sensitivity of the entire project. Figure 3Potentiometer 19 3.2.3 Buzzer In this project, the Buzzer acts as an alarm to inform the user of any Gas leakage. The buzzer simply makes noise with varying frequencies. Figure 4 Buzzer 20 3.2.4 Transistor A transistor amplifies electrical power. Transistors are based on semi-conductor and has three terminals. Transistor will regulate the power supply to the Arduino board as well as the buzzer and MQ5 components Figure 5 Transistor 21 3.2.5 LCD This project will use LCD to display the gas levels to the users. LCD is a simple screen that displays digits and words using the digital logic. Figure 6 LCD 3.2.6 Resistor A resistor is useful in introducing electric resistance in a circuit. Resistor would be useful in this project to regulate the current flowing in the sensor components. Figure 7 Resistor 22 3.2.7 Bread Board Breadboard makes electrical connection easily between small components. Since this is not a permanent project, I decided to use a breadboard for connections. The breadboards also helped me test different scenarios and replicate different environments. Figure 8 Breadboard 23 3.2.8 Jumper cables I used Jumper cables to make the necessary connections for my project. Jumper cables have male and female ends and are therefore easy to use. Figure 9 Jumper Cables 3.2.9 Gas Lighter A gas lighter was used as the source of Gas leakage. Figure 10 Gas Lighter 24 Final setup Figure 11 Final Set up 25 3.3 Software Requirements The development of this project required the following software components; Android Studio – Used during the development of a front-end mobile application that the user will be able to interact with. Arduino IDE – The Arduino Uno microcontroller needs to be programmed using the Arduino IDE. Firebase Database – This is an online database that stores gas level measurements in realtime. 26 4 Chapter 4: Front-End Design and Development After developing a sensor, there was a need to be a simpler way for a user to understand the system. I developed a mobile application in Android that the user will interact with to understand the system. 4.1 How does the mobile application work? The previously discussed sensor keeps on taking the gas level in a house and sending the values to a database that is located in a web server. This process is continuous and automatic. The mobile application is then linked to the same database and it keeps reading the values being added to the database. The optimal value for the gas is then set. For this project the optimal gas level of methane level in air is set to be 250. The sensors used are very accurate and at 250 there is no danger. The mobile application is then provided with the danger line value which for my case was 300. Anytime the gas level reaches 300 the alarm goes off and the user is notified via a notification in their phone. 27 4.2 Mobile Application Screenshots Figure 12 Mobile app without connection to sensor 28 Figure 13 Mobile app when connected to sensor 29 Figure 14 Notification sent when Gas leakage is detected 30 Figure 15Notification sent when there is no more gas leakage 31 5 Summary 5.1 Advantages of the system Below are the advantages of using the above system: Save the cost of fuel – By alerting the user about gas leakages, the user will at the long-run save the amount they spend on gas. Improve safety in houses – Having a system that is able to detect when there is gas leakage and takes action to savor the problem will highly improve the safety of the houses. Improve confidence – Users of this system who work away from home will find it easy to confirm whether they turned off their gas cookers by simply looking at their phone. This will help clear any doubt that they might have. 32 5.2 Weaknesses of the system Regardless of the efficiency of this system, it is limited in a number of ways. Below are the main limitations of this system. The system is unable to solve gas leakage without human intervention. This system is just able to detect if there are any gas leakages. The system is not able to turn off the gas that is leaking. Non-specific – Assuming that a user has several gas cookers in their home, this system is not able to identify the single gas that is leaking. It is upon the user to check all the gas cookers in the house and identify the one that needs rectification. 33 5.3 Possible Improvements on the system This project requires several adjustments in the future to improve it. These adjustments include but not limited to; Enabling the system to turn off the gas leakage without human intervention. Enable it to detect a range of many gas. Currently, the system is only able to detect LPG gases. 34 5.4 Conclusions This project is developed to detect gas leakages at homes. The system aims at creating safety environments in homes and also save the costs that are incurred thanks to leakages. Gas leakage detection system is developed to reduce the chances of gas explosion as a result of leakage. The main role of this project is to detect gas leakages early enough and alert the users before an accident occurs. 35 6 References i. https://www.circuitstoday.com/gas-leakage-detector-using-arduino-with-sms-alert ii. https://www.standardmedia.co.ke/article/2000043676/scores-hospitalised-after-a-gasleakage iii. https://www.kimessa.com/applications/ iv. https://circuitdigest.com/microcontroller-projects/arduino-based-lpg-gas-leakagedetector-alarm 36