lpg

101
CHAPTER 1 INTRODUCTION

Upload: -

Post on 24-Nov-2014

606 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: LPG

CHAPTER 1

INTRODUCTION

Page 2: LPG

1.2 Block Diagram:

MICROCONTROLLER

LPG SENSOR

BUZZER GSMMODEM

OP-AMP

LCD 16X2

TEMPERATURESENSOR

MAX232

Page 3: LPG

Fig. 1.1 CONSUMER SIDE

Page 4: LPG

BLOCKDIAGRAM DESCRIPTION:

Page 5: LPG

CIRCUIT DIAGRAM:

CIRCUIT DIAGRAM DESCRIPTION:

Page 6: LPG

CHAPTER 4

HARDWARE

DESCRIPTION

FIG. 4.0: MICROCONTROLLER IC AT89S52

Page 7: LPG

4.1 Microcontroller AT89S52:

Fig. 4.1 PIN DIAGRAM AT 89S52

4.1.1 PIN/PORT Connections:

PORT NUMBER BIT CONNECTION

P-0

0 LCD DATA D0 CONNECTION

1 LCD DATA D1 CONNECTION

2 LCD DATA D2CONNECTION

3 LCD DATA D3CONNECTION

4 LCD DATA D4 CONNECTION

5 LCD DATA D5 CONNECTION

Page 8: LPG

6 LCD DATA D6 CONNECTION

7 LCD DATA D7 CONNECTION

P-1

0 BUZZER CONNECTION

1 NO CONNECTION

2 NO CONNECTION

3 NO CONNECTION

4 NO CONNECTION

5 NO CONNECTION

6 NO CONNECTION

7 NO CONNECTION

PORT NUMBER BIT CONNECTION

P-2

0 NO CONNECTION

1 NO CONNECTION

2 NO CONNECTION

3 NO CONNECTION

4 NO CONNECTION

5TEMPERATURE DATA

CONNECTION

6 LCD EN CONNECTION

7 LCD RS CONNECTION

P-3

0 GSM MODEM TX

1 GSM MODEM RX

2 LPG LEKAGE SENSOR

3 NO CONNECTION

4 NO CONNECTION

5 NO CONNECTION

6 NO CONNECTION

7 NO CONNECTION

TABLE: 4.1.1 PIN/PORT CONNECTIONS

Page 9: LPG

4.1.2 Features of AT 89S52:

8K Bytes of In-System Programmable (ISP) Flash Memory

Endurance: 10,000 Write/Erase Cycles

4.0V to 5.5V Operating Range

Fully Static Operation: 0 Hz to 33 MHz

Three-level Program Memory Lock

256 x 8-bit Internal RAM

32 Programmable I/O Lines

Three 16-bit Timer/Counters

Eight Interrupt Sources

Full Duplex UART Serial Channel

Low-power Idle and Power-down Modes

Interrupt Recovery from Power-down Mode

Watchdog Timer

Dual Data Pointer

Power-off Flag

Fast Programming Time

Flexible ISP Programming (Byte and Page Mode)

Green (Pb/Halide-free) Packaging Option

4.2 Description:

The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller

with 8K bytes of in-system programmable Flash memory. The device is manufactured

using Atmel’s high-density nonvolatile memory technology and is compatible with the

industry-standard 80C51 instruction set and pin out. The on-chip Flash allows the

program memory to be reprogrammed in-system or by a conventional nonvolatile

memory programmer. By combining a versatile 8-bit CPU with in-system programmable

Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcontroller which

provides a highly-flexible and cost-effective solution to many embedded control

applications. The AT89S52 provides the following standard features: 8K bytes of Flash,

256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit.

Page 10: LPG

Timer/counters, a six-vector two-level interrupt architecture, a full duplex serial port, on-

chip oscillator, and clock circuitry. In addition, the AT89S52 is designed with static logic

for operation down to zero frequency and supports two software selectable power saving

modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial

port, and interrupt system to continue functioning. The Power-down mode saves the

RAM contents but freezes the oscillator, disabling all other chip functions until the next

interrupt or hardware reset.

4.3 PIN/PORT Details:

Vcc:

Supply voltage (+5V).

Gnd:

Ground.

Port 0:

Port 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 1:

Port 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.

Page 11: LPG

Table 4.3.1 PORT1

Port 2:

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 memories that use 16-bit addresses (MOVX @

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

accesses to external data memories that use 8-bit addresses (MOVX @ RI), Port 2 emits

the contents of the P2 Special Function Register. Port 2 also receives the high-order

address bits and some control signals during Flash programming and verification.

Port 3:

Port 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 AT89S52, as shown in the following table.

Page 12: LPG

Table 4.3.2 PORT 3

Reset

input. A 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/PROG:

Address 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.

PSEN:

Program 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.

Page 13: LPG

EA/VPP:

External access enables. 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.

XTAL1:

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

circuit.

XTAL2:

Output from the inverting oscillator amplifier.

4.4 The GSM Network:

The GSM network was designed keeping in mind the voice activities of the user

and its main purpose was to provide voice connectivity like Public Switched Telephone

Networks but with mobility. So Call Processing activities were the major criteria to

decide and fix the implementation standards of GSM. The data communication was of

secondary importance to this network but to support this also, designers have considered

the circuit switching itself the mechanism for transmitting data packet.

The Mobile Station (MS) directly interacts with one of the Base Transceiver

Stations, which in turn interacts with a Base Station Controllers (BSC). BTS and BSC

combined together forms the BSS. More than one BTSs are connected with one BSC. The

BSC further interacts with Mobile Station Controller (MSC) which is the heart of the

GSM network. MSC further gives connectivity to the PSTN and other PLMN’s. MSC is

also responsible to interact with HLR and VLR, which form the Permanent and

Temporary data bases for all the subscribers’ static and dynamic information.

4.5 GSM Architecture:

Page 14: LPG

FIG 4.2 GSM ARCHITECTURE.

The words, “Mobile Station” (MS) or “Mobile Equipment” (ME) are used for

mobile terminals supporting GSM services. A call from a GSM mobile station to the

PSTN is called a “mobile originated call” (MOC) or “outgoing call”, and a call from a

fixed network to a GSM mobile station is called a “mobile terminated call” (MTC) or

“incoming call”. In this document, the word “product” refers to any product supporting

the AT commands interface.

Multiple Access and Channel Structure:

Since radio spectrum is a limited resource shared by all users, a method must be

devised to divide up the bandwidth among as many users as possible. The method chosen

by GSM is a combination of Time- and Frequency-Division Multiple Access

(TDMA/FDMA). The FDMA part involves the division by frequency of the (maximum)

25 MHz bandwidth into 124 carrier frequencies spaced 200 kHz apart. One or more

carrier frequencies are assigned to each base station. Each of these carrier frequencies is

then divided in time, using a TDMA scheme. The fundamental unit of time in this TDMA

scheme is called a burst period and it lasts 15/26 ms (or approx. 0.577 ms). Eight burst

periods are grouped into a TDMA frame (120/26 ms, or approx. 4.615 ms), which forms

PSTN

Data Terminal

HLR/VLR

MSCBSC

OMC(Operation & Maintenance

Center)

OperationTerminal

BTS

HandsetA

X.25

A-bis SS7

Network sub-system PSTNRadiosub-system

Mobilestation

UM

SIMcard

Page 15: LPG

the basic unit for the definition of logical channels. One physical channel is one burst

period per TDMA frame.

Channels are defined by the number and position of their corresponding burst

periods. All these definitions are cyclic, and the entire pattern repeats approximately

every 3 hours. Channels can be divided into dedicated channels, which are allocated to a

mobile station, and common channels, which are used by mobile stations in idle mode.

Traffic Channels:

A traffic channel (TCH) is used to carry speech and data traffic. Traffic channels

are defined using a 26-frame multiframe, or group of 26 TDMA frames. The length of a

26-frame multi frame is 120 ms, which is how the length of a burst period is defined (120

ms divided by 26 frames divided by 8 burst periods per frame). Out of the 26 frames, 24

are used for traffic, 1 is used for the Slow Associated Control Channel (SACCH) and 1 is

currently unused.

In addition to these full-rate TCHs, there are also half-rate TCHs defined,

although they are not yet implemented. Half-rate TCHs will effectively double the

capacity of a system once half-rate speech coders are specified (i.e., speech coding at

around 7 kbps, instead of 13 kbps). Eighth-rate TCHs are also specified, and are used for

signalling. In the recommendations, they are called Stand-alone Dedicated Control

Channels (SDCCH).

FIGURE 4.3: ORGANIZATION OF BURSTS, TDMA FRAMES, AND

MULTIFRAMES FOR SPEECH AND DATA

Control Channels:

Page 16: LPG

Common channels can be accessed both by idle mode and dedicated mode

mobiles. The common channels are used by idle mode mobiles to exchange the signalling

information required to change to dedicated mode. Mobiles already in dedicated mode

monitor the surrounding base stations for handover and other information. The common

channels are defined within a 51-frame multiframe, so that dedicated mobiles using the

26-frame multiframe TCH structure can still monitor control channels.

The common channels include:

Broadcast Control Channel (BCCH):

Continually broadcasts, on the downlink, information including base station:

identity, frequency allocations, and frequency-hopping sequences.

Frequency Correction Channel (FCCH) and Synchronisation Channel (SCH):

Used to synchronise the mobile to the time slot structure of a cell by defining the

boundaries of burst periods, and the time slot numbering. Every cell in a GSM network

broadcasts exactly one FCCH and one SCH, which are by definition on time slot number

0 (within a TDMA frame).

Random Access Channel (RACH):

Slotted Aloha channel used by the mobile to request access to the network.

Access Grant Channel (AGCH):

Used to allocate an SDCCH to a mobile for signalling (in order to obtain a

dedicated channel), following a request on the RACH.

Power Control:

There are five classes of mobile stations defined, according to their peak

transmitter power, rated at 20, 8, 5, 2, and 0.8 watts. To minimize co-channel interference

and to conserve power, both the mobiles and the Base Transceiver Stations operate at the

lowest power level that will maintain an acceptable signal quality. Power levels can be

stepped up or down in steps of 2 dB from the peak power for the class down to a

minimum of 13 dBm (20 milliwatts).

The mobile station measures the signal strength or signal quality (based on the Bit

Error Ratio), and passes the information to the Base Station Controller, which ultimately

decides if and when the power level should be changed. Power control should be handled

carefully, since there is the possibility of instability. This arises from having mobiles in

co-channel cells alternatingly increase their power in response to increased co-channel.

Network Aspects:

Page 17: LPG

Ensuring the transmission of voice or data of a given quality over the radio link is

only part of the function of a cellular mobile network. A GSM mobile can seamlessly

roam nationally and internationally, which requires that registration, authentication, call

routing and location updating functions exist and are standardized in GSM networks. In

addition, the fact that the geographical area covered by the network is divided into cells

necessitates the implementation of a handover mechanism. These functions are performed

by the Network Subsystem, mainly using the Mobile Application Part (MAP) built on top

of the Signalling System No. 7 protocol.

FIGURE.4.4: SIGNALLING PROTOCOL STRUCTURE IN GSM

The signalling protocol in GSM is structured into three general layers [1], [19],

depending on the interface, as shown in Figure 3. Layer 1 is the physical layer, which

uses the channel structures discussed above over the air interface. Layer 2 is the data link

layer. Across the Um interface, the data link layer is a modified version of the LAPD

protocol used in ISDN, called LAPDm. Across the A interface, the Message Transfer Part

layer 2 of Signalling System Number 7 is used. Layer 3 of the GSM signalling protocol is

itself divided into 3 sublayers.

Mobility Management (MM):

Mobility Management handles the control functions required for mobility e.g.

• Authentication

• Assignment of TMSI

• Management of subscriber location

Radio Resource Management (RR):

Page 18: LPG

The role of the RR management layer is to establish and release stable connection

between mobile stations (MS) and an MSC for the duration of a call, and to maintain it

despite user movements. The following functions are performed by the MSC

• Call selection

• Handover

• Allocation and take-down of point-to-point channels

• Monitoring and forwarding of radio connections

• Introduction of encryption

• Change in transmission mode

Connection Management (CM):

Connection Management is used to setup, maintain and take down call

connections; it is comprised of three subgroups:

• Call Control (CC):- Manages call connections.

• Supplementary Service Support (SS):- Handles special services.

• Short Message Service Support (SMS):- Transfers brief texts.

GSM Protocol Stacks:

FIG.4.5: GSM PROTOCOL STACKS

Protocols on the Um interface:

Layer 1: Physical layer.

Page 19: LPG

Layer 2: Here the LAP-Dm protocol is used (similar to ISDN LAP-D). LAP-Dm

has the following functions:

• Connectionless transfer on point-to-multipoint signalling channels.

• Connection-oriented transfer with retention of the transmission sequence, error

detection and error correction.

Layer 3: Contains the following sub layers which control signalling channel

functions (BCH, CCCH and DCCH).

GSM Radio Interface:

GSM Radio interface uses the base FDMA+TDMA technologies along with an

optional Slow Frequency Hopping. The specs are the specifications are mentioned below.

• 124 radio carriers, inter carrier spacing 200 kHz.

• 890 to 915 MHz mobile to base – UPLINK

• 935 to 960 MHz base to mobile - DOWNLINK

• 8 channels/carrier

GSM Modem:

Our GSM modem is one of the most exciting and innovative electronic products

ever developed. With it you can stay in contact with your office, your home, emergency

services, and others, wherever service is provided.

General:

Our modem utilizes the GSM standard for cellular technology. GSM is a newer

radio frequency («RF») technology than the current FM technology that has been used for

radio communications for decades. The GSM standard has been established for use in the

European community and elsewhere. Your modem is actually a low power radio

transmitter and receiver. It sends out and receives radio frequency energy. When you use

your modem, the cellular system handling your calls controls both the radio frequency

and the power level of your cellular modem.

Efficient Modem Operation:

For our modem to operate at the lowest power level, consistent with satisfactory

call quality: If your modem has an extendible antenna, extend it fully. Some models allow

Page 20: LPG

you to place a call with the antenna retracted. However your modem operates more

efficiently with the antenna fully extended. Do not hold the antenna when the modem is

«IN USE». Holding the antenna affects call quality and may cause the modem to operate

at a higher power level than needed.

Antenna Care and Replacement:

Do not use the modem with a damaged antenna. If a damaged antenna comes into

contact with the skin, a minor burn may result. Replace a damaged antenna immediately.

Consult your manual to see if you may change the antenna yourself. If so, use only a

manufacturer-approved antenna. Otherwise, have your antenna repaired by a qualified

technician. Use only the supplied or approved antenna. Unauthorized antennas,

modifications or attachments could damage the modem and may contravene local RF

emission regulations or invalidate type approval.

Driving:

Check the laws and regulations on the use of cellular devices in the area where

you drive. Always obey them. Also, when using your modem while driving, please: give

full attention to driving, pull off the road and park before making or answering a call if

driving conditions so allow. When applications are prepared for mobile use they should

fulfil road-safety instructions of the current law!

Electronic Devices:

Most electronic equipment, for example in hospitals and motor vehicles is

shielded from RF energy. However RF energy may affect some malfunctioning or

improperly shielded electronic equipment.

Vehicle Electronic Equipment:

Check your vehicle manufacturer’s representative to determine if any on board

electronic equipment is adequately shielded from RF energy.

Transmitters:

Performance is critical in three areas: in-channel, out-of-channel, and out-of band

In-channel measurements determine the link quality seen by the user in question:

Phase error and mean frequency error

Page 21: LPG

Mean transmitted RF carrier power

Transmitted RF carrier power versus time

Out-of-channel measurements determine how much interference the user causes other

GSM users:

• Spectrum due to modulation and wide band noise

• Spectrum due to switching

• TX and RX band spurious

Out-of-band measurements determine how much interference the user causes

other users of the radio spectrum (military, aviation, and police):

Other spurious (cross band and wideband)

Receivers:

Performance is critical in the following area: sensitivity. Sensitivity measurements

determine the link quality seen by the user in low signal level conditions:

Static reference sensitivity level

Origins of Measurements:

GSM transmitter and receiver measurements originate from the following ETSI

3GPP standards:

• 3GPP TS 05.05.V8.12.0: Radio access network; radio transmission and reception

• 3GPP TS 11.21 V8.6.0: Base station system (BSS) equipment specification; radio

aspects.

It is worth noting that these specifications were written for the purposes of full

type approval and they are extensive. It is not practical to make the whole suite of

measurements in most application areas. For example, in manufacturing where

throughput and cost are key drivers, it is necessary to use a subset of the measurements

defined in the specifications above. Optimization is key, the objective should be to test

sufficiently to prove correct assembly, perform correct calibration and assure correct field

operation, but with a minimum of expense. It is not necessary to type approve

infrastructure component shipped. This application note aims to help the reader to

interpret the standards and apply tests appropriately. The standards can be difficult to

understand, and independent parties might interpret them differently. Agilent

Technologies uses the standards as a basis from which to design measurement algorithms

Page 22: LPG

Attention commands:

GSM engines are referred to as following term:

1) ME (Mobile Equipment);

2) MS (Mobile Station);

3) TA (Terminal Adapter);

4) DCE (Data Communication Equipment) or facsimile DCE(FAX modem, FAX board);

In application, controlling device controls the GSM engine by sending AT Command via

its serial interface. The controlling device at the other end of the serial line is referred to

as following term:

1) TE (Terminal Equipment);

2) DTE (Data Terminal Equipment) or plainly “the application” which is running on an

embedded system;

AT Command syntax

The "AT" or "at" prefix must be set at the beginning of each command line. To terminate

a command line enter <CR>.

Commands are usually followed by a response that

includes.”<CR><LF><response><CR><LF>”

Throughout this document, only the responses are presented, <CR><LF> are omitted

intentionally.

The AT command set implemented by SIM300 is a combination of GSM07.05,

GSM07.07 and ITU-T recommendation V.25ter and the AT commands developed by

SIMCOM.

Note: Only enter AT command through serial port after SIM300 is power on and

Unsolicited Result Code “RDY” is received from serial port. And if unsolicited

result code”SCKS: 0” returned it indicates SIM card isn’t present. If autobauding is

enabled, the Unsolicited Result Codes “RDY” and so on are not indicated when you

start up the MEExtended Syntax

These commands can operate in several modes, as following table:

Table 1: Types of AT commands and

responses Test command

AT+<x>=? The mobile equipment

returns the list of

Page 23: LPG

parameters and value

ranges set with the

corresponding Write

command or by internal

processes.

Read command AT+<x>? This command returns the

currently set value of the

parameter or parameters.

Write command AT+<x>=<…> This command sets the

user-definable parameter

values.

Execution command AT+<x> The execution command

reads non-variable

parameters affected by

internal processes in the

GSM engine

Combining AT commands on the same command line

You can enter several AT commands on the same line. In this case, you do not need to

type the “AT” or “at” prefix before every command. Instead, you only need type “AT” or

“or” at the beginning of the command line. Please note to use a semicolon as command

delimiter.

The command line buffer can accept a maximum of 256 characters. If the characters

entered exceeded this number then none of the command will executed and TA will

returns “ERROR”.

1.4.5 Entering successive AT commands on separate lines

When you need to enter a series of AT commands on separate lines, please note that you

need to wait the final response (for example OK, CME error, CMS error) of last AT

command you entered before you enter the next AT command.

1.5 Supported character sets

The SIM300 AT command interface defaults to the IRA character set. The SIM300

supports the following character sets:

Page 24: LPG

• GSM format

• UCS2

• HEX

• IRA

• PCCP437

• PCDN

• 8859_1

The character set can be set and interrogated using the “AT+CSCS” command (GSM

07.07). The character set is defined in GSM specification 07.05.

Overview of AT Commands According to GSM07.05

AT+CMGF SELECT SMS MESSAGE

FORMAT

AT+CMGF Select SMS Message Format AT+CMGF Select SMS Message Format

Read Command

AT+CMGF?

Response

+CMGF: <mode>

OK

Parameters

see write

command

Test Command

AT+CMGF=?

Response

+CMGF: list of supported <mode>s

OK

Write Command

AT+CMGF=[<mode>]

Response

TA sets parameter to denote which

input and output format of messages to

use.

OK

Parameters

0 PDU mode

1 text mode

Page 25: LPG

ATE SET COMMAND ECHO MODE

ATE Set command echo mode ATE Set command echo mode

Write command

ATE[<value>]

Response

This setting determines whether or not

the TA echoes characters received from

TE during command state.

OK

Parameter

0 Echo mode off

1 Echo mode on

AT+CMGS SEND SMS MESSAGE

Response

TA sends message from a TE to the network (SMS-SUBMIT). Message reference value

<mr> is returned to the TE on successful message delivery. Optionally (when +CSMS

<service> value is 1 and network supports) <scts> is returned. Values can be used to

identify message upon unsolicited delivery status report result code.

1) If text mode(+CMGF=1) and sending successful:

+CMGS: <mr>

OK

2) If PDU mode(+CMGF=0) and sending successful:

+CMGS: <mr>

OK

3)If error is related to ME functionality:

+CMS ERROR: <err>

Page 26: LPG

LCD 16x2

Liquid crystal display is very important device in embedded system. It offers high

flexibility to user as he can display the required data on it. But due to lack of proper

approach to LCD interfacing many of them fail. Many people consider LCD interfacing a

complex job but according to me LCD interfacing is very easy task, you just need to have

a logical approach. This page is to help the enthusiast who wants to interface LCD with

through understanding. Copy and Paste technique may not work when an embedded

system engineer wants to apply LCD interfacing in real world projects.

You will be knowing about the booster rockets on space shuttle. Without these booster

rockets the space shuttle would not launch in geosynchronous orbit. Similarly to

understand LCD interfacing you need to have booster rockets attached! To get it done

right you must have general idea how to approach any given LCD.This page will help you

develop logical approach towards LCD interfacing.

First thing to begin with is to know what LCD driver/controller is used in LCD.Yes, your

LCD is dumb it does not know to talk with your microcontroller. LCD driver is a link

between the microcontroller and LCD. You can refer the datasheet of LCD to know the

LCD driver for e.g. JHD 162A is name of LCD having driver HD44780U.You have to

interface the LCD according to the driver specification. To understand the algorithm of

LCD interfacing user must have datasheet of both LCD and LCD driver. Many people

ignore the datasheets and end up in troubles. If you want to interface LCD successfully

you must have datasheets.

Why people ignore datasheets? Most of us do not like to read 100 pages of datasheet. But

for a accurate technical specification datasheets are must. I will show you a technique to

manipulate a datasheet within minutes.

First thing to find out in datasheet is the features viz. operating voltage, type of interface,

maximum speed for interface in MHz, size of display data RAM, number of pixels, bits

per pixel, number of row and columns. You must have the pin diagram of LCD.Pin

diagram of LCD driver can be omitted.

Page 27: LPG

Study the type of communication protocol whether it is parallel or serial interface. Check

how LCD discriminates data bytes and command bytes, which pins on LCD are used for

communication. Study Interface timing diagram given in the datasheet.

From datasheet of LCD driver find out whether hardware reset is required at startup, what

is the time of reset pulse, is it active low and which pins of LCD are to be toggled.

Major task in LCD interfacing is the initialization sequence. In LCD initialization you

have to send command bytes to LCD. Here you set the interface mode, display mode,

address counter increment direction, set contrast of LCD, horizontal or vertical addressing

mode, color format. This sequence is given in respective LCD driver datasheet. Studying

the function set of LCD lets you know the definition of command bytes. It varies from

one LCD to another. If you are able to initialize the LCD properly 90% of your job is

done.

Next step after initialization is to send data bytes to required display data RAM memory

location. Firstly set the address location using address set command byte and than send

data bytes using the DDRAM write command. To address specific location in display

data RAM one must have the knowledge of how the address counter is incremented.

LCD INTERFACING:

The most commonly used Character based LCDs are based on Hitachi's HD44780

controller or other which are compatible with HD44580. In this, we will discuss about

character based LCDs, their interfacing with various microcontrollers, various interfaces

(8-bit/4-bit), programming, special stuff and tricks you can do with these simple looking

LCDs which can give a new look to your application.

Pin Description:

The most commonly used LCDs found in the market today are 1 Line, 2 Line or 4 Line

LCDs which have only 1 controller and support at most of 80 characters, whereas LCDs

supporting more than 80 characters make use of 2 HD44780 controllers. Most LCDs with

1 controller has 14 Pins and LCDs with 2 controller has 16 Pins (two pins are extra in

both for back-light LED connections). Pin description is shown in the table below.

Page 28: LPG

Character LCD type HD44780 Pin diagram

Character LCD pins with 1 Controller

Page 29: LPG

Character LCD pins with 2 Controller

DDRAM-Display data RAM:

Display data RAM (DDRAM) stores display data represented in 8-bit character codes. Its

extended capacity is 80 X 8 bits, or 80 characters. The area in display data RAM

(DDRAM) that is not used for display can be used as general data RAM. So whatever you

send on the DDRAM is actually displayed on the LCD. For LCDs like 1x16, only 16

characters are visible, so whatever you write after 16 chars is written in DDRAM but is

not visible to the user.

Figures below will show you the DDRAM addresses of 1 Line, 2 Line and 4 Line LCDs.

DDRAM Address for 1 Line LCD

Page 30: LPG

DDRAM Address for 2 Line LCD

DDRAM Address for 4 Line LCD

CGROM - Character Generator ROM

Now you might be thinking that when you send an ASCII value to DDRAM, how the

character is displayed on LCD? So the answer is CGROM. The character generator ROM

generates 5 x 8 dot or 5 x 10 dot character patterns from 8-bit character codes. It can

generate 208 5 x 8 dot character patterns and 32 5 x 10 dot character patterns. User

defined character patterns are also available by mask-programmed ROM.

CGRAM - Character Generator RAM

CGRAM area is used to create custom characters in LCD. In the character generator

RAM, the user can rewrite character patterns by program. For 5 x 8 dots, eight character

patterns can be written, and for 5 x 10 dots, four character patterns can be written.

BF - Busy Flag

Busy Flag is a status indicator flag for LCD. When we send a command or data to the

LCD for processing, this flag is set (i.e. BF =1) and as soon as the instruction is executed

successfully this flag is cleared (BF = 0). This is helpful in producing and exact amount

of delay. To read Busy Flag, the condition RS = 0 and R/W = 1 must be met and The

MSB of the LCD data bus (D7) act as busy flag. When BF = 1 means LCD is busy and

Page 31: LPG

will not accept next command or data and BF = 0 means LCD is ready for the next

command or data to process.

Instruction Register (IR) and Data Register (DR)

There are two 8-bit registers in HD44780 controller Instruction and Data register.

Instruction register corresponds to the register where you send commands to LCD e.g.

LCD shift command, LCD clear, LCD address etc. and Data register is used for storing

data

, which is to be displayed on LCD when send the enable signal of the LCD is asserted, the

data on the pins is latched in to the data register and data is then moved automatically to

the DDRAM and hence is displayed on the LCD?

Data Register is not only used for sending data to DDRAM but also for CGRAM, the

address where you want to send the data, is decided by the instruction you send to LCD.

Commands and Instruction set

Only the instruction register (IR) and the data register (DR) of the LCD can be controlled

by the MCU. Before starting the internal operation of the LCD, control information is

temporarily stored into these registers to allow interfacing with various MCUs, which

operate at different speeds, or various peripheral control devices. The internal operation

of the LCD is determined by signals sent from the MCU. These signals, which include

register selection signal (RS), read/write signal (R/W), and the data bus (DB0 to DB7),

make up the LCD instructions (table below). There are four categories of instructions

that:

Designate LCD functions, such as display format, data length, etc.

Set internal RAM addresses

Perform data transfer with internal RAM

Perform miscellaneous functions

Page 32: LPG

Table: Command and Instruction set for LCD type HD44780

Although looking at the table you can make your own commands and test them. Below is

a brief list of useful commands which are used frequently while working on the LCD.

Page 33: LPG

Frequently used commands and instructions for LCD

LCD Initialization

Before using the LCD for display purpose, LCD has to be initialized either by the internal

reset circuit or sending set of commands to initialize the LCD. It is the user who has

to decide whether an LCD has to be initialized by instructions or by internal reset circuit.

we will discuss both ways of initialization one by one.

Initialization by internal Reset Circuit

An internal reset circuit automatically initializes the HD44780U when the power is turned

on. The following instructions are executed during the initialization. The busy flag (BF) is

kept in the busy state until the initialization ends (BF = 1). The busy state lasts for 10 ms

after VCC rises to 4.5 V.

Display clear

Page 34: LPG

Function set:

DL = 1; 8-bit interface data

N = 0; 1-line display

F = 0; 5 x 8 dot character font

Display on/off control:

D = 0; Display off

C = 0; Cursor off

B = 0; Blinking off

Entry mode set:

I/D = 1; Increment by 1

S = 0; No shift

Power Supply condition for Internal Reset circuit

Figure 7 shows the test conditions which are to be met for internal reset circuit to be

active.

Now the problem with the internal reset circuit is, it is highly dependent on power supply,

to meet this critical power supply conditions is not hard but are difficult to achieve when

Page 35: LPG

you are making a simple application. So usually the second method i.e. Initialization by

instruction is used and is recommended most of the time.

Initialization by instructions

Initializing LCD with instructions is really simple. Given below is a flowchart that

describes the step to follow, to initialize the LCD.

Flow chart for LCD initialization

As you can see from the flow chart, the LCD is initialized in the following sequence.

1) Send command 0x30 - Using 8-bit interface

2) Delay 20ms

3) Send command 0x30 - 8-bit interface

4) Delay 20ms

Page 36: LPG

5) Send command 0x30 - 8-bit interface

6) Delay 20ms

7) Send Function set - see Table 4 for more information

8) Display Clear command

9) Set entry mode command - explained below

The first 3 commands are usually not required but are recommended when you are using

4-bit interface. So you can program the LCD starting from step 7 when working with 8-

bit interface. Function set command depends on what kind of LCD you are using and

what kind of interface you are using.

LCD interfacing with Microcontrollers-4bit mode

In 4-bit mode the data is sent in nibbles, first we send the higher nibble and then the lower

nibble. To enable the 4-bit mode of LCD, we need to follow special sequence of

initialization that tells the LCD controller that user has selected 4-bit mode of operation. We

call this special sequence as resetting the LCD. Following is the reset sequence of LCD.

Wait for about 20mS

Send the first init value (0x30)

Wait for about 10mS

Send second init value (0x30)

Wait for about 1mS

Send third init value (0x30)

Wait for 1mS

Select bus width (0x30 - for 8-bit and 0x20 for 4-bit)

Wait for 1mS

The busy flag will only be valid after the above reset sequence. Usually we do not use

busy flag in 4-bit mode as we have to write code for reading two nibbles from the LCD.

Instead we simply put a certain amount of delay usually 300 to 600uS. This delay might

vary depending on the LCD you are using, as you might have a different crystal

frequency on which LCD controller is running. So it actually depends on the LCD

Page 37: LPG

module you are using. So if you feel any problem running the LCD, simply try to increase

the delay. This usually works.

LCD connections in 4-bit Mode

Above is the connection diagram of LCD in 4-bit mode, where we only need 6 pins to

interface an LCD. D4-D7 are the data pins connection and Enable and Register select are

for LCD control pins. We are not using Read/Write (RW) Pin of the LCD, as we are only

writing on the LCD so we have made it grounded permanently. If you want to use it.

Then you may connect it on your controller but that will only increase another pin and

does not make any big difference. Potentiometer RV1 is used to control the LCD contrast.

The unwanted data pins of LCD i.e. D0-D3 are connected to ground.

ONEWIRE PROTOCAL FOR TEMPERATURE SENSOR DS1820

Page 38: LPG

1-Wire is a device communications bus system designed by Dallas Semiconductor Corp.

that provides low-speed data, signaling, and power over a single signal.[1] 1-Wire is

similar in concept to I²C, but with lower data rates and longer range. It is typically used to

communicate with small inexpensive devices such as digital thermometers and weather

instruments. A network of 1-Wire devices with an associated master device is called a

MicroLan.

One distinctive feature of the bus is the possibility to use only two wires: data and

ground. To accomplish this, 1-wire devices include an 800 pF capacitor to store charge,

and power the device during periods where the data line is used for data.

Dependent on function, native 1-wire devices are available as single components in

integrated circuit and TO92 packaging, and in some cases a portable form called an

iButton that resembles a watch battery. Manufacturers also produce products that are

more complex than a single component, and use the 1-wire bus to communicate.

A 1-Wire device may be just one of many components on a circuit board within a

product, but are also found in isolation within devices such as a temperature sensor probe,

or attached to a device being monitored. Some laboratory systems and other data

acquisition and control systems connect to 1-Wire devices using cords with modular

connectors or with CAT-5 cable, with the devices themselves mounted in a socket,

incorporated in a small PCB, or attached to the object being monitored. In such systems,

RJ11 (6P2C or 6P4C modular plugs, commonly used for telephones) are popular.

Systems of sensors and actuators can be built by wiring together 1-Wire components,

each including all of the logic needed to operate on the 1-Wire bus. Examples include

temperature loggers, timers, voltage and current sensors, battery monitors, and memory.

These can be connected to a PC using a bus converter. USB, RS-232 serial, and parallel

port interfaces are popular solutions for connecting the MicroLan to the host PC.

MicroLans also interface to microcontrollers, such as the Arduino, Parallax BASIC

Stamp, Parallax Propeller, PICAXE, the Microchip PIC family and RENESAS family.

The iButton (also known as the Dallas Key) is a mechanical packaging standard that

places a 1-Wire component inside a small stainless steel "button" similar to a disk-shaped

battery. iButtons are connected to 1-Wire bus systems by means of sockets with contacts

which touch the "lid" and "base" of the canister. iButtons are used as Akbil smart tickets

Page 39: LPG

for the Public transport in Istanbul. Alternatively, the connection can be semi-permanent

with a different socket type; the iButton clips into it, but is easily removed.

The Java Ring, a ring-mounted iButton with a Java Virtual Machine compatible with the

Java Card 2.0 specification within, was given to attendees of the JavaOne 1998

conference.[2]

Each 1-Wire chip has a unique code buried within it. This feature makes the chips,

especially in an iButton package, ideal for use as a key to open a lock, arm and deactivate

burglar alarms, authenticate computer system users, operate time clock systems, and other

similar uses.

Use of the bus

In any MicroLan, there is always exactly one master in overall charge, which may be a

PC or a microcontroller. The master initiates activity on the bus, simplifying the

avoidance of collisions on the bus. Protocols are built into the software to detect

collisions. After a collision, the master tries again to effect the required communication.

The Dallas 1-Wire network is physically implemented as an open drain master device

connected to one or more open drain slaves[3] . A single pull-up resistor is common to all

devices and acts to pull the bus up to 3 or 5 volts, and may provide power to the slave

devices. Communication occurs when a master or slave asserts the bus low—that is,

connects the pull up resistor to ground through its output MOSFET. Specific 1-Wire

driver and bridge chips are also available. Data rates of 16.3 kbit/s can be achieved. There

is also an overdrive mode which speeds up the communication by a factor of 10.

The master starts a transmission with a "reset" pulse, which pulls the wire to 0 volts for

480 µs. This resets every slave device on the bus, probably by depriving them all of

power. After that, any slave device, if present, shows that it exists with a "presence"

pulse: it holds the wire to ground for at least 60 µs after the master releases the bus.

To send a "1", the bus master software sends a very brief (1 - 15 µs) low pulse. To send a

"0", the software sends a 60 µs low pulse. The falling (negative) edge of the pulse is used

to start a monostable multivibrator in the slave device. The multivibrator in the slave

clocks to read the data line about 30 µs after the falling edge. The slave's multivibrator

Page 40: LPG

unavoidably has analog tolerances that affect its timing accuracy, which is why the output

pulses have to be 60 µs long, and the starting pulse can't be longer than 15 µs.

If a parallel port is inconvenient or the operating system interferes with the timing, a

UART running at 100 kbit/s with a few resistors and special software can produce and

sense acceptable 1-wire pulses. Serial or USB "bridge" chips are also available that

handle the timing and waveform requirements of the 1-Wire bus, and are particularly

useful in utilizing long (greater than 100 m) cables effectively. Up to 300 meter long

buses consisting of simple twistedpair telephone cable has been tested by the

manufacturer. It will however require adjustment of pull-up resistances from say 5kΩ to 1

kΩ.

When receiving data, the master sends a 1-15 µs 0 volt pulse to start each bit. If the

transmitting slave unit wants to send a "1", it does nothing, and the wire goes

immediately up to the pulled-up voltage. If the transmitting slave wants to send a "0", it

pulls the data line to ground for 60 µs.

The basic sequence is a reset pulse followed by an 8-bit command, and then data is sent

or received in groups of 8-bits.

When a sequence of data is being transferred, errors can be detected with an 8-bit CRC

(weak data protection).

Many devices can share the same bus. Each device on the bus has a unique 64-bit serial

number. The least significant byte of the serial number is an 8-bit number that tells the

type of the device. The most significant byte is a standard (for the 1-wire bus) 8-bit CRC.[4]

There are several standard broadcast commands, and commands addressed to particular

devices. The master can send a selection command, and then the address of a particular

device, and then the next command is executed only by the selected device.

The bus also has an algorithm to recover the address of every device on the bus. Since the

address includes the device type and a CRC, recovering the address roster also produces a

reliable inventory of the devices on the bus. The 64-bit address space is searched as a

binary tree, allowing up to 75 devices to be found per second.

Page 41: LPG

To find the devices, the master broadcasts an enumeration command, and then an address,

"listening" after each bit of an address. If a slave has all the address bits so far, it returns a

0. The master uses this simple behavior to search systematically for valid sequences of

address bits. The process is much faster than a brute force search of all possible 64-bit

numbers because as soon as an invalid bit is detected, all subsequent address bits are

known to be invalid. An enumeration of 10 or 15 devices finishes very quickly.

The location of devices on the bus is sometimes significant. For these situations, the

manufacturer has a special device that either passes through the bus or switches it off.

Software can therefore explore sequential

Example communication with a device

The following signals were generated by an FPGA, which was the master for the

communication with a DS2432 (EEPROM) chip, and measured with a logic analyzer.

High on the 1-wire output means that the output of the FPGA is in tri-state mode and the

1-wire device can pull down the bus. Low means that the FPGA pulls down the bus. The

1-wire input is the measured bus signal. On input sample time high, the FPGA samples

the input for detecting the device response and receiving bits.

Page 42: LPG

MAX232

The MAX232 is an integrated circuit that converts signals from an RS-232 serial port to

signals suitable for use in TTL compatible digital logic circuits. The MAX232 is a dual

driver/receiver and typically converts the RX, TX, CTS and RTS signals.

The drivers provide RS-232 voltage level outputs (approx. ± 7.5 V) from a single + 5 V

supply via on-chip charge pumps and external capacitors. This makes it useful for

implementing RS-232 in devices that otherwise do not need any voltages outside the 0 V

to + 5 V range, as power supply design does not need to be made more complicated just

for driving the RS-232 in this case.

The receivers reduce RS-232 inputs (which may be as high as ± 25 V), to standard 5 V

TTL levels. These receivers have a typical threshold of 1.3 V, and a typical hysteresis of

0.5 V.

The later MAX232A is backwards compatible with the original MAX232 but may

operate at higher baud rates and can use smaller external capacitors – 0.1 μF in place of

the 1.0 μF capacitors used with the original device.[1]

The newer MAX3232 is also backwards compatible, but operates at a broader voltage

range, from 3 to 5.5 V. [2]

[edit] Voltage levels

It is helpful to understand what occurs to the voltage levels. When a MAX232 IC receives

a TTL level to convert, it changes a TTL Logic 0 to between +3 and +15 V, and changes

TTL Logic 1 to between -3 to -15 V, and vice versa for converting from RS232 to TTL.

This can be confusing when you realize that the RS232 Data Transmission voltages at a

certain logic state are opposite from the RS232 Control Line voltages at the same logic

state. To clarify the matter, see the table below. For more information see RS-232

Voltage Levels.

Page 43: LPG

RS232 Line Type & Logic LevelRS232

Voltage

TTL Voltage to/from

MAX232

Data Transmission (Rx/Tx) Logic 0 +3 V to +15 V 0 V

Data Transmission (Rx/Tx) Logic 1 -3 V to -15 V 5 V

Control Signals (RTS/CTS/DTR/DSR)

Logic 0-3 V to -15 V 5 V

Control Signals (RTS/CTS/DTR/DSR)

Logic 1+3 V to +15 V 0 V

SERIAL COMMUNICATION

n telecommunication and computer science, the concept of serial communication is the

process of sending data one bit at a time, sequentially, over a communication channel or

computer bus. This is in contrast to parallel communication, where several bits are sent as

a whole, on a link with several parallel channels. Serial communication is used for all

long-haul communication and most computer networks, where the cost of cable and

synchronization difficulties make parallel communication impractical. Serial computer

buses are becoming more common even at shorter distances, as improved signal integrity

and transmission speeds in newer serial technologies have begun to outweigh the parallel

bus's advantage of simplicity (no need for serializer and deserializer, or SerDes) and to

outstrip its disadvantages (clock skew, interconnect density).

Serial versus parallel

The communication links across which computers—or parts of computers—talk to one

another may be either serial or parallel. A parallel link transmits several streams of data

(perhaps representing particular bits of a stream of bytes) along multiple channels (wires,

printed circuit tracks, optical fibres, etc.); a serial link transmits a single stream of data.

At first sight it would seem that a serial link must be inferior to a parallel one, because it

can transmit less data on each clock tick. However, it is often the case that serial links can

be clocked considerably faster than parallel links, and achieve a higher data rate. A

number of factors allow serial to be clocked at a greater rate:

Clock skew between different channels is not an issue (for unclocked

asynchronous serial communication links)

Page 44: LPG

A serial connection requires fewer interconnecting cables (e.g. wires/fibres) and

hence occupies less space. The extra space allows for better isolation of the

channel from its surroundings

Crosstalk is less of an issue, because there are fewer conductors in proximity.

In many cases, serial is a better option because it is cheaper to implement. Many ICs have

serial interfaces, as opposed to parallel ones, so that they have fewer pins and are

therefore less expensive.

In telecommunications, RS-232 (Recommended Standard 232) is the traditional name for

a series of standards for serial binary single-ended data and control signals connecting

between a DTE (Data Terminal Equipment) and a DCE (Data Circuit-terminating

Equipment). It is commonly used in computer serial ports. The standard defines the

electrical characteristics and timing of signals, the meaning of signals, and the physical

size and pinout of connectors. The current version of the standard is TIA-232-F Interface

Between Data Terminal Equipment and Data Circuit-Terminating Equipment Employing

Serial Binary Data Interchange, issued in 1997

Scope of the standard

The Electronic Industries Association (EIA) standard RS-232-C[1] as of 1969 defines:

Electrical signal characteristics such as voltage levels, signaling rate, timing and

slew-rate of signals, voltage withstand level, short-circuit behavior, and maximum

load capacitance.

Interface mechanical characteristics, pluggable connectors and pin identification.

Functions of each circuit in the interface connector.

Standard subsets of interface circuits for selected telecom applications.

The standard does not define such elements as

character encoding (for example, ASCII, Baudot code or EBCDIC)

the framing of characters in the data stream (bits per character, start/stop bits,

parity)

protocols for error detection or algorithms for data compression

Page 45: LPG

bit rates for transmission, although the standard says it is intended for bit rates

lower than 20,000 bits per second. Many modern devices support speeds of

115,200 bit/s and above

power supply to external devices.

Details of character format and transmission bit rate are controlled by the serial port

hardware, often a single integrated circuit called a UART that converts data from parallel

to asynchronous start-stop serial form. Details of voltage levels, slew rate, and short-

circuit behavior are typically controlled by a line driver that converts from the UART's

logic levels to RS-232 compatible signal levels, and a receiver that converts from RS-232

compatible signal levels to the UART's logic levels.

History

RS-232 was first introduced in 1962.[2] The original DTEs were electromechanical

teletypewriters and the original DCEs were (usually) modems. When electronic terminals

(smart and dumb) began to be used, they were often designed to be interchangeable with

teletypes, and so supported RS-232. The C revision of the standard was issued in 1969 in

part to accommodate the electrical characteristics of these devices.

Since application to devices such as computers, printers, test instruments, and so on was

not considered by the standard, designers implementing an RS-232 compatible interface

on their equipment often interpreted the requirements idiosyncratically. Common

problems were non-standard pin assignment of circuits on connectors, and incorrect or

missing control signals. The lack of adherence to the standards produced a thriving

industry of breakout boxes, patch boxes, test equipment, books, and other aids for the

connection of disparate equipment. A common deviation from the standard was to drive

the signals at a reduced voltage: the standard requires the transmitter to use +12 V and

−12 V, but requires the receiver to distinguish voltages as low as +3 V and -3 V. Some

manufacturers therefore built transmitters that supplied +5 V and -5 V and labeled them

as "RS-232 compatible."

Later personal computers (and other devices) started to make use of the standard so that

they could connect to existing equipment. For many years, an RS-232-compatible port

was a standard feature for serial communications, such as modem connections, on many

computers. It remained in widespread use into the late 1990s. In personal computer

Page 46: LPG

peripherals it has largely been supplanted by other interface standards, such as USB. RS-

232 is still used to connect older designs of peripherals, industrial equipment (such as

PLCs), console ports and special purpose equipment such as a cash drawer for a cash

register.

The standard has been renamed several times during its history as the sponsoring

organization changed its name, and has been variously known as EIA RS-232, EIA 232,

and most recently as TIA 232. The standard continued to be revised and updated by the

Electronic Industries Alliance and since 1988 by the Telecommunications Industry

Association (TIA).[3] Revision C was issued in a document dated August 1969. Revision

D was issued in 1986. The current revision is TIA-232-F Interface Between Data

Terminal Equipment and Data Circuit-Terminating Equipment Employing Serial Binary

Data Interchange, issued in 1997. Changes since Revision C have been in timing and

details intended to improve harmonization with the CCITT standard V.24, but equipment

built to the current standard will interoperate with older versions.

Limitations of the standard

Because the application of RS-232 has extended far beyond the original purpose of

interconnecting a terminal with a modem, successor standards have been developed to

address the limitations. Issues with the RS-232 standard include:[4]

The large voltage swings and requirement for positive and negative supplies

increases power consumption of the interface and complicates power supply

design. The voltage swing requirement also limits the upper speed of a compatible

interface.

Single-ended signaling referred to a common signal ground limits the noise

immunity and transmission distance.

Multi-drop connection among more than two devices is not defined. While multi-

drop "work-arounds" have been devised, they have limitations in speed and

compatibility.

Asymmetrical definitions of the two ends of the link make the assignment of the

role of a newly developed device problematic; the designer must decide on either

a DTE-like or DCE-like interface and which connector pin assignments to use.

Page 47: LPG

The handshaking and control lines of the interface are intended for the setup and

takedown of a dial-up communication circuit; in particular, the use of handshake

lines for flow control is not reliably implemented in many devices.

No method is specified for sending power to a device. While a small amount of

current can be extracted from the DTR and RTS lines, this is only suitable for low

power devices such as mice.

The 25-way connector recommended in the standard is large compared to current

practice.

Standard details

In RS-232, user data is sent as a time-series of bits. Both synchronous and asynchronous

transmissions are supported by the standard. In addition to the data circuits, the standard

defines a number of control circuits used to manage the connection between the DTE and

DCE. Each data or control circuit only operates in one direction, that is, signaling from a

DTE to the attached DCE or the reverse. Since transmit data and receive data are separate

circuits, the interface can operate in a full duplex manner, supporting concurrent data

flow in both directions. The standard does not define character framing within the data

stream, or character encoding.

Voltage levels

Diagrammatic oscilloscope trace of voltage levels for an uppercase ASCII "K" character

(0x4b) with 1 start bit, 8 data bits, 1 stop bit

The RS-232 standard defines the voltage levels that correspond to logical one and logical

zero levels for the data transmission and the control signal lines. Valid signals are plus or

minus 3 to 15 volts; the ±3 V range near zero volts is not a valid RS-232 level. The

standard specifies a maximum open-circuit voltage of 25 volts: signal levels of ±5 V, ±10

V, ±12 V, and ±15 V are all commonly seen depending on the power supplies available

within a device. RS-232 drivers and receivers must be able to withstand indefinite short

Page 48: LPG

circuit to ground or to any voltage level up to ±25 volts. The slew rate, or how fast the

signal changes between levels, is also controlled.

For data transmission lines (TxD, RxD and their secondary channel equivalents) logic one

is defined as a negative voltage, the signal condition is called marking, and has the

functional significance. Logic zero is positive and the signal condition is termed spacing.

Control signals are logically inverted with respect to what one sees on the data

transmission lines. When one of these signals is active, the voltage on the line will be

between +3 to +15 volts. The inactive state for these signals is the opposite voltage

condition, between −3 and −15 volts. Examples of control lines include request to send

(RTS), clear to send (CTS), data terminal ready (DTR), and data set ready (DSR).

Because the voltage levels are higher than logic levels typically used by integrated

circuits, special intervening driver circuits are required to translate logic levels. These

also protect the device's internal circuitry from short circuits or transients that may appear

on the RS-232 interface, and provide sufficient current to comply with the slew rate

requirements for data transmission.

Because both ends of the RS-232 circuit depend on the ground pin being zero volts,

problems will occur when connecting machinery and computers where the voltage

between the ground pin on one end, and the ground pin on the other is not zero. This may

also cause a hazardous ground loop. Use of a common ground limits RS-232 to

applications with relatively short cables. If the two devices are far enough apart or on

separate power systems, the local ground connections at either end of the cable will have

differing voltages; this difference will reduce the noise margin of the signals. Balanced,

differential, serial connections such as USB, RS-422 and RS-485 can tolerate larger

ground voltage differences because of the differential signaling.[6]

Unused interface signals terminated to ground will have an undefined logic state. Where

it is necessary to permanently set a control signal to a defined state, it must be connected

to a voltage source that asserts the logic 1 or logic 0 level. Some devices provide test

voltages on their interface connectors for this purpose.

Connectors

RS-232 devices may be classified as Data Terminal Equipment (DTE) or Data

Communication Equipment (DCE); this defines at each device which wires will be

Page 49: LPG

sending and receiving each signal. The standard recommended but did not make

mandatory the D-subminiature 25 pin connector. In general and according to the standard,

terminals and computers have male connectors with DTE pin functions, and modems

have female connectors with DCE pin functions. Other devices may have any

combination of connector gender and pin definitions. Many terminals were manufactured

with female terminals but were sold with a cable with male connectors at each end; the

terminal with its cable satisfied the recommendations in the standard.

Presence of a 25 pin D-sub connector does not necessarily indicate an RS-232-C

compliant interface. For example, on the original IBM PC, a male D-sub was an RS-232-

C DTE port (with a non-standard current loop interface on reserved pins), but the female

D-sub connector was used for a parallel Centronics printer port. Some personal computers

put non-standard voltages or signals on some pins of their serial ports.

The standard specifies 20 different signal connections. Since most devices use only a few

signals, smaller connectors can often be used.

NOT GATE

Traditional NOT Gate (Inverter) symbol

International Electrotechnical Commission NOT Gate (Inverter) symbol

In digital logic, an inverter or NOT gate is a logic gate which implements logical

negation. The truth table is shown on the right.

This represents perfect switching behavior, which is the defining assumption in Digital

electronics. In practice, actual devices have electrical characteristics that must be

carefully considered when designing inverters. In fact, the non-ideal transition region

INPUT

A

OUTPUT

NOT A

0 1

1 0

Page 50: LPG

An inverter circuit outputs a voltage representing the opposite logic-level to its input.

Inverters can be constructed using a single NMOS transistor or a single PMOS transistor

coupled with a resistor. Since this 'resistive-drain' approach uses only a single type of

transistor, it can be fabricated at low cost. However, because current flows through the

resistor in one of the two states, the resistive-drain configuration is disadvantaged for

power consumption and processing speed. Alternatively, inverters can be constructed

using two complementary transistors in a CMOS configuration. This configuration

greatly reduces power consumption since one of the transistors is always off in both logic

states. Processing speed can also be improved due to the relatively low resistance

compared to the NMOS-only or PMOS-only type devices. Inverters can also be

constructed with Bipolar Junction Transistors (BJT) in either a resistor-transistor logic

(RTL) or a transistor-transistor logic (TTL) configuration.

Digital electronics circuits operate at fixed voltage levels corresponding to a logical 0 or 1

(see Binary). An inverter circuit serves as the basic logic gate to swap between those two

voltage levels. Implementation determines the actual voltage, but common levels include

(0, +5V) for TTL circuits.

BUZZER

A buzzer or beeper is an audio signaling device, which may be mechanical,

electromechanical, or electronic. Typical uses of buzzers and beepers include alarms,

timers and confirmation of user input such as a mouse click or keystroke.

Electromechanical

Early devices were based on an electromechanical system identical to an electric bell

without the metal gong. Similarly, a relay may be connected to interrupt its own actuating

current, causing the contacts to buzz. Often these units were anchored to a wall or ceiling

to use it as a sounding board. The word "buzzer" comes from the rasping noise that

electromechanical buzzers made.

Page 51: LPG

Electronic

Piezoelectric disk beeper

A piezoelectric element may be driven by an oscillating electronic circuit or other audio

signal source. Sounds commonly used to indicate that a button has been pressed are a

click, a ring or a beep. Electronic buzzers find many applications in modern days.

Gas detector

A gas detector is a device which detects the presence of various gases within an area,

usually as part of a safety system. This type of equipment is used to detect a gas leak and

interface with a control system so a process can be automatically shut down. A gas

detector can also sound an alarm to operators in the area where the leak is occurring,

giving them the opportunity to leave the area. This type of device is important because

there are many gases that can be harmful to organic life, such as humans or animals.

Gas detectors can be used to detect combustible, flammable and toxic gases, and oxygen

depletion. This type of device is used widely in industry and can found in a variety of

locations such as on oil rigs, to monitor manufacture processes and emerging

technologies such as photovoltaic. They may also be used in firefighting.

Gas detectors are usually battery operated. They transmit warnings via a series of audible

and visible signals such as alarms and flashing lights, when dangerous levels of gas

vapors are detected. As detectors measure a gas concentration, the sensor responds to a

calibration gas, which serves as the reference point or scale. As a sensor’s detection

exceeds a preset alarm level, the alarm or signal will be activated. As units, gas detectors

are produced as portable or stationary devices. Originally, detectors were produced to

detect a single gas, but modern units may detect several toxic or combustible gases, or

even a combination of both types

Page 52: LPG

Types

Gas detectors come in two main types: portable devices and fixed gas detectors. The first

is used to monitor the atmosphere around personnel and is worn on clothing or on a

belt/harness. They can also be classified according to the operation mechanism

(semiconductors, oxidation, catalytic, infrared, etc.).

Oxygen concentration

Oxygen deficiency gas monitors are used for employee and workforce safety. Cryogenics

such as liquid nitrogen (LN2), helium (He), and argon (Ar) are inert and can displace

oxygen (O2) in a confined space if a leak is present. A rapid decrease of oxygen can

provide a very dangerous environment for employees. With this in mind, an oxygen gas

monitor is important to have when cryogenics are present. Laboratories, MRI rooms,

pharmaceutical, semiconductor, and cryogenic suppliers are typical customers.

Oxygen fraction in a breathing gas is measured by electro-galvanic fuel cell sensors. They

may be used stand-alone, for example to determine the proportion of oxygen in a nitrox

mixture used in scuba diving,[2] or as part of feeback loop which maintains a constant

partial pressure of oxygen in a rebreather.[3]

Gas leak detection

Gas leak detection is the process of identifying potentially hazardous gas leaks by means

of various sensors. These sensors usually employ an audible alarm to alert people when a

dangerous gas has been detected. Common sensors used today include Infrared Point

Sensors, Ultrasonic Sensors, Electrochemical Sensors, and Semiconductor Sensors. These

sensors are used for a wide range of applications, and can be found in industrial plants,

refineries, wastewater treatment facilities, vehicles, and around the home.

History

Gas leak detection methods became a concern after the effects of harmful gases on human

health were discovered. Before modern electronic sensors, early detection methods relied

on less precise detectors. Through the 19th and early 20th centuries, coal miners would

bring canaries down to the tunnels with them as an early detection system against life

threatening gases such as carbon monoxide and methane. The canary, normally a very

Page 53: LPG

songful bird, would stop singing and eventually die in the presence of these gases,

signaling the miners to exit the mine quickly. Before the development of electronic

household carbon monoxide detectors in the 1980s and 90s, carbon monoxide presence

was detected with a chemically infused paper that turned brown when exposed to the gas.

Since then, many technologies and devices have been developed to detect, monitor, and

alert the leakage of a wide array of gases.

Types of Gas Detectors

Electrochemical Detectors

Electrochemical gas detectors work by allowing gases to diffuse through a porous

membrane to an electrode where it is either oxidized or reduced. The amount of current

produced is determined by how much of the gas is oxidized at the electrode.[1] The sensor

is then able to determine the concentration of the gas. Manufactures can customize

electrochemical gas detectors by changing the porous barrier to allow for the detection of

a certain gas concentration range. Also, since the diffusion barrier is a

physical/mechanical barrier, the detector tends to be more stable and reliable over the

sensor's duration and thus requires less maintenance than other types of detectors.

However, the sensors themselves are subject to corrosive elements and may last only 1-2

years before a replacement is required.[2] Electrochemical gas detectors are used in a wide

variety of environments such as refineries, gas turbines, chemical plants, underground gas

storage facilities, and more.

Infrared Point Detectors

Infrared point sensors (IR) use radiation passing through a volume of gas to detect leaks.

Energy from the radiation is absorbed as it passes through the gas at certain wavelengths.

The range of wavelengths that is absorbed depends on the properties of the specific gas.

Carbon monoxide absorbs wavelengths of about 4.2-4.5 μm, for example.[3] This is

approximately a factor of 10 larger than the wavelength of visible light, which ranges

from .39 μm to .75 μm for most people. The energy in this wavelength is compared to a

wavelength outside of the absorption range; the difference in energy between these two

wavelengths is proportional to the concentration of gas present.[4] This type of sensor is

advantageous because it does not have to be placed in the gas itself in order to detect it.

Infrared point sensors can be used to detect hydrocarbons,[5] compounds composed of

hydrogen and carbon atoms, and other infrared active gases such as water vapor and

Page 54: LPG

calcium fluoride. IR sensors are commonly found in wastewater treatment facilities,

refineries, gas turbines, chemical plants, and other facilities where flammable gases are

present and the possibility of an explosion exists. Engine emissions are another area

where IR sensors are being researched for use. The sensor would be able to detect high

levels of carbon dioxide in the vehicles’ exhaust, and even be integrated with the

vehicles’ electronic systems to notify drivers.[6]

Semiconductor Detectors

Semiconductor sensors detect gases by a chemical reaction that takes place when the gas

comes in contact with the sensor. Tin dioxide is the most common material used in

semiconductor sensors,[7] and the electrical resistance in the sensor is decreased when it

comes in contact with the monitored gas. The resistance of the tin dioxide is typically

around 50 kΩ in air but can drop to around 3.5 kΩ in the presence of 1% methane.[8] This

change in resistance is used to calculate the gas concentration. Semiconductor sensors are

commonly used to detect hydrogen, oxygen, alcohol, and harmful gases such as carbon

monoxide.[9] One of the most common uses for semiconductor sensors is in carbon

monoxide sensors. They are also used in breathalyzers.[10] Because the sensor must come

in contact with the gas in order to detect it, semiconductor sensors work in a smaller

range than infrared point or ultrasonic detectors.

Ultrasonic Detectors

Ultrasonic gas detectors use acoustic sensors to detect changes in the background noise of

its environment. Since most gas leaks occur in the ultrasonic range of 25 kHz to 10 MHz,

the sensors are able to easily distinguish these frequencies from background noise which

occurs in the audible range of 20 Hz to 20 kHz.[11] The ultrasonic gas leak detector then

produces an alarm when there is an ultrasonic deviation from the normal condition of

background noise. Despite the fact that Ultrasonic gas leak detectors don’t measure gas

concentration, the device is still able to determine the leak rate of an escaping gas. [12] By

measuring its ultrasonic sound level, the detector is able to determine the leak rate, which

depends on the gas pressure and size of the leak. The bigger the leak, the larger its

ultrasonic sound level will be. Ultrasonic gas detectors are mainly used for outdoor

environments where weather conditions can easily dissipate escaping gas before allowing

it to reach gas leak detectors that require contact with the gas in order to detect it and

sound an alarm. These detectors are commonly found on offshore and onshore oil/gas

Page 55: LPG

platforms, gas compressor and metering stations, gas turbine power plants, and other

facilities that house a lot of outdoor pipeline.

Holographic Detectors

Holographic gas Sensor use light reflection to detect changes in a polymer film matrix

containing a hologram. Since holograms reflect light at certain wavelengths a change in

their composition can generate a colorful reflection indicative of the presence of a gas

molecule[13]. Holographic sensor require however illumination sources such as white light

or lasers and an observer or CCD detector.

Household Safety

There are many different sensors that can be purchased to detect hazardous gases around

the house. Carbon monoxide is a very dangerous gas that robs the lungs of oxygen, killing

hundreds of people worldwide each year. It is an odorless, colorless gas, making it

impossible for humans to detect it. Carbon monoxide detectors can be purchased for

around $20-60. Handheld flammable gas detectors can be used to trace leaks from natural

gas lines, propane tanks, butane tanks, or any other combustible gas

Page 56: LPG

Regulator:

FIG 4.10: REGULATOR CIRCUIT

A discrete voltage regulator fabricated on a single chip, it is called monolithic voltage

regulator. These regulators have:

• High performance (ideal 100% regulation)

• Low cost.

• Reduced size.

• Easier to use.

Usually monolithic voltage regulator is available as 3 terminals IC7805 as shown in

below figure. The 3 terminals are denoted as IN (input), COM (common), OUT (output).

This +5V regulator is useful in power up to 500mw.It must have a heat sink for high

current. A 1mf high quality and tantalum capacitor should be placed from output to

ground for stability. By using this regulator circuit we are deriving 5v from 12v battery.

Transformer:

Transformers convert AC electricity from one voltage to another with little loss of

power. Transformers work only with AC and this is one of the reasons why mains

electricity is AC. Step-up transformers increase voltage, step-down transformers reduce

voltage. Most power supplies use a step-down transformer to reduce the dangerously high

mains voltage (230V in India) to a safer low voltage. The input coil is called the primary

Page 57: LPG

and the output coil is called the secondary. There is no electrical connection between the

two coils; instead they are linked by an alternating magnetic field created in the soft-iron

core of the transformer. Transformers waste very little power so the power out is (almost)

equal to the power in. Note that as voltage is stepped down current is stepped up. The

transformer will step down the power supply voltage (0-230V) to (0- 12V) level. Then the

secondary of the potential transformer will be connected to the bridge rectifier, which is

constructed with the help of PN junction diodes. The advantages of using bridge rectifier

are it will give peak voltage output as DC.

Rectifier:

There are several ways of connecting diodes to make a rectifier to convert AC to

DC. The bridge rectifier is the most important and it produces full-wave varying DC. A

full-wave rectifier can also be made from just two diodes if a centre-tap transformer is

used, but this method is rarely used now that diodes are cheaper. A single diode can be

used as a rectifier but it only uses the positive (+) parts of the AC wave to produce half-

wave varying DC

Single Diode Rectifier:

A single diode can be used as a rectifier but this produces half-wave varying DC

which has gaps when the AC is negative. It is hard to smooth this sufficiently well to

supply electronic circuits unless they require a very small current so the smoothing

capacitor does not significantly discharge during the gaps

FIG.4.11: RECTIFYING CIRCUIT

Page 58: LPG

FIG.4.12: DIODE RECTIFIER WAVE DIAGRAM

Bridge Rectifier:

FIG.4.13: BRIDGE RECTIFIER

When four diodes are connected as shown in figure, the circuit is called as bridge

rectifier. The input to the circuit is applied to the diagonally opposite corners of the

network, and the output is taken from the remaining two corners. Let us assume that the

transformer is working properly and there is a positive potential, at point A and a negative

potential at point B. the positive potential at point A will forward bias D3 and reverse bias

D4. The negative potential at point B will forward bias D1 and reverse D2. At this time

D3 and D1 are forward biased and will allow current flow to pass through them; D4 and

D2 are reverse biased and will block current flow. One advantage of a bridge rectifier

over a conventional full-wave rectifier is that with a given transformer the bridge rectifier

produces a voltage output that is nearly twice that of the conventional full-wave circuit..

In the conventional full-wave circuit, the peak voltage from the centre tap to either X or Y

is 500 volts. Since only one diode can conduct at any instant, the maximum voltage that

Page 59: LPG

can be rectified at any instant is 500 volts. The maximum voltage that appears across the

load resistor is nearly-but never exceeds-500 v0lts, as result of the small voltage drop

across the diode. In the bridge rectifier shown in view B, the maximum voltage that can

be rectified is the full secondary voltage, which is 1000 volts. Therefore, the peak output

voltage across the load resistor is nearly 1000 volts. With both circuits using the same

transformer, the bridge rectifier circuit produces a higher output voltage than the

conventional full-wave rectifier circuit.

Smoothing:

Smoothing is performed by a large value electrolytic capacitor connected across

the DC supply to act as a reservoir, supplying current to the output when the varying DC

voltage from the rectifier is falling. The diagram shows the unsmoothed varying DC

(dotted line) and the smoothed DC (solid line). The capacitor charges quickly near the

peak of the varying DC, and then discharges as it supplies current to the output. Note that

smoothing significantly increases the average DC voltage to almost the peak value (1.4 ×

RMS value). For example 6V RMS AC is rectified to full wave DC of about 4.6V RMS

(1.4V is lost in the bridge rectifier), with smoothing this increases to almost the peak

value giving 1.4 × 4.6 = 6.4V smooth DC.

FIG.4.14: SMOOTHING WAVE FORM

Smoothing is not perfect due to the capacitor voltage falls a little as it discharges,

giving a small ripple voltage. For many circuits a ripple which is 10% of the supply

voltage is satisfactory. A larger capacitor will give fewer ripples. The capacitor value

must be doubled when smoothing half-wave DC.

Voltage Regulators:

Page 60: LPG

Voltage regulators comprise a class of widely used ICs. Regulator IC units contain

the circuitry for reference source, comparator amplifier, control device, and overload

protection all in a single IC. IC units provide regulation of either a fixed positive voltage,

a fixed negative voltage, or an adjustably set voltage. The regulators can be selected for

operation with load currents from hundreds of milli amperes to tens of amperes,

corresponding to power ratings from milli watts to tens of watts. A fixed three-terminal

voltage regulator has an unregulated dc input voltage, Vi, applied to one input terminal, a

regulated dc output voltage, Vo, from a second terminal, with the third terminal

connected to ground. The series 78 regulators provide fixed positive regulated voltages

from 5 to 24 volts. Similarly, the series 79 regulators provide fixed negative regulated

voltages from 5 to 24 volts.

IC Voltage Regulators:

Voltage regulator ICs are available with fixed (typically 5, 12 and 15V) or

variable output voltages. They are also rated by the maximum current they can pass.

Negative voltage regulators are available, mainly for use in dual supplies. Most regulators

include some automatic protection from excessive current ('overload protection') and

overheating ('thermal protection'). Many of the fixed voltage regulator ICs has 3 leads and

look like power transistors, such as the 7805 +5V 1Amp regulator. They include a hole

for attaching a heat sink if necessary.

FIG.4.15: IC VOLTAGE REGULATOR

Zener Diode Regulator:

Page 61: LPG

For low current power supplies a simple voltage regulator can be made with a

resistor and a zener diode connected in reverse as shown in the diagram. Zener diodes are

rated by their breakdown voltage and maximum power (typically 400mW or 1.3W). The

resistor limits the current (like an LED resistor). The current through the resistor is

constant, so when there are no output current all the current flows through the zener diode

and its power rating must be large enough to withstand this.

FIG.4.16: ZENER DIODE REGULATOR

4.10 Power Supply:

The ac voltage, typically 220V, is connected to a transformer, which steps down

that ac voltage down to the level of the desired dc output. A diode rectifier then provides

a full-wave rectified voltage that is initially filtered by a simple capacitor filter to produce

a dc voltage. This resulting dc voltage usually has some ripple or ac voltage variation..A

regulator circuit removes the ripples and also retains the same dc value even if the input

dc voltage varies, or the load connected to the output dc voltage changes. This voltage

regulation is usually obtained using one of the popular voltage regulator IC units.

FIG.4.17 BLOCK DIAGRAM OF POWER SUPPLY

Page 62: LPG

FIG.4.18 CIRCUIT DIAGRAM OF POWER SUPPLY

Virtually every piece of electronic equipment, e.g., computers and their

peripherals, calculators, TV and hi-fi equipment, and instruments, is powered from a DC

power source, be it a battery or a DC power supply. Most of this equipment requires not

only DC voltage but voltage that is also well filtered and regulated. Since power supplies

are so widely used in electronic equipment, these devices now comprise a worldwide

segment of the electronics market in excess of $5 billion annually.

There are three types of electronic power conversion devices in use today which are

classified as follows according to their input and output voltages:

DC/DC converter;

The AC/DC power supply;

The DC/AC inverter.

Each has its own area of use but this paper will only deal with the first two, which

are the most commonly used. A power supply converting AC line voltage to DC power

must perform the following functions at high efficiency and at low cost:

Rectification: Convert the incoming AC line voltage to DC voltage.

Voltage transformation: Supply the correct DC voltage level(s).

Filtering: Smooth the ripple of the rectified voltage.

Regulation: Control the output voltage level to a constant value irrespective of

line, load and temperature changes.

Isolation: Separate electrically the output from the input voltage source.

Page 63: LPG

Protection: Prevent damaging voltage surges from reaching the output; provide

back-up power or shutdown during a brown-out.

An ideal power supply would be characterized by supplying a smooth and

constant output voltage regardless of variations in the voltage, load current or ambient

temperature at 100% conversion efficiency. Figure 1 compares a real power supply to this

ideal one and further illustrates some power supply terms.

FIG.4.19: REAL POWER SUPPLY HAS ERROR COMPARED TO IDEL POWER

SUPPLY

Linear Power Supplies:

Two common linear power supply circuits in current are used. Both circuits

employ full-wave rectification to reduce ripple voltage to capacitor C1. The bridge

rectifier circuit has a simple transformer but current must flow through two diodes. The

center-tapped configuration is preferred for low output voltages since there is just one

diode voltage drop. For 5V and 12V outputs, Schottky barrier diodes are commonly used

since they have lower voltage drops than equivalently rated ultra-fast types, which further

increase power conversion efficiency. However, each diode must withstand twice the

reverse voltage that a diode sees in a full-wave bridge for the same input voltage. The

linear voltage regulator behaves as a variable resistance between the input and the output

as it provides the precise output voltage. One of the limitations to the efficiency of this

circuit is due to the fact that the linear device must drop the difference in voltage between

the input and output. Consequently the power dissipated by the linear device is (Vi–Vo) x

Io. While these supplies have many desirable characteristics, such as simplicity, low

Page 64: LPG

output ripple, excellent line and load regulation, fast response time to load or line changes

and low EMI, they suffer from low efficiency and occupy large volumes.

Introduction to Keil Compiler:

When the Keil μVision is used, the project development cycle is roughly the same as

it is for any other software development project.

Create source file in C or assembly

Build application with the project manager

Correct errors in source file

Test the linked application

μ Vision IDE:

The μvision IDE combines project managements, a rich featured editor with

interactive error correction, option setup make facility, and online help. Use μvision to

create source files and organize them into a project that defines your target application.μ

vision automatically compiles, assembles and links your embedded application and

provides a single focal point for your development efforts.

C51 Compiler and A51 Macro Assembler:

Source file created by μ vision IDE and passed to the C51 compiler macro

assembler. The compiler and assembler process source files and create relocatable 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.

Page 65: LPG

CHAPTER 5

SYSTEM IMPLEMENTATION

5.1 PCB Design:

FIG.5 PCB DESIGN

PCB design starts right from the selection of the laminates .The two main types of

base laminate are epoxy glass and phenolic paper laminates are generally used for

simple circuits. Though it is very cheap and can easily be drilled, phenolic paper has poor

electrical characteristics and it absorbs more moisture than epoxy glass. Epoxy glass has

highermechanicalstrength.

The important properties that have to be considered for selecting the PCB

substrate are the dielectric strength, insulation resistance, water absorption property,

coefficient of thermal expansion, shear strength, hardness, dimensional stability etc.

5.2 PCB Fabrication:

The fabrication of a PCB includes four steps.

• Preparing the PCB pattern.

• Transferring the pattern onto the PCB.

• Developing the PCB.

• Finishing (i.e.) drilling, cutting, smoothing, turning etc.

Page 66: LPG

Pattern designing is the primary step in fabricating a PCB. In this step, all

interconnection between the components in the given circuit are converted into PCB

tracks. Several factors such as positioning the diameter of holes, the area that each

component would occupy, the type of end terminal should be considered.

5.2.1 Transferring the PCB Pattern:

The copper side of the PCB should be thoroughly cleaned with the help of alcoholic

spirit or petrol. It must be completely free from dust and other contaminants.

The mirror image of the pattern must be carbon copied and to the laminate the

complete pattern may now be made each resistant with the help of paint and thin brush.

5.2.2 Developing:

In this developing all excessive copper is removed from the board and only the printed

pattern is left behind. About 100ml of tap water should be heated to 75 ° C and 30.5

grams of FeCl3 added to it, the mixture should be thoroughly stirred and a few drops of

HCl may be added to speed up the process.

The board with its copper side facing upward should be placed in a flat bottomed

plastic tray and the aqueous solution of FeCl2 poured in the etching process would take

40 to 60 min to complete.

After etching the board it should be washed under running water and then held against

light .the printed pattern should be clearly visible. The paint should be removed with the

help of thinner.

5.2.3 Finishing Touches:

After the etching is completed, hole of suitable diameter should be drilled, then

the PCB may be tin plated using an ordinary 35 Watts soldering rod along with the solder

core, the copper side may be given a coat of varnish to prevent oxidation.

5.2.4 Drilling:

Page 67: LPG

Drills for PCB use usually come with either a set of collects of various sizes or a

3-Jaw chuck. For accuracy however 3-jaw chunks aren’t brilliant and small drill below 1

mm from grooves in the jaws preventing good grips.

5.3 Soldering:

Begin the construction by soldering the resistors followed by the capacitors and

the LEDs diodes and IC sockets. Don’t try soldering an IC directly unless you trust your

skill in soldering. All components should be soldered as shown in the figure. Now

connect the switch and then solder/screw if on the PCB using multiple washers or spaces.

Soldering it directly will only reduce its height above other components and hamper in its

easy fixation in the cabinet. Now connect the battery lead.

5.4 Assembling:

The circuit can be enclosed in any kind of cabinet. Before fitting the PCB suitable

holes must be drilled in the cabinet for the switch, LED and buzzer. Note that a rotary

switch can be used instead of a slide type.

Switch on the circuit to be desired range. It will automatically start its timing

cycles. To be sure that it is working properly watch the LED flash. The components are

selected to trigger the alarm a few minutes before the set limit.

Page 68: LPG

CHAPTER 6

APPLICATIONS AND ADVANTAGES

6.1 Applications:

Industries:

Domestic:

6.2 Advantages:

6.3 Future Enhancements:

Page 69: LPG

CHAPTER 7

CONCLUSION

Page 70: LPG

CHAPTER 8

BIBLIOGRAPHY

8.1 Reference Books:

Muhammad Ali Mazidi –“THE 8051 MICROCONTROLLER AND

EMBEDDED SYSTEMS”, Pearson education,

Ayala- “INTRODUCTION TO 8051 MICROCONTROLLER”

8.2 Softwares:

Keil C51 compiler user guide (Keil Software V3.60)

8.3 Web Links:

www.8051.com

www.google.com

www.wikipedia.org

www.keil.com

www.datasheetarchive.com

www.atmel.com

www.8051projects.info

www.8051projects.net

www.rentron.com