Gas Leakage Detection System using 8051

In this Tutorial we are going to see Gas Leakage Detection System using 8051.

Gas Leakage Detection System using 8051

Abstract

Gas leakage tragedies and accidents have led to heavy losses over the years. So it is very important to detect any gas leakage and prevent any accidents. So here we propose a system to detect LPG gas leakage scenarios and provide a security alert to intended users.

SMS based LPG gas leakage detection system using GSM has application in various areas like home, industries, hotels, hospitals. This project has a gas leakage detector implemented by using an LPG Gas sensor. The user can get remote indication through SMS sent from the project. This SMS is sent from GSM modem which is connected to the microcontroller. A buzzer is turned on after LPG gas leakage so it acts as a gas leakage alarm.

Components Required

  • 8051 Development board
  • LCD Module
  • GSM Module
  • Gas Sensor
  • Buzzer
  • ADC0804
  • Relay

Software Required

  • Keil IDE

Prerequisites

Before see the code, first you can see the basic interfacing tutorials of these components.

Block Diagram

Gas Leakage Detection System using 8051

Explanation

  • Gas sensor is used to detect the Gas, which is connected to 8051 micro controller through ADC0804.
  • LCD is used to Display the Gas level and Relay status.
  • GSM is used to send the message when it detects the Gas in room or home.
  • Buzzer also make sound when controller detects any Gas.
  • Relay also connected to Micro Controller. The house’s electricity power will go through this relay. When it detects gas leakage, the relay goes off. So house electricity will be off. It will prevent the other damages by electricity.

Circuit Diagram

LCD:

  • RS – P3.7
  • RW – GND
  • EN – P3.6
  • Data lines – P1

Gas Sensor:

  • Output – ADC’s Vin (6th Pin)

ADC0804:

  • RD – P0.7
  • WR – P0.6
  • INTR – P0.5
  • CS – GND
  • Data Lines – P2

GSM:

  • GSM RX – P3.1
  • GSM TX – P3.0

Buzzer: P0.1

Relay: P0.0

Code

Here I’ve added only the main code. Header files are not here. You can download the full code Here.

#include<reg52.h>
#include"LCD.h"			   //rs=p3.7, en=p3.6
#include"GSM.h"

#define NUM "1234567890"    //Enter Your Mobile Number

sbit rd=P0^7;
sbit wr=P0^6;
sbit intr=P0^5;

sbit RELAY=P0^0;
sbit buzz=P0^1;


unsigned char h,msgq;
unsigned int s,r;
void adc();

unsigned char adc_data=0;

void main()
{

	init_serial();
	LCD_initialise();
	RELAY=1;			//relay on
	buzz=0;				//buzz on
	comwrt(0x80);
	display("LOADING.");
	for(h=0;h<8;h++) {
		datawrt('.');
		for(s=0;s<30000;s++);
	}
	P2=0xFF;
	comwrt(0x80);
	display("GAS:000PPM R:OFF");
	buzz=0;
	for(r=0;r<=10000;r++);

	while(1) {
		adc();
		for(r=0;r<=20000;r++);			
	}
}


void adc()
{
wr=0;
rd=1;
wr=1;
while(intr==1);
rd=0;
adc_data = P2 ;

msgq = adc_data;

	comwrt(0x84);
	datawrt((msgq/100)+0x30);
	datawrt(((msgq/10)%10)+0x30);
	datawrt((msgq%10)+0x30);
	
	if(msgq > 80) {
		RELAY=0;			   //relay off
		buzz=0;				   //buzz on
		comwrt(0x8D);
		display("OFF");
		
		comwrt(0xC0);
		display("G:HIGH   V:CLOSE");
		for(s=0;s<60000;s++);
		comwrt(0xC0);
		display("SENDING MSG.....");
		
		sendSMS(NUM,"VOLVE CLOSED AND POWER DISCONNECTED DUE TO GAS LEAKAGE!");
		for(s=0;s<30000;s++);
		comwrt(0x80);
		display("GAS:");
		comwrt(0x8b);
		display("R:");
	} else {
		comwrt(0xC0);
		display("G:NORMAL V:OPEN ");
		RELAY=1;		 //relay on
		buzz=1;			 //buzz off
		comwrt(0x8D);
		display("ON ");	
	}
}

Explanation

  • Gas sensor detects the gas leakage in home. This value is analog. So we need to connect ADC to convert Digital.
  • If Gas level is high, micro controller turns OFF the Relay to cut electricity. The ON the buzzer. Finally it sends the message to house owner about gas leakage using GSM.
5 1 vote
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
2
0
Would love your thoughts, please comment.x
Ads Blocker Image Powered by Code Help Pro
Ad Blocker Detected!!!

It seems you are using adblocking software that prevents the page from fully loading.

The revenue we earn by advertisements is used to manage this website. Still, If you want to disable the ads, please become a premium member. Ads are disabled for Premium members.

Or please add www.embetronicx.com to your ad blocker whitelist or disable your adblocking software and reload the page.

Note: Please disable the ad blocker to access the membership pages also.

False Detection? Please write a mail to [email protected]

 
Refresh