Top Banner
CHAPTER 1 INTRODUCTION Safety is prime concern in day-to-day life. Everyone wants to be as much as safe as to be possible. A GSM natural gas monitoring system is microcontroller based project. This system is used to detect dangerous gas leaks in the kitchen or near the gas heater. This unit detects 300 to 5000ppm of Natural Gas. Ideal to detect dangerous gas leaks in the kitchen. Sensor can be easily configured as an alarm unit. The sensor can also sense LPG and Coal Gas. Ideal sensor use for to detect the presence of a dangerous LPG leak in your car or in a service station, storage tank environment. This unit can be easily incorporated into an alarm unit, to sound an alarm or give a visual indication of the LPG concentration. The sensor has excellent sensitivity combined with a quick response time. Detected is messaged to the authorized person using cellular network called GSM. The system comprises a small electronic unit with a gas sensor, which infixed near gas pipeline or heater. When a gas leakage occur gas sensor detect leaks which sent signal to microcontroller. A microcontroller will sent SMS to authorized person with customer ID through GSM modem. GSM modem use AT command set for sending and receiving SMS and getting modem status. This unit also give visual indication and on alarm to inform nearby people. The main 1 | Page
63
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Report

CHAPTER 1

INTRODUCTION

Safety is prime concern in day-to-day life. Everyone wants to be as much as safe as to

be possible. A GSM natural gas monitoring system is microcontroller based project.

This system is used to detect dangerous gas leaks in the kitchen or near the gas heater.

This unit detects 300 to 5000ppm of Natural Gas. Ideal to detect dangerous gas leaks in

the kitchen. Sensor can be easily configured as an alarm unit. The sensor can also sense

LPG and Coal Gas. Ideal sensor use for to detect the presence of a dangerous LPG leak

in your car or in a service station, storage tank environment. This unit can be easily

incorporated into an alarm unit, to sound an alarm or give a visual indication of the LPG

concentration. The sensor has excellent sensitivity combined with a quick response

time. Detected is messaged to the authorized person using cellular network called GSM.

The system comprises a small electronic unit with a gas sensor, which infixed near gas

pipeline or heater. When a gas leakage occur gas sensor detect leaks which sent signal

to microcontroller. A microcontroller will sent SMS to authorized person with customer

ID through GSM modem. GSM modem use AT command set for sending and receiving

SMS and getting modem status. This unit also give visual indication and on alarm to

inform nearby people. The main aim of this project is to provide safety at homes,

offices etc. The system automatically detect gas leaks sent a predefined message from

the customer .This project uses the wireless communication, GSM. To send the

messages from the customer premises, we need a GSM modem. This modem will be

interfaced to the microcontroller through serial interface. A modem provides the

communication interface. It transports device protocols transparently over the network

through a serial interface. A GSM modem is a wireless modem that works with a GSM

wireless network. A wireless modem behaves like a dial-up modem. The main

difference between them is that a dial-up modem sends and receives data through a

fixed telephone line while a wireless modem sends and receives data through radio

waves.

1 | P a g e

Page 2: Report

CHAPTER 2

OBJECTIVE OF THE PROJECT

The project intends to interface the microcontroller with the GSM modem. And

automatically detect gas leaks by gas sensor. The GSM modems send the predefined

messages to the customer and emergency helpline. The project uses the GSM

technology and Embedded Systems to design this application. The main objective of

this project is to design a system that continuously checks the gas leakages if any, then

sent message emergency helpline line numbered with customer address and contact

number. This project is a device that collects signal from the sensor circuit, control unit

give command to modem to sending message through cellular network. The project is a

microcontroller based gas leakages monitoring system. It consists of a GSM modem,

microcontroller, the interfacing unit to allow the communication between the

microcontroller and mobile and the required circuitry.

2.1. Background of the Project

The software application and the hardware implementation help the microcontroller

read the signal from sensor circuit and give command to modem send messages to the

customer mobile phone through the cellular network and accordingly change the status

of the sensor. The measure of efficiency is based on how fast the microcontroller can

detect the gas leakages sent message to emergency helpline with customer address and

contact number. The system is totally designed using GSM and embedded systems

technology. The Controlling unit has an application program to allow the

microcontroller sent the customer information through the modem. The performance of

the design is maintained by controlling unit.

CHAPTER 32 | P a g e

Page 3: Report

OVERVIEW OF TECHNOLOGIES USED

3.1. Embedded Systems

An embedded system can be defined as a computing device that does a specific focused

job. Appliances such as the air-conditioner, VCD player, DVD player, printer, fax

machine, mobile phone etc. are examples of embedded systems. Each of these

appliances will have a processor and special hardware to meet the specific requirement

of the application along with the embedded software that is executed by the processor

for meeting that specific requirement. The embedded software is also called “firm

ware”. The desktop/laptop computer is a general purpose computer. You can use it for

a variety of applications such as playing games, word processing, accounting, software

development and so on. In contrast, the software in the embedded systems is always

fixed listed below:

Embedded systems do a very specific task; they cannot be programmed to do different

things. Embedded systems have very limited resources, particularly the memory.

Generally, they do not have secondary storage devices such as the CDROM or the

floppy disk. Embedded systems have to work against some deadlines. A specific job

has to be completed within a specific time. In some embedded systems, called real-time

systems, the deadlines are stringent. Missing a deadline may cause a catastrophe-loss of

life or damage to property. Embedded systems are constrained for power. As many

embedded systems operate through a battery, the power consumption has to be very

low. Some embedded systems have to operate in extreme environmental conditions

such as very high temperatures and humidity.

Following are the advantages of Embedded Systems:

1. They are designed to do a specific task and have real time performance constraints

which must be met.

2. They allow the system hardware to be simplified so costs are reduced.

3. They are usually in the form of small computerized parts in larger devices which

serve a general purpose.

3 | P a g e

Page 4: Report

3.2 The Evolution of Mobile Telephone Systems

Cellular is one of the fastest growing and most demanding telecommunications

applications. Today, it represents a continuously increasing percentage of all new

telephone subscriptions around the world. Currently there are more than 45 million

cellular subscribers worldwide, and nearly 50 percent of those subscribers are located

in the United States.

The concept of cellular service is the use of low power transmitters where frequencies

can be reused within a geographic area. The idea of cell based mobile radio service was

formulated in the United States at Bell Labs in the early 1970s. Cellular systems began

in the United States with the release of the advanced mobile phone service (AMPS)

system in 1983. The AMPS standard was adopted by Asia, Latin America and Oceanic

countries, creating the largest potential market in the world for cellular. Ref [3]

In the early 1980s, most mobile telephone systems were analog rather than digital, like

today's newer systems. One challenge facing analog systems was the inability to handle

the growing capacity needs in a cost efficient manner. As a result, digital technology

was welcomed.

The advantages of digital systems over analog systems include ease of signaling, lower

levels of interference, integration of transmission and switching and increased ability to

meet capacity demands. The table below shows the worldwide development of mobile

telephone systems.

4 | P a g e

Page 5: Report

CHAPTER 4

HARDWARE IMPLEMENTATION OF PROJECT

This chapter briefly explains about the Hardware Implementation of the project. It

discusses the design and working of the design with the help of block diagram and

circuit diagram and explanation of circuit diagram in detail. It explains the features,

timer programming, serial communication, interrupts of P89V51RB2 microcontroller.

Ref [4] It also explains the various modules used in this project.

4.1 Project Design

The implementation of the project design can be divided in two parts.

1. Hardware implementation

Gas sensor

Microcontroller

LCD display

GSM Modem

MAX 232

Comparator

2. Software tool

Keil software programming using C language

Flash magic

Eagle software for PCB Design

Proteous 7 Software for simulation

Hardware implementation deals in drawing the schematic on the plane paper according

to the application, testing the schematic design over the breadboard using the various

IC‟s to find if the design meets the objective, carrying out the PCB layout of the

schematic tested on breadboard, finally preparing the board and testing the designed

hardware.

5 | P a g e

Page 6: Report

The firmware part deals in programming the microcontroller so that it can control the

operation of the IC‟s used in the implementation. In the present work, we have used the

Eagle design software for PCB circuit design, the Keil μv3 software development tool

to write and compile the source code, which has been written in the C language. Ref [9]

The Flash magic has been used to write this compile code into the microcontroller. Ref

[12] the firmware implementation is explained in the next chapter.

The project design and principle are explained in this chapter using the block diagram

and circuit diagram. The block diagram discusses about the required components of the

design and working condition is explained using circuit diagram and system wiring

diagram.

4.2 Block Diagram of the Project and its Description

Fig.1 block diagram of GSM based natural Gas monitoring system

6 | P a g e

Page 7: Report

4.2.1 Power Supply

The input to the circuit is applied from the regulated power supply. The AC input i.e.

230V from the mains supply is step down by the transformer to 12V and is fed to a

rectifier. The output obtained from the rectifier is a pulsating DC voltage. So in order to

get a pure DC voltage, the output voltage from the rectifier is fed to a filter to remove

any AC components present even after rectification. Now, this voltage is given to a

voltage regulator to obtain a pure constant DC voltage.

Fig-2 Power supply

TransformerUsually, DC voltages are required to operate various electronic equipment and these

voltages are 5V, 9V or 12V. But these voltages cannot be obtained directly. Thus the

AC input available at the mains supply i.e. 230V is to be brought down to the required

voltage level. This is done by a transformer. Thus, a step down transformer is employed

to decrease the voltage to a required level.

7 | P a g e

Page 8: Report

Rectifier The output from the transformer is fed to the rectifier. It converts AC. into pulsating

DC. The rectifier may be a half wave or a full wave rectifier. In this project, a bridge

rectifier is used because of its merits like good stability and full wave rectification.

Filter Capacitive filter is used in this project. It removes the ripples from the output of

rectifier and smooths the DC. Output received from this filter is constant until the

mains voltage and load is maintained constant. However, if either of the two is varied,

DC voltage received at this point changes. Therefore a regulator is applied at the output

stage.

Voltage regulator As the name itself implies, it regulates the input applied to it. A voltage regulator is an

electrical regulator designed to automatically maintain a constant voltage level. In this

project, power supply of 5V and 12V are required. In order to obtain these voltage

levels, 7805 and 7812 voltage regulators are to be used. The first number 78 represents

positive supply and the numbers 05, 12 represent the required output voltage levels.

8 | P a g e

Page 9: Report

4.2.2 Microcontroller

Microprocessors and microcontrollers are widely used in embedded systems products.

Microcontroller is a programmable device. A microcontroller has a CPU in addition to

a fixed amount of RAM, ROM, I/O ports and a timer embedded all on a single chip.

The fixed amount of on-chip ROM, RAM and number of I/O ports in microcontrollers

makes them ideal for many applications in which cost and space are critical. Ref [1]

The Intel 8051 is Harvard architecture, single chip microcontroller (µC) which was

developed by Intel in 1980 for use in embedded systems. It was popular in the 1980s

and early 1990s, but today it has largely been superseded by a vast range of enhanced

devices with 8051-compatible processor cores that are manufactured by more than 20

independent manufacturers including Atmel, Infineon Technologies and Maxim

Integrated Products. 8051 is an 8-bit processor, meaning that the CPU can work on only

8 bits of data at a time. Data larger than 8 bits has to be broken into 8-bit pieces to be

processed by the CPU. 8051 is available in different memory types such as UV-

EPROM, Flash and NV-RAM.

Fig.3 pin diagram of the Microcontroller

9 | P a g e

Page 10: Report

Pin description

Vcc Pin 40 provides supply voltage to the chip. The voltage source is +5V.

GND Pin 20 is the ground.

Port 0Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can sink

eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high

impedance inputs. Port 0 can also be configured to be the multiplexed low-order

address/data bus during accesses to external program and data memory. In this mode,

P0 has internal pull-ups. Port 0 also receives the code bytes during Flash programming

and outputs the code bytes during Program verification. External pull-ups are required

during program verification.

Port 1Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 1 output buffers

can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled

high by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins that are

externally being pulled low will source current (IIL) because of the internal pull-ups. In

addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count input

(P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively, as shown in

the following table. Port 1 also receives the low-order address bytes during Flash

programming and verification.

Table 4.1 Port 1 various special features

Port 2

10 | P a g e

Page 11: Report

Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2 output buffers

can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled

high by the internal pull-ups and can be used as inputs. As inputs, Port 2 pins that are

externally being pulled low will source current (IIL) because of the internal pull-ups.

Port 2 emits the high-order address byte during fetches from external program memory

and during accesses to external data memory that uses 16-bit addresses (MOVX @

DPTR). In this application, Port 2 uses strong internal pull-ups when emitting 1s.

During accesses to external data memory that uses 8-bit addresses (MOVX @ RI), Port

2 emits the contents of the P2 Special Function Register. The port also receives the

high-order address bits and some control signals during Flash programming and

verification.

Port 3Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3 output buffers

can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled

high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are

externally being pulled low will source current (IIL) because of the pull-ups. Port 3

receives some control signals for Flash programming and verification.

Port 3 also serves the functions of various special features of the P89V51, as shown in

the following table.

Table 4.2 Port 3 various special features

RST

11 | P a g e

Page 12: Report

Reset input high on this pin for two machine cycles while the oscillator is running resets

the device. This pin drives high for 98 oscillator periods after the Watchdog times out.

The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In

the default state of bit DISRTO, the RESET HIGH out feature is enabled.

ALE/PROGAddress Latch Enable (ALE) is an output pulse for latching the low byte of the address

during accesses to external memory. This pin is also the program pulse input (PROG)

during Flash programming. In normal operation, ALE is emitted at a constant rate of 1/6

the oscillator frequency and may be used for external timing or clocking purposes.

Note, however, that one ALE pulse is skipped during each access to external data

memory. If desired, ALE operation can be disabled by setting bit 0 of SFR location

8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction.

Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the

microcontroller is in external execution mode.

PSENProgram Store Enable (PSEN) is the read strobe to external program memory. When the

AT89S52 is executing code from external program memory, PSEN is activated twice

each machine cycle, except that two PSEN activations are skipped during each access to

external data memory.

EA/VPPExternal Access Enable EA must be strapped to GND in order to enable the device to

fetch code from external program memory locations starting at 0000H up to FFFFH.

Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset.

EA should be strapped to VCC for internal program executions. This pin also receives

the 12-volt programming enable voltage (VPP) during Flash programming.

XTAL112 | P a g e

Page 13: Report

Input to the inverting oscillator amplifier and input to the internal clock operating

circuit.

XTAL2XTAL pin is Output from the inverting oscillator amplifier.

Oscillator Connections

External Clock Drive Configuration

XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier

that can be configured for use as an on-chip oscillator. Either a quartz crystal or ceramic

resonator may be used. To drive the device from an external clock source, XTAL2

should be left unconnected while XTAL1 is driven. There are no requirements on the

duty cycle of the external clock signal, since the input to the internal clocking circuitry

is through a divide-by-two flip-flop, but minimum and maximum voltage high and low

times specifications must be observed.

4.2.3 LCD Display

13 | P a g e

Page 14: Report

Most alphanumeric LCD displays have HD44780 compatible driver chipsets that follow

the original Hitachi commands to control the LCD.

The most common connectors for alphanumeric LCD’s are either 14-pin single row or

2X7 pins dual row connectors. Ref [1]

Fig.4 LCD display

PIN DESCRIPTION:

1. GND (Ground)

2. Vcc (Supply Voltage)

3. Vee (Contrast Voltage)

4. R/S (Instruction/Register Select)

5. R/W (Read/Write)

6. E (Clock)

7. D0 (Data0)

8. D1 (Data1)

9. D2 (Data2)

10. D3 (Data3)

11. D4 (Data4)

12. D5 (Data5)

13. D6 (Data6)

14. D7 (Data7)

A typical LCD write operation takes place as shown in the following timing waveform

14 | P a g e

Page 15: Report

Fig.5 LCD data write

waveform

Table 4.3 Various LCD functions with different mode

15 | P a g e

Page 16: Report

4.2.4 MAX232

Fig.6 Pin diagram of MAX232

The MAX232 device is a dual driver/receiver that includes a capacitive voltage

generator to supply EIA-232 voltage levels from a single 5-V supply. Each receiver

converts EIA-232 inputs to 5-V TTL/CMOS levels. Each driver converts TTL/CMOS

input levels into EIA-232 levels. A max232 chip is used to do the level shifting and this

chip is required to send data serially to a PC which requires voltage levels as per RS232

standard. Ref [2]

RS232 Standard

Fig.7 Configuration of DB9 connector for microcontroller

RS232 is an electrical signaling specification published by the Electronic Industries

Association (EIA). Although not identified in the specification, the 9-pin (DB9)

connector, with specific pin assignments, is commonly accepted as "the RS232

connector or the serial connector." This standard interface provides connection for only

modest transmission rates & is often used with modems.

16 | P a g e

Page 17: Report

4.2.5 ComparatorA comparator receives one input signal and compares that signal to a reference voltage

applied to another input and according to condition of input signal it gives output.

LM358 is high gain op-amp. The LM358 has unique Features are as follow. Ref [14]

FEATURES

-Short Circuit Protected Outputs

-True Differential Input Stage

-Single Supply Operation: 3.0 V to 32 V

-Low Input Bias Currents

-Internally Compensated

-Common Mode Range Extends to Negative Supply

-Single and Split Supply Operation

-ESD Clamps on the Inputs Increase Ruggedness of the Device

Fig.8 Pin diagram of LM358

17 | P a g e

Page 18: Report

4.2.6 Gas Sensor

Gas sensor has recently attracted much attention due to increasing demand of

environmental monitoring and other gas detecting applications. Among different types

of gas sensor, thin film gas sensor has been much of interest because of microelectronic

batch-fabricated compatibility, reproducibility, and ability to form multilayer device

structures. In this work, thin film based gas sensing circuit is designed for immediate

applications of CO detection for environmental monitoring. Ion assisted deposition

(IAD) process offers several advantages for gas sensor fabrication, including reactive

deposition for gas-sensitive metal-oxide material optimization and improved thin film

adhesion for better device reliability. The metal oxide layer was deposited on alumina

or glass substrates. The sensors were tested with reducing gases, in the temperature

range between 200C and 350 C and the electrical change in gas sensor is detected. Gas

sensors interact with a gas to initiate the measurement of its concentration. The gas

sensor then provides output to a gas instrument to display the measurements. Common

gases measured by gas sensors include ammonia, aerosols, arsine, bromine, carbon

dioxide, carbon monoxide, chlorine, chlorine dioxide, Diborane, dust, fluorine,

germane, halocarbons or refrigerants, hydrocarbons, hydrogen, hydrogen chloride,

hydrogen cyanide, hydrogen fluoride, hydrogen selenide, hydrogen sulphide, mercury

vapour, nitrogen dioxide, nitrogen oxides, nitric oxide, organic solvents, oxygen, ozone,

phosphine, silane, sulphur dioxide, and water vapour. Important measurement

specifications to consider when looking for gas sensors include the response time, the

distance, and the flow rate.

The response time is the amount of time required from the initial contact with the gas to

the sensors processing of the signal. Distance is the maximum distance from the leak or

gas source that the sensor can detect gases. The flow rate is the necessary flow rate of

air or gas across the gas sensor to produce signal. Gas sensors can output a

measurement of the gases detected in a number of ways. These include percent LEL,

percent volume, trace, leakage, consumption, density, and signature or spectra. The

lower explosive limit (LEL) or lower flammable limit (LFL) of a combustible gas is

defined as the smallest amount of the gas that will support a self-propagating flame

when mixed with air (or oxygen) and ignited. In gas-detection systems, the amount of

gas present is specified in terms of % LEL: 0% LEL

18 | P a g e

Page 19: Report

Being a combustible gas-free atmosphere and 100% LEL being an atmosphere in which

the gas is at its lower flammable limit. The relationship between % LEL and % by

volume differs from gas to gas. Also called volume percent or percent by volume,

percent volume is typically only used for mixtures of liquids. Percent by volume is

simply the volume of the solute divided by the sum of the volumes of the other

components multiplied by 100%. Trace gas sensors given in units of concentration:

ppm. Leakage is given as a flow rate like ml/min. Consumption may also be called

respiration given in units of ml/L/hr. Density measurements are given in units of

density: mg/m^3. A signature or spectra measurement is a spectral signature of the

gases present; the output is often a chromatogram. Common outputs from gas sensors

include analog voltage, pulse signals, analog currents and switch or relays. Operating

parameters to consider for gas sensors include operating temperature and operating

humidity.

19 | P a g e

Page 20: Report

APPLICATIONS OF GAS SENSORS

(i) Gas Leak Protection

These are areas of industry where the possibility of flammable gas build-up is small, but

the consequences of a gas escape could be catastrophic. These tend to be industries

which by their nature have large volumes of gases piped around the works:

-Engineering companies

-Metal working plants

-Research laboratories

(ii) Confined Space Entry

The instrument is used to check the atmosphere of sewers, tanks and other vessels prior

to entry for maintenance purposes. These instruments invariably are 'multi-gas'. They

have 3 or even 4 sensors included in the package. Large volumes of these instruments

are purchased by:

-Public utilities - especially water and telecoms

-Chemical and petrochemical - for entry into vessels

-Cabling contractors

-Piling contractors

-Tunnelling contractors

-Civil engineers

-Landfill operators

(iii) Hazardous Area

Working areas of industry where the build-up of flammable gas or vapour is an ever

present danger. These instruments are very often the same multi-gas instruments used

for confined space entry, but there are areas where single gas monitors ('explosimeters')

are used. Typical industrial sectors here are:

-Chemical and petrochemical industries

-Oil/gas exploration

-Mining

20 | P a g e

Page 21: Report

MQ-6 SENSOR

A NATURAL GAS SENSOR is an electronic device which Detect dangerous gas leaks

in the kitchen or near the gas heater. This unit detects 300 to 5000ppm of Natural Gas.

Ideal to detect dangerous gas leaks in the kitchen. Sensor can be easily configured as an

alarm unit. The sensor can also sense LPG and Coal Gas. Ref [13]

FEATURES

-High sensitivity to LPG, iso-butane, propane

-Small sensitivity to alcohol, smoke.

-Fast response.

-Stable and long life

-Simple drive circuit

STRUCTURE AND CONFIGURATION

Sensor composed by micro AL2O3 ceramic tube, Tin Dioxide (SnO2) sensitive Layer , measuring electrode and heater are fixed into a crust made by plastic and stainless steel net. The heater provides necessary work conditions for work of sensitive components. The enveloped MQ-6 has 6 pin, 4 of them are used to fetch signals, and other 2 are used for providing heating current.

Fig. 9 MQ6 sensor structure

21 | P a g e

Page 22: Report

Fig.10 Basic MQ-6 sensor circuit

SENSITVITY ADJUSTMENT

Resistance value of MQ-6 is difference to various kinds and various concentration

gases. So, when using this component, sensitivity adjustment is very necessary. We

recommend that calibrate the detector for 1000ppm of LPG concentration in air and use

value of Load resistance (RL) about 20KΩ (10KΩ to 47KΩ). When accurately

measuring, the proper alarm point for the gas detector should be determined after

considering the temperature and humidity influence.

4.2.7 GSM Technology22 | P a g e

Page 23: Report

A GSM (Global System for Mobile communications) is an open, digital cellular

technology used for transmitting mobile voice and data services.GSM (Global System

for Mobile communication) is a digital mobile telephone system that is widely used in

Europe and other parts of the world. GSM uses a variation of Time Division Multiple

Access (TDMA) and is the most widely used of the three digital wireless telephone

technologies (TDMA, GSM, and CDMA). GSM digitizes and compresses data, then

sends it down a channel with two other streams of user data, each in its own time slot. It

operates at either the 900 MHz or 1,800 MHz frequency band. It supports voice calls

and data transfer speeds of up to 9.6 Kbit/s, together with the transmission of SMS

(Short Message Service). Ref [3]

Introduction to the GSM Standard

The GSM (Global System for Mobile communications) network is at the start of the

21st century, the most commonly used mobile telephony standard in Europe. It is called

as Second Generation (2G) standard because communications occur in an entirely

digital mode, unlike the first generation of portable telephones. When it was first

standardized in 1982, it was called as Group Special Mobile and later, it became an

international standard called "Global System for Mobile communications" in 1991.

In Europe, the GSM standard uses the 900 MHz and 1800 MHz frequency bands. In the

United States, however, the frequency band used is the 1900 MHz band. For this reason,

portable telephones that are able to operate in both Europe and the United States are

called tri-band while those that operate only in Europe are called bi-band.

The GSM standard allows a maximum throughput of 9.6 kbps which allows

transmission of voice and low-volume digital data like text messages (SMS, for Short

Message Service) or multimedia messages (MMS, for Multimedia Message Service).

Introduction of AT Commands

23 | P a g e

Page 24: Report

AT commands are instructions used to control a modem. Ref [8] AT is the abbreviation

of Attention. Every command line starts with "AT" or "at". That's the reason; modem

commands are called AT commands. Many of the commands that are used to control

wired dial-up modems, such as ATD (Dial), ATA (Answer), ATH (Hook control) and

ATO (Return to online data state) are also supported by GSM modems and mobile

phones.

Besides this common AT command set [APPENDIX-1], GSM modems and mobile

phones support an AT command set that is specific to the GSM technology, which

includes SMS-related commands like AT+CMGS (Send SMS message), AT+CMSS

(Send SMS message from storage), AT+CMGL (List SMS messages) and AT+CMGR

(Read SMS messages).

It should be noted that the starting "AT" is the prefix that informs the modem about the

start of a command line. It is not part of the AT command name. For example, D is the

actual AT command name in ATD and +CMGS is the actual AT command name in

AT+CMGS. Some of the tasks that can be done using AT commands with a GSM

modem or mobile phone are listed below.

1. Get basic information about the mobile phone or GSM modem. For example, name

of manufacturer (AT+CGMI), model number (AT+CGMM), IMEI number

(International Mobile Equipment Identity) (AT+CGSN) and software version

(AT+CGMR).

2. Get basic information about the subscriber. For example, MSISDN (AT+CNUM)

and IMSI number (International Mobile Subscriber Identity) (AT+CIMI).

3. Get the current status of the mobile phone or GSM/GPRS modem. For example,

mobile phone activity status (AT+CPAS), mobile network registration status

(AT+CREG), radio signal strength (AT+CSQ), battery charge level and battery

charging status (AT+CBC).

4. Establish a data connection or voice connection to a remote modem (ATD, ATA,

etc).

5. Send and receive fax (ATD, ATA, AT+F*).

24 | P a g e

Page 25: Report

6. Send (AT+CMGS, AT+CMSS), read (AT+CMGR, AT+CMGL), write

(AT+CMGW) or delete (AT+CMGD) SMS messages and obtain notifications of

newly received SMS messages (AT+CNMI).

7. Read (AT+CPBR), write (AT+CPBW) or search (AT+CPBF) phonebook entries.

8. Perform security-related tasks, such as opening or closing facility locks

(AT+CLCK), checking whether a facility is locked (AT+CLCK) and changing

passwords (AT+CPWD). (Facility lock examples: SIM lock [a password must be

given to the SIM card every time the mobile phone is switched on] and PH-SIM

lock [a certain SIM card is associated with the mobile phone. To use other SIM

cards with the mobile phone, a password must be entered.

9. Control the presentation of result codes / error messages of AT commands. For

example, the user can control whether to enable certain error messages (AT+CMEE)

and whether error messages should be displayed in numeric format or verbose

format (AT+CMEE=1 or AT+CMEE=2).

10. Get or change the configurations of the mobile phone or GSM/GPRS modem. For

example, change the GSM network (AT+COPS), bearer service type (AT+CBST).

25 | P a g e

Page 26: Report

4.2.8 GSM MODEM

Fig.-11 GSM MODULE

Power Supply

Use AC – DC Power Adaptor with following ratings

DC Voltage: 5V

DC Current: 1500mA

Polarity: Centre +ve & Outside –ve

Current Consumption in normal operation 250mA, can rise up to 1Amp while

transmission.

Interfaces

RS-232 through D-TYPE 9 pin connector, Serial port baud rate adjustable 1200

to115200

bps (9600 default)

Stereo connector for MIC & SPK

Power supply through DC socket

SMA antenna connector

Push switch type SIM holder

LED status of GSM module

26 | P a g e

Page 27: Report

Getting Started GSM modem

Insert SIM card: Press the yellow pin to remove the tray from the SIM cardholder.

After properly fixing the SIM card in the tray, insert the tray in the slot provided. Ref

[5]

Connect Antenna: Screw the RF antenna on the RF cable output provided. If voice call

is needed, connect the mic and speaker to stereo sockets.

Connect RS232 Cable:

Cable provided for RS232 communication Default baud rate is 9600 with 8-N-1, no

hardware handshaking. Cable provided has pins 7 and 8 shorted that will set to no

hardware handshaking. In you need hardware handshaking the pins 7-8 can be taken for

signaling. Pin connection of RS232 as follow.

-Pin 2 is RS232 level TX out

-Pin 3 is RS232 level RX in

-Pin 5 is Ground

-Pin 7 RTS in (shorted to pin 8 in cable for no hardware handshaking)

-Pin 8 CTS out (shorted to pin 7 in cable for no hardware handshaking)

Power Supply

Connect 9-12VDC adaptor to the power jack of GSM modem.

Status indicator

Network Led indicating various status of GSM module e.g. Power on, network

registration & GPRS connectivity. After the Modem registers the network, led will

blink in step of 3 seconds. At this stage you can start using Modem for your application.

For sending SMS in text mode step are as follow

-AT+CMGF=1 press enter

-AT+CMGS=”mobile number” press enter

-Once The AT commands is given’ >’ prompt will be displayed on the screen.

-Type the message to send via SMS. After this, press ctrl+Z to sent the SMS.

-If the SMS sending is successful, “ok” will be displayed along with the

message number.

27 | P a g e

Page 28: Report

For reading SMS in the text mode step are as follow

-AT+CMGF=1 Press enter

-AT+CMGR= No

-Number (no.) is the message index number stored in the sim card. For new

SMS, URC will be received on the screen as +CMTI: SM ‘no’. Use this

number in the AT+CMGR number to read the message.

CHAPTER 5

28 | P a g e

Page 29: Report

PROJECT SCHEMATIC DIAGRAM

5.1 Schematic diagram of control unit

Fig 12 Circuit diagram of control unit

5.2 Schematic diagram of Gas sensor

29 | P a g e

Page 30: Report

Fig 13 Circuit diagram of gas sensor

5.3 Working Procedure

30 | P a g e

Page 31: Report

This project is microcontroller + GSM based project. A Gas sensor is used to detect

dangerous gas leaks in the kitchen or near the gas heater. This unit detects 300 to

5000ppm of Natural Gas. Ideal to detect dangerous gas leaks in the kitchen and sent

signal to microcontroller P89VS51.

In this project there are mainly two units, GSM modem and microcontroller unit.GSM

modem can be configured by standard GSM AT command set for sending and receiving

SMS and getting modem status. Depending upon the Gas sensor output microcontroller

can send message to the authorized person and also depending upon the message

received the microcontroller unit will control the devices and acknowledges the device

status to the user as SMS.

If leakage is detected, a message is sent to the authorized person using cellular network

called GSM. “GSM based Control System” implements the emerging applications of

the GSM technology.

The gas sensor composed by micro AL2O3 ceramic tube, Tin Dioxide (SnO2) sensitive

layer, measuring electrode and heater are fixed into a Crust made by plastic and

stainless steel net. The heater provides necessary work conditions for work of sensitive

components. The enveloped MQ-6 has 6 pin, 4 of them are used to fetch signals, and

other 2 are used for providing heating current. The fetched signal from pin 4 is given in

input of non inverting terminal of LM 358.The LM 358 work as comparator at

inverting terminal given reference voltage. When reference voltage higher then signal

voltage applied at non inverting terminal output goes from high to low .this output

signal given to the BC547 transistor. The collector of transistor connected to

microcontroller external interrupt 0 pin. When this pin goes from high to low signal

then interrupt detected by controller which give command to modem sent message to

emergency helpline number with predefined message store in memory. Microcontroller

switched on alarm to inform nearest people.

CHAPTER 6

FIRMWARE IMPLEMENTATION

31 | P a g e

Page 32: Report

This chapter briefly explains about the firmware implementation of the project. The

required software tools are discussed in section 4.2. Section 4.3 shows the flow

diagram of the project design. Section 4.4 presents the firmware implementation of the

project design.

6.1 Flowchart

Fig.-14 Operation

flow diagram

6.2 Software

Tools Required

-Keil software programming using C language32 | P a g e

Page 33: Report

-Flash magic

-Proteous 7 Software for simulation

6.2.1 Keil software

Keil development tools for the 8051 Microcontroller Architecture support every level

of software developer from the professional applications. Ref [9]

C51 COMPILER & A51 MACRO ASSEMBLER

Source files are created by the µVision IDE and are passed to the C51 Compiler or A51

Macro Assembler. The compiler and assembler process source files and create

replaceable object files. The Keil C51 Compiler is a full ANSI implementation of the C

programming language that supports all standard features of the C language. In

addition, numerous features for direct support of the 8051 architecture have been

added.

µVision3 adds many new features to the Editor like Text Templates, Quick Function

Navigation, and Syntax Coloring with brace high lighting Configuration Wizard for

dialog based startup and debugger setup. µVision3 is fully compatible to µVision2 and

can be used in parallel with µVision2.

µVision3 is an IDE (Integrated Development Environment) that helps you write,

compile, and debug embedded programs. It encapsulates the following components:

-A project manager.

-A make facility.

-Tool configuration.

-Editor.

-A powerful debugger.

CREATING APPLICATION IN µVISION3

To create a new project in µVision3, you must Ref [9]

33 | P a g e

Page 34: Report

1. Select Project - New Project.

2. Select a directory and enter the name of the project file.

3. Select Project - Select Device and select an 8051, P89V51RB2 device from the

Device Database™.

34 | P a g e

Page 35: Report

4. Create source files to add to the project.

5. Select Project - Targets, Groups, and Files. Add/Files, select Source Group1, and

add the source files to the project.

6. Select Project - Options and set the tool options. Note when you select the target

device from the Device Database™ all special options are set automatically. You

35 | P a g e

Page 36: Report

typically only need to configure the memory map of your target hardware. Default

memory model settings are optimal for most applications.

7. Select Project - Rebuild all target files or Build target.

6.2.2 Flash Magic

Flash Magic is a PC tool for programming flash based microcontrollers from NXP

using a serial or Ethernet protocol while in the target hardware. Ref [12]

36 | P a g e

Page 37: Report

FEATURES

-Straightforward and intuitive user interface

-Five simple steps to erasing and programming a device and setting any options desired

-Programs Intel Hex Files

-Automatic verifying after programming

-Fills unused flash to increase firmware security

-Program security bits

-Check which Flash blocks are blank or in use with the ability to easily erase all blocks

in use

-Read the device signature

-Read any section of Flash and save as an Intel Hex File

6.2.3 Proteus

37 | P a g e

Page 38: Report

Proteus Virtual System Modelling (VSM) combines mixed mode SPICE circuit simulation, animated components and microprocessor models to facilitate co-simulation of complete microcontroller based designs. For the first time ever, it is possible to develop and test such designs before a physical prototype is constructed. Ref [10, 11]

Fig. 14 Project simulation snapshot

CHAPTER 7 38 | P a g e

Page 39: Report

RESULT ANALYSIS

7.1 Expected result

If gas leakage is detected by device in range of concentration 300-1000ppm, a SMS is

sent to the designated phone numbers.

If LPG leakage occurs, a message will be sent to the nearest emergency help line as

“WARNING: LPG gas leakage at …….. Customer ID location” and also give visual

indication or alarm to inform nearly people.

If LPG leakage occurs, a message will be sent to the owner of house/car/Industry as

“WARNING: LPG gas leakage detected at your location, please take emergency steps”

If PNG/CNG leakage occurs, a message will be sent to the owner of house/car/Industry

as “WARNING: PNG/CNG gas leakage detected at your location, please take

emergency steps”

7.2 Standard work condition

Symbol Parameter name Technical condition RemarksVC Circuit voltage 5V±0.1 AC OR DCVH Heating voltage 5V±0.1 AC OR DCRL Load resistance 20KΩRH Heater resistance 33Ω±5% Room Temperature

PHHeating

consumption less than 750mw

Table 7.1 Standard electric parameter for gas sensor

Symbol Parameter name Technical condition Remarks

Tao Using Temp. -10℃-50℃Tas Storage Temp. -20℃-70℃RH Related humidity less than 95%Rh

O2 Oxygen concentration 21%(standard condition) minimum value is

over 2%

Table 7.2 Standard environment conditions for gas sensor

39 | P a g e

Page 40: Report

Symbol Parameter name Technical Parameter Remarks

Rs Sensing Resistance 10KΩ- 60KΩ(1000ppm LPG )

Detecting concentration scope:200-10000ppm

LPG , iso-butane,propane,

LNG

α(1000ppm/

4000ppm LPG)

Concentration slope rate ≤0.6

Standarddetectingcondition

Temp: 20℃±2℃ Vc:5V±0.1Humidity: 65%±5% Vh: 5V±0.1

Preheat time Over 24 hour

Table 7.3 Sensitivity characteristic of gas sensor

Fig.16 Sensitivity characteristics curve for several gases

40 | P a g e

Page 41: Report

7.3 Limitation

This project is dependent on GSM network so in case of network problem or customer

premises are far from the network services provider this system is not able to sent

message to emergency helpline or customer. In this case system only sounds alarm to

inform nearby people.

41 | P a g e

Page 42: Report

CHAPTER 8

CONCLUSION

Aim of this project to detect dangerous gas leaks in the kitchen or near the gas heater.

Ideal to detect dangerous gas leaks in the kitchen. Sensor can be easily configured as an

alarm unit. The sensor can also sense LPG and Coal Gas as well as Ideal sensor for use

to detect the presence of a dangerous LPG leak in your car or in a service station,

storage tank environment. This unit can be easily incorporated into an alarm unit, to

sound an alarm or give a visual indication of the LPG concentration. The sensor has

excellent sensitivity combined with a quick response time. When GAS leakage is

detected and is messaged to the authorized person using cellular network called GSM.

42 | P a g e

Page 43: Report

APPENDIX-1

Overview of AT Commands

Command Description

A/ RE-ISSUES LAST AT COMMAND GIVEN

ATA ANSWER AN INCOMING CALL

ATD MOBILE ORIGINATED CALL TO DIAL A NUMBER

ATD><MEM><N

>

ORIGINATE CALL TO PHONE NUMBER IN MEMORY

<MEM>

ATD><N> ORIGINATE CALL TO PHONE NUMBER IN CURRENT

MEMORY

ATD><STR> ORIGINATE CALL TO PHONE NUMBER IN MEMORY

WHICH CORRESPONDS TO FIELD <STR>

ATDL REDIAL LAST TELEPHONE NUMBER USED

ATE SET COMMAND ECHO MODE

ATH DISCONNECT EXISTING CONNECTION

AT+CGMI REQUEST MANUFACTURER IDENTIFICATION

AT+CGMM REQUEST MODEL IDENTIFICATION

AT+CMGD DELETE SMS MESSAGE

AT+CMGF SELECT SMS MESSAGE FORMAT

AT+CMGL LIST SMS MESSAGES FROM PREFERRED STORE

AT+CMGR READ SMS MESSAGE

AT+CMGS SEND SMS MESSAGE

AT+CMGW WRITE SMS MESSAGE TO MEMORY

AT+CMSS SEND SMS MESSAGE FROM STORAGE

AT+CMGC SEND SMS COMMAND

AT+CNMI NEW SMS MESSAGE INDICATIONS

AT+CPMS PREFERRED SMS MESSAGE STORAGE

AT+CRES RESTORE SMS SETTINGS

AT+CSAS SAVE SMS SETTINGS

AT+CSCA SMS SERVICE CENTER ADDRESS

43 | P a g e

Page 44: Report

AT+CSCB SELECT CELL BROADCAST SMS MESSAGES

AT+CSDH SHOW SMS TEXT MODE PARAMETERS

AT+CSMP SET SMS TEXT MODE PARAMETERS

AT+CSMS SELECT MESSAGE SERVICE

44 | P a g e

Page 45: Report

REFERENCES

[1] Mazidi and Mazidi Pearson Education “The 8051 Microcontroller and Embedded

System” -LCD interfacing, Page-351-352, interrupts programming page 326-333.

[2] Michael J. Pont “Embedded C”- Pearson Education, Using the serial interface, page

217-222

[3]Theodore s. Rappaport “Wireless communication principle & practices” modern

wireless communication system page 25-39

[4] http://www.keil.com/dd/docs/datashts/philips/p89v51rd2.pdf

[5] http://www.sunroms.com/gsm_module.docx

[6] http:// www.enginnersgarage.com/max220-232/datasheets.pdf

[7] http://www.engineersgarage.com/microcontroller/8051projects/gsm-interface-8051

[8] http://www.owen.ru/uploads/re_pm01_list_command.pdf

[9] http://www.keil.com/uvision/ide_ov_starting.asp

[10] http://allaboutlearningandearning.blogspot.in/2011/07/proteus-tutorial.html

[11] http://www.labcenter.com/download/prodemo_download.cfm

[12] http://www.flashmagictool.com/

[13] http://www.sparkfun.com/datasheets/Sensors/Biometric/MQ-6.pdf

[14] http://www.fairchildsemi.com/ds/LM/LM358.pdf

45 | P a g e