45
GSM MODEM USING HOME AUTOMATION A PROJECT REPORT Submitted by YUVARAJA.R 6109314 In partial fulfillment for the award of the degree of BACHELOR OF ENGINEERING IN ELECTRONICS & COMMUNICATION ENGINEERING MEENAKSHI ACADEMY FOR HIGHER EDUCATION AND RESEARCH WEST K.K. NAGAR CHENNAI - 600078 June 2012 1 | Page

Yuvaraja project

Embed Size (px)

Citation preview

Page 1: Yuvaraja project

GSM MODEM USING HOME AUTOMATION

A PROJECT REPORT

Submitted by

YUVARAJA.R 6109314

In partial fulfillment for the award of the degree

of

BACHELOR OF ENGINEERING

IN

ELECTRONICS & COMMUNICATION ENGINEERING

MEENAKSHI ACADEMY FOR HIGHER EDUCATION AND RESEARCH

WEST K.K. NAGAR

CHENNAI - 600078

June 2012

1 | P a g e

Page 2: Yuvaraja project

MEENAKSHI ACADEMY OF HIGHER EDUCATION AND RESEARCH(MEENAKSHI UNIVERSITY)

(Established under Section 3 of the UGC Act, 1956 vide Notification No.F.9-5/2002-U.3, dt.31.03.2004)

BONAFIDE CERTIFICATE

Certified that this project report “GSM MODEM USING HOME

AUTOMATION” is the Bonafide work of YUVARAJA.R ( 6109314 )

carried put the research under my supervision. Certified further, that to the best of

my knowledge, the work reported herein does not form part of any other project

report or dissertation on the basis of which a degree or award was conferred on an

earlier occasion on this or any other candidate

[SUPERVISOR] [HEAD OF THE DEPARTMENT]

Evaluated and Viva Voce Conducted on: ………………………….

INTERNAL EXAMINER EXTERNAL EXAMINER

2 | P a g e

Page 3: Yuvaraja project

ACKNOWLEDGEMENT

We are greatly indebted to our beloved chancellor

Thiru. A.N. Radha Krishnan M.A., D.Com. for giving an opportunity to complete

this project work. We are thankful to our Vice Chancellor – In charge

Dr.P.Jayakumar MDS for his kind help rendered to us in finishing this project

successfully.

We also express our sincere thanks to the director of part time course

Ms.V.PriyankaRajan M.A., M.B.A., B.Ed., M.Phil., L.L.B., for extending valuable

assistance.

We would like to express our sincere thanks to our project guide

Mr. M.Tamil Selvan ME., Asst. Professor for providing valuable guidance and

extensive support.

I express my gratitude to my friends for their support in all aspects to

accomplish this project.

I deem it fit to thank all the staff of Mechanical engineering dept, who helped

me a lot during the project work and nurtured an environment of creativity and support.

3 | P a g e

Page 4: Yuvaraja project

ABSTRACT

The development of GSM-based control home appliances for smart home system.

The main aim of the prototype development is to reduce electricity wastage. GSM

module was used for receiving short message service (SMS) from user’s mobile

phone that automatically enable the controller to take any further action such as to

switch ON and OFF the home appliances such as light, air-conditioner etc.

The system can be controlled and monitored via SMS from anywhere that covered

by GSM service. For example if you are aside of your home, you want control and

monitor appliances like motor, TV, lights, air-conditioner etc. by sending a SMS to

the GSM modem presented in home you can monitor all the above appliances and

you can also control some appliances like fans and AC. Whenever you send SMS to

do specific task GSM modem will send an acknowledgement to the user so that user

can know the status of his request.

The system was integrated with microcontroller and GSM network interface using

Embedded C language. The system is activated when user sends the SMS to

controller at home. Upon receiving the SMS command, the microcontroller unit then

automatically controls the electrical home appliances by switching ON or OFF the

device according to the user order

4 | P a g e

Page 5: Yuvaraja project

TABLE OF CONTENTS

CHAPTER TITLE PAGE NONO.

ABSTRACT iv

LIST OF TABLE vii

LIST OF FIGURES ix

LIST OF ABBREVIATIONS x

1. INTRODUCTION 1

2. CONTROL SYSTEM 2

2.1 Block diagram 2

2.2 Components Descriptions 3

2.2.1 Max-232 Circuit 4

2.2.2 Driver Circuit 6

2.2.3 Relay Circuit 7

2.2.4 LCD Display 9

2.2.5 LDR circuit

3. GSM MODEM 11

3.1 History of Cellular Mobile Radio

12

3.2 Evolution of GSM 14

3.3 Architecture of GSM Network 16

3.4 SMS in GSM 16

3.5 Specification GSM Modem 18

3.6 Commands used in GSM Modem 19

5 | P a g e

Page 6: Yuvaraja project

4. MICRO CONTROLLER AT89C51RD2BN

4.1 Details of Microcontroller 21

4.2 Block Diagram 23

4.3 Pin Diagram 24

4.4 Specification 24

4.5 Pin descriptions 25

4.6 Architectural overview 27

5. POWER SUPPLY UNIT 34

6. CONCLUSION 38

7. REFRENCES 39

6 | P a g e

Page 7: Yuvaraja project

LIST OF TABLES

TABLE NO. TITLE PAGE NO.

2.1 PIN Details of LCD 10

3.1 Events in the development of GSM 14

4.1 Status Register 28

4.2 General purpose working register 30

4.3 Program memory map 33

7 | P a g e

Page 8: Yuvaraja project

LIST OF FIGURES

NO. TITLE PAGE NO.

2.1 Block Diagram 2

2.2 MAX-232 Circuit 5

2.3 ULN2003 Pin configuration &

Internal Structure 6

2.4 ULN2003 Circuit with Relay 7

2.5 Relay Structure 8

3.1 LCD wring diagram 9

3.2 Architecture of the GSM network 16

3.3 Block Diagram of ATMEGA-168 23

3.4 Pin Diagram of ATMEGA-168 24

3.5 Architectural overview 27

5.1 SMPS Block Diagram 34

5.2 Pin Diagram 36

5.3 Voltage regulator circuit Diagram 36

5.4 Power Supply Wiring Diagram 37

8 | P a g e

Page 9: Yuvaraja project

LIST OF ABBREVIATIONS

GSM Global System for Mobile Communications

SMS Short Message Service

SIM Subscriber Identity Module

SMPS Switched Mode Power Supply

ISP In System Program

ESTI European Standard Telecommunication Institute

RISC Reduced Instruction Set Computer

PDU Protocol Data Unit

EMF Electro Magnetic Field

GPRS General Packet Radio Service

EDGE Enhanced Data for GSM Evolution

CDMA Code Division Multiple Access

TDMA Time Division Multiple Access

ISDN Integrated Services Digital Network

9 | P a g e

Page 10: Yuvaraja project

CHAPTER 1

INTRODUCTION

The development of digital information has led the rapid change in

human lifestyle. The use of electricity is very important as one of the main source of

energy that is vital in today modern life. Some kinds of mechanism using available

technology could be used to reduce wastage in electricity usage. Thus a prototype based

on a microcontroller device using SMS is developed. It can automatically control any

electrical equipment at home remotely using Mobile phone.

GSM (SMS) Controlled system which is capable of receiving a set of command

instructions in the form of Short message service and performs the necessary actions

like ON, OFF and STATUS. We will be using a dedicated modem/mobile at the

receiver module i.e., with the commands using SMS service as per the required actions.

The mobile unit which is connected with an intellectual device called Micro controller

so that it takes the responsibility of reading the received commands in the from of SMS

from the mobile unit and perform the corresponding predefined tasks such as device

ON, OFF and STATUS

10 | P a g e

Page 11: Yuvaraja project

CHAPTER 2

CONTROL SYSTEM

Control System consists of the following components

• Power Supply Circuit

• GSM Modem

• MAX232 Circuit

• AT89C51RD2BN Microcontroller

• ULN 2003 to Driver

• LDR

• Relay

• LCD Display

• Keil C Language

• Controlled Devices

2.0 BLOCK DIAGRAM

11 | P a g e

Page 12: Yuvaraja project

Block diagram of the home appliance control system using SMS.

The Mobile Phone is integrated with the microcontroller ATMEGA168, which receives

SMS message from user Mobile Phone and sends a command to AVR to control

whether to turn ON or OFF the output.

The Mobile Phone also sends status reporting to the user regarding the electrical

appliance. The system utilizes a low cost microcontroller that is currently available in

the market. The development of this device involves with both hardware and software

to provide a preferable results.

2.1 SCHEMATIC DIAGRAM

AT89C51 INTERFACING RTC ,MEMORY AND ULN2803

12 | P a g e

Page 13: Yuvaraja project

S D A

R E L A Y 1R E L A Y 2L E D 1L E D 2L E D 3L E D 4

R SE NL C D OL C D 1L C D 2L C D 3

5 V5 V

5 V

5 V

U 8

U L N 2 8 0 3

1

3

5

7

91 1

1 3

1 5

1 72

4

6

81 0

1 2

1 4

1 6

1 8

Q 2

C R Y S T A L

U 1 0

7 4 H C 1 4

1 41 31 21 11 0

1234567

98

V C C6 A

6 Y5 A

5 Y

1 A1 Y2 A2 Y3 A3 YG N D

4 A4 Y

C 1

C 2R 1

1 k

+ C 3

U 5

D S 1 3 0 7

178

432 6

5

X 1O U TV C C

G N DB A TX 2 S C L

S D A

X 33 2 . 6 7 8 K H Z

B T 1

3 . 3 V

12

U 1 4

8 0 5 2

3 1

1 9

1 8

9

1 21 31 41 5

12345678

3 93 83 73 63 53 43 33 2

2 12 22 32 42 52 62 72 8

1 71 62 93 01 11 0

E A / V P

X 1

X 2

R E S E T

I N T 0I N T 1T 0T 1

P 1 . 0 / T 2P 1 . 1 / T 2 XP 1 . 2P 1 . 3P 1 . 4P 1 . 5P 1 . 6P 1 . 7

P 0 . 0P 0 . 1P 0 . 2P 0 . 3P 0 . 4P 0 . 5P 0 . 6P 0 . 7

P 2 . 0P 2 . 1P 2 . 2P 2 . 3P 2 . 4P 2 . 5P 2 . 6P 2 . 7

R DW R

P S E NA L E / P

T X DR X D

U 4

2 4 C 1 6

12345

678

AT89C51 INTERFACING 16X2 LCD AND MAX 232

13 | P a g e

Page 14: Yuvaraja project

PSEN-

PSEN29

ALE30

VCC40

EA31

X119

X218

RST9

P0.0/AD039

P0.1/AD138

P0.2/AD237

P0.3/AD336

P0.4/AD435

P0.5/AD534

P0.6/AD633

P0.7/AD732

P1.01

P1.12

P1.23

P1.34

P1.45

P1.56

P1.67

P1.78

P2.0/A821

P2.1/A922

P2.2/A1023

P2.3/A1124

P2.4/A1225

P2.5/A1326

P2.6/A1427

P2.7/A1528

P3.0/RXD10

P3.1/TXD11

P3.2/ INT012

P3.3/ INT113

P3.4/T014

P3.5/T115

P3.6/WR16

P3.7/RD17

U1

89C51

12

34567

89

10111213141516

LCD

5

4

3

2

16

7

8

9

Connector DB9

VCC

10K PO T

VCC

VCC

P1 .1P1 .0

P2 .6P2 .5P2 .4P2 .3P2 .2P2 .1P2 .0P1 .2

P2 .7

CT S

P3.2

P3.3

20

VCC

P3.4

R1OUT12

T1OUT14

T2OUT7

T 2IN10

T 1IN11

GND15

VCC

16

R1IN13

R2IN8

R2OUT9

C1+1

C1-3

C2+4

C2-5

V+2

V-6

ICL232

P3.5P3.6

RST

P3.7

0.1M F

P0.0

0.1M F

ALE

P0.1

PSEN-

P0.2

P0.4

RT S

P0.3

P0.5

P0.6

CTS

RTS

P0.7

P1.3P1.4P1.5P1.6P1.7

11.0592M Hz0.1M F

0.1M F

R XD

RXD

TXD

T XD

VCC

123

T iny Switch

33pF

33pF

2.2 COMPONENTS DESCRIPTIONS

Power Supply circuit:

The STEP DOWN Transformer gives the 12v AC then regulator and filter will gives

the 12v DC delivered to MCU Circuits & Relays

GSM Modem:

GSM Modem receives the signal and converts the data and pushes instruction to

microcontroller.

MAX232 Circuit:

It is an interface between GSM Modem and Microcontroller.

14 | P a g e

Page 15: Yuvaraja project

AT89C51 Controller:

This is the heart of the control system which control the device(s) based on the SMS.

ULN 2003 to Driver:

It is power driver circuit that controls the relay(s).

Relay:

The Relay is connected to the output device(s).

LCD Display:

This displays the status of the device.

LDR:

Light dependent resistor using light intensity dependent to lights on

Embedded C Language:

The software is used to program the AT89C51 Controller.

Controlled Device:

The wide variety of home appliances and such as Lights, Fans, etc. can be

connected.

LED:

Light Emitting Diode ) is a semiconductor light source

2.2.1 Max-232 Circuit

When communicating with various micro processors one needs to convert

the RS232 levels down to lower levels, typically 3.3 or 5.0 Volts. Serial RS-232 (V.24)

communication works with voltages -15V to +15V for high and low. On the other hand,

TTL logic operates between 0V and +5V .

Modern low power consumption logic operates in the range of 0V and +3.3V or even

lower. Thus the RS-232 signal levels are far too high TTL electronics, and the negative

RS-232 voltage for high can’t be handled at all by computer logic. To receive serial

15 | P a g e

Page 16: Yuvaraja project

data from an RS-232 interface the voltage has to be reduced. Also the low and high

voltage level has to be inverted. This level converter uses a Max232 and five

capacitors..The MAX232 from Maxim was the first IC which in one package contains

the necessary drivers and receivers to adapt the RS-232 signal voltage levels to TTL

logic.

Fig 2.2 MAX-232 Circuit

2.2.2 DRIVER CIRCUIT

ULN 2803:

The ULN2003 is a monolithic high voltage and high current Darlington transistor

arrays. It consists of seven NPN Darlington pairs that feature high-voltage outputs with

common-cathode clamp diode for switching inductive loads. The collector-current

rating of a single Darlington pairs 500mA. The Darlington pairs may be paralleled for

higher current capability.

16 | P a g e

Page 17: Yuvaraja project

Applications include relay drivers, hammer drivers, lamp drivers, display drivers (LED

gas Discharge), line drivers, and logic buffers. The ULN2803 has a 2.7kW series base

resistor for each Darlington pair for operation directly with TTL or 5V CMOS devices.

Specification:

• High Voltage, High Power Relay control

• Max: 7 Relay

• 500mA rated collector current ( Single output )

• High-voltage outputs: 50V

• Inputs compatible with various types of logic.

• Relay driver application.

Fig 2.4 ULN2803 Circuit with Led

1.2.3. RELAY CIRCUIT

The relay driver is used to isolate both the controlling and the

controlled device. The relay is an electromagnetic device, which consists of

solenoid, moving contacts (switch) and restoring spring and consumes

comparatively large amount of power. Hence it is possible for the interface IC to

drive the relay satisfactorily. To enable this, a driver circuitry, which will act as a

buffer circuit, is to be incorporated between them. The driver circuitry senses the

17 | P a g e

Page 18: Yuvaraja project

presence of a “high” level at the input and drives the relay from another voltage

source. Hence the relay is used to switch the electrical supply to the appliances.

Fig 2.5 Relay Structure

NC: - Normally ConnectedNO: - Normally OpenCOM: - Common

The common contact or moving contact establishes the GSM Based Control System

connection with a new terminal which is indicated as a normally open terminal “(N/O)”.

Whenever, the supply coil is withdrawn the magnetizing force is vanished. Now, the

spring pulls the moving contact back to initial position, where it makes a connection

makes with N/C terminal. However, it is also to be noted that at this time also a back

emf is produced. The withdrawal time may be in microsecond, the back emf may be in

the range of few kilovolts and in opposite polarity with the supplied terminals the

voltage is known as surge voltage. It must be neutralized or else it may damage the

system

2.2.4 LCD DISPLAY

A liquid crystal display (LCD) is a thin, flat display device made up of any number of

color or monochrome pixels arrayed in front of a light source or reflector. It is often

utilized in battery-powered electronic devices because it uses very small amounts of

electric power.

Specification:

• Model: JHD162A

18 | P a g e

Page 19: Yuvaraja project

• Type: Reflective Yellow Green

• Interface : 4 Bit Mode

• Number of characters: 16 characters*2 lines.

• Power Supply : 5V DC

Table 2.1: PIN Details of LCD

LCD wring diagram

CHAPTER 3

GSM MODEM

A GSM Modem can be an external Modem device, such as the LINKTO. Insert a GSM

SIM card into this Modem and connect the modem to an available serial port on the

computer to check the performance of the same.

19 | P a g e

Page 20: Yuvaraja project

A GSM Modem could be a standard GSM mobile phone with the appropriate cable and

software driver to connect to a serial port on the computer.

3.1 HISTORY OF CELLULAR MOBILE RADIO

The idea of cell-based mobile radio systems appeared at Bell Laboratories (in USA) in

the early 1970s. However, mobile cellular systems were not introduced for commercial

use until the 1980s. During the early 1980s, analog cellular telephone systems

experienced a very rapid growth in Europe, particularly in Scandinavia and the United

Kingdom. Today cellular systems still represent one of the fastest growing

telecommunications systems. But in the beginnings of cellular systems, each country

developed its own system, which was an undesirable situation for the following

reasons:

• The equipment was limited to operate only within the boundaries of each coun-

try.

• The market for each mobile equipment was limited.

In order to overcome these problems, the Conference of European Posts and

Telecommunications (CEPT) formed, in 1982, the Group Special Mobile (GSM) in

order to develop a pan-European mobile cellular radio system (the GSM acronym

20 | P a g e

Page 21: Yuvaraja project

became later the acronym for Global System for Mobile communications). The

standardized system had to meet certain criteria:

• Spectrum efficiency

• International roaming

• Low mobile and base stations costs

• Good subjective voice quality

• Compatibility with other systems such as ISDN (Integrated Services Digital Net-

work)

• Ability to support new services

Unlike the existing cellular systems, which were developed using an analog technology,

the GSM system was developed using a digital technology.

In 1989 the responsibility for the GSM specifications passed from the CEPT to the

European Telecommunications Standards Institute (ETSI). The aim of the GSM

specifications is to describe the functionality and the interface for each component of

the system, and to provide guidance on the design of the system. These specifications

will then standardize the system in order to guarantee the proper inter-working between

the different elements of the GSM system. In 1990, the phase I of the GSM

specifications was published but the commercial use of GSM did not start until

mid-1991. The most important events in the development of the GSM system are

presented in the table 1.

Year Events

1982CEPT establishes a GSM group in order to develop the standards for a pan-

European cellular mobile system

1987

TDMA is chosen as access method (in fact, it will be used with FDMA) Initial

Memorandum of Understanding (MoU) signed by telecommunication operators

(representing 12 countries)

21 | P a g e

Page 22: Yuvaraja project

1989 The responsibility of the GSM specifications is passed to the ETSI1990 Appearance of the phase 1 of the GSM specifications1991 Commercial launch of the GSM service

1992Enlargement of the countries that signed the GSM- MoU> Coverage of larger

cities/airports1993 Coverage of main roads GSM services start outside Europe1995 Phase 2 of the GSM specifications Coverage of rural areas

Table 3.1: Events in the development of GSM

From the evolution of GSM, it is clear that GSM is not anymore only a European

standard. GSM networks are operational or planned in over 80 countries around the

world. The rapid and increasing acceptance of the GSM system is illustrated with the

following figures:

• 1.3 million GSM subscribers worldwide in the beginning of 1994.

• Over 5 million GSM subscribers worldwide in the beginning of 1995.

• Over 10 million GSM subscribers only in Europe by December 1995.

Since the appearance of GSM, other digital mobile systems have been developed. The

table 2 charts the different mobile cellular systems developed since the commercial

launch of cellular systems.

3.2 EVOLUTION OF GSM

GSM is a global system for mobile communication GSM is an

international digital cellular telecommunication. The GSM standard was released by

ETSI (European Standard Telecommunication Institute) back in 1989. The first

commercial services were launched in 1991 and after its early introduction in Europe;

the standard went global in 1992. Since then, GSM has become the most widely

22 | P a g e

Page 23: Yuvaraja project

adopted and fastest-growing digital cellular standard, and it is positioned to become the

world’s dominant cellular standard.

Today’s second-generation GSM networks deliver high quality and secure mobile voice

and data services (such as SMS/ Text Messaging) with full roaming capabilities across

the world. GSM platform is a hugely successful technology and as unprecedented story

of global achievement. In less than ten years since the first GSM network was

commercially launched, it become, the world’s leading and fastest growing mobile

standard, spanning over 173 countries. Today, GSM technology is in use by more than

one in ten of the world’s population and growth continues to sour with the number of

subscriber worldwide expected to surpass one billion by through end of 2003.

Today’s GSM platform is living, growing and evolving and already offers an expanded

and feature-rich ‘family’ of voice and enabling services.

The Global System for Mobile Communication (GSM) network is a cellular

telecommunication network with a versatile architecture complying with the ETSI GSM

900/GSM 1800 standard. Siemen’s implementation is the digital cellular mobile

communication system D900/1800/1900 that uses the very latest technology to meet

every requirement of the standard.

The following GSM generation passed in 3decades:

1G Analog Communication

2G Digital Communications

2.5G GPRS

2.75G EDGE

3G Enhanced feature of Video call

23 | P a g e

Page 24: Yuvaraja project

4G High-speed Wireless Broadband

3.3 ARCHITECTURE OF GSM NETWORK

The GSM technical specifications define the different entities that form the GSM

network by defining their functions and interface requirements.

The architecture of the GSM network is presented in figure 2.

Fig. 3.1 Architecture of the GSM network

3.3 SMS IN GSM

SMS stands for Short Message Service. It is a technology that enables the sending and

receiving of message between mobile phones. SMS first appeared in Europe in 1992. It

was included in the GSM (Global System for Mobile Communication) standards right

24 | P a g e

Page 25: Yuvaraja project

at the beginning. Later it was ported to wireless technologies like CDMA and TDMA.

The GSM and SMS standards were originally developed by ETSI. ETSI is the

abbreviation for European Telecommunication Standard Institute.

1.

Now the 3GPP (Third Generation Partnership Project) is responsible for the

development and maintenance of the GSM and SMS standards.

One SMS message can contain at most 140 bytes (1120 bits) of data, so one SMS

message can contain up to:

• 160 characters if 7-bit character encoding is used. (7-bit character encoding is

suitable for encoding Latin characters like English alphabets.)

• 70 characters if 16-bit Unicode UCS2 character encoding is used. (SMS text

messages containing non-Latin characters like Chinese character should use 16-bit

character encoding.)

Once the message is sent the message is received by SMSC, which must then get it to

the appropriate mobile device. To do this the SMSC sends a SMS request to Home

Location Register (HLR) to find the roaming customer. Once HLR receives the request,

it responds to the SMSC with the subscriber’s status:

1 Inactive or active

2 Where subscriber is roaming.

SMS provides a mechanism for transmitting short message to and from wireless

devices. The service makes use of an SMSC, which acts as a store and forward system

for short messages. One major advantage of SMS is that it is supported by 100% GSM

25 | P a g e

Page 26: Yuvaraja project

mobile phones. Almost all subscription plans provided by wireless carriers include

inexpensive SMS messaging service.

3.5 SPECIFICATIONS OF GSM MODEM

Output Power

Class 4 2W @ 900MHz

Class 1 1W @ 1800MHz

Input voltage5V-24VDC

Input current1A-2A

5mA readiness for action, 140mA in GSM 900MHz @ 12V telephone conversation

condition

5mA readiness for action, 100mA in GSM 1800/1900MHz @ 12V telephone

conversation condition

SMS service function

-Writing and PDU

-Point-to-point (MT/MO)

-Plot broadcast

RS232 connection

-Orders with AT to make the remote control (GSM07.07 and 07.05)

-Establishes contacts the baud rate by 300 to 1.15,2 million bits/s

-Automatic baud rate (300 to 38,,400 bits/s)

SMA antenna connection Slides into the type SIM card memory

3.6 COMMANDS USED IN GSM MODEM

Receiving SMS messages using AT commands

26 | P a g e

Page 27: Yuvaraja project

AT+CMGF=1 <ENTER> If the modem responds with "OK" this mode is supported.

Please note that using this mode it is only possible to send simple text messages. It is

not possible to send multipart, Unicode, data and other types of messages.

Setting up the modem:

In order to send a SMS, the modem has to be put in SMS text mode first using the

following command:

AT+CMGF=1 <ENTER>

If the modem responds with error, either the modem does not support SMS text mode,

or the SIM card is not ready. In this case please check that the SIM card is inserted and

the pin code is entered.

Reading a message

To list a single message, you have to use the read command. You must use the list

command first, so you know the indexes of the messages in the storage. For instance, to

read the message on memory location '2' use:

AT+CMGR=2 <ENTER>

The modem will list the single message:

+CMGR: "REC READ","+31625012254",,"07/07/05,09:56:03+08"

Test message 2

OK

Send SMS using AT commands

Some advanced GSM modems like Waveform and Multitask, support the SMS text

mode. This mode allows you to send SMS messages using AT commands, without the

need to encode the binary PDU field of the SMS first. This is done by the GSM modem

27 | P a g e

Page 28: Yuvaraja project

To check if your modem supports this text mode, you can try the following command:

AT+CMGF=1 <ENTER> If the modem responds with "OK" this mode is supported.

Please note that using this mode it is only possible to send simple text messages. It is

not possible to send multipart, Unicode, data and other types of messages.

Sending the message:

AT+CMGS="+31638740161" <ENTER> Replace the above phone number with your

own cell phone number. The modem will respond with:

>

You can now type the message text and send the message using the <CTRL>-<Z> key

combination:

Hello World ! <CTRL-Z>

After some seconds the modem will respond with the message ID of the message,

indicating that the message was sent correctly:

+CMGS: 62

SMS responding Relay or light power ON / OFF commands list.

SMS SENDING COMMAND CURRENT STATUS

28 | P a g e

Page 29: Yuvaraja project

COMMANDS RESPONDING

ON / OFF IN HARDWARE

SMS SEND TO THE

OWNER NUMBER*xxxxxS1ON# AC POWERED ON AC OFF*xxxxxS2ON# LIGHT POWERED ON LIGHT OFF *xxxxxS3ON# FAN POWERED ON FAN OFF*xxxxxS4ON# MOTOR POWERED ON MOTOR OFF*xxxxxS1OF# AC POWERED OFF AC OFF*xxxxxS2OF# LIGHT POWERED OFF LIGHT OFF *xxxxxS3OF# FAN POWERED OFF FAN OFF*xxxxxS4OF# MOTOR POWERED OFF MOTOR OFF *xxxxxPASSxxxxxx# PASSWORD CHANGING

FORMAT OLD TO NEW

PASSWORD CHANGED

*xxxxxSTAT# ALL APPLICATIONS STATUS

ARE SEND TO THE OWNER

NUMBER

AC ON | IN LIGHT OFF |

MOTOR ON | FAN ON |

OUT LIGHT OFF*xxxxxxTIME

DDMMYYHHMMSS#

TIME AND DATE UPDATED TO

RTC

------

*xxxxxxRONOFddmmyyhh

ddmmyyhh#

TIME DEPENDENT RELAY ON/

OFF

------

*xxxxxxPHON9791260935# OWNER NUMBER CHANGING

COMMAND

OWNER NUBER

CHANGED

MICRO CONTROLLER AT89C51RD2BN

Features:

• Compatible with MCS-51® Products• 8K Bytes of In-System Programmable (ISP) • Write/Erase Cycles• 4.0V to 5.5V Operating Range

29 | P a g e

Page 30: Yuvaraja project

• 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

AT89c51 pin diagram

It has a 64k program memory space (flash) and 64k external data memory space.

One special 16 bit programmable counter array (PCA) is present. It also provides

system programming (ISP) facility and operates at 20 MHz max. clock operation.

Philips 89c51 has the features of on-chip

PWM generation & watchdog timer facility suited for motor control applications.

3.2 89C51 architecture

30 | P a g e

Page 31: Yuvaraja project

ACCUMULATOR (ACC): Accumulator is a general-purpose register, which stores

runtime results. Before performing any operation upon an operand, operand has to be

stored in the accumulator. Results of arithmetical operations are also stored in the

accumulator. When transferring data from one register to another, it has to go through

the accumulator. Due to its versatile role, this is the most frequently used register,

essential part of every MCU.

B REGISTER: B Register is used along with the Accumulator for

multiplication and division. This B register provides temporary storage space

for the result of multiplication & division operation. Instructions of

multiplication and division can be applied only to operands located in registers

A and B. Other instructions can use this register as a secondary accumulator

(A).

PORTS: Term "port" refers to a group of pins on a microcontroller which can be

accessed simultaneously, or on which we can set the desired combination of zeros and

31 | P a g e

Page 32: Yuvaraja project

ones, or read from them an existing status. Ports represent physical connection of

Central Processing Unit with an outside world. Microcontroller uses them in order to

monitor or control other components or devices. 89C51 has 4 ports; with each port have

8-bit length. All the ports are bit and byte addressable.

Port 0 (P0): Port 0 has two-fold role: If external memory is used, P0 behaves as

address output (A0 – A7) when ALE pin is at high logical level, or as data output

(Data Bus) when ALE pin is at low logical level, otherwise all bits of the port are

either input or output. Another feature of this port comes to play when it has been

designated as output. Unlike other ports, Port 0 lacks the "pull up" resistor (resistor

with +5V on one end). This seemingly insignificant change has the following

consequences:

• When designated as input, pin of Port 0 acts as high impedance offering the infinite

input resistance with no "inner" voltage.

• When designated as output, pin acts as "open drain". Clearing a port bit grounds the

appropriate pin on the case (0V). Setting a port bit makes the pin act as high

impedance. Therefore, to get positive logic (5V) at output, external "pull up" resistor

needs to be added for connecting the pin to the positive pole.

Therefore, to get one (5V) on the output, external "pull up" resistor needs to be added

for connecting the pin to the positive pole.

32 | P a g e

Page 33: Yuvaraja project

Port 1 (P1): Port 1 is I/O port. Having the "pull up" resistor, Port 1 is fully compatible

with TTL circuits. The alternate functions of Port1 are

Port 2 (P2): When using external memory, this port contains the higher address byte

(addresses A8–A15), similar to Port 0. Otherwise, it can be used as universal I/O

port.

Port 3 (P3): Beside its role as universal I/O port, each pin of Port 3 has an alternate

function. In order to use one of these functions, the pin in question has to be

designated as input, i.e. the appropriate bit of register P3 needs to be set. By

selecting one of the functions the other one is disabled. From a hardware

standpoint, Port 3 is similar to Port 0. The alternate functions of Port 3 is given

below

33 | P a g e

Pin Alternate Name Alternate FunctionP1.0

P1.1

P1.2

P1.3

P1.4

P1.5

P1.6

P1.7

T2

T2EX

ECI

CEX0

CEX1

CEX2

CEX3

CEX4

Serial input

Serial output

External interrupt 0

External interrupt 1

Timer 0 external input

Timer 1 external input

Signal write to external memory

Signal read from external memory

Page 34: Yuvaraja project

Pin Alternate Name Alternate Function

P3.0

P3.1

P3.2

P3.3

P3.4

P3.5

P3.6

P3.7

RXD

TXD

INT0

INT1

T0

T1

WR

RD

Serial input

Serial output

External interrupt 0

External interrupt 1

Timer 0 external input

Timer 1 external input

Signal write to external

memory

Signal read from external

memory

Data Pointer (DPTR) : The Data pointer register is made up of two 8 bit registers,

named DPH (Data Pointer High) and DPL (Data Pointer Low). These registers are used

to give addresses of the internal or external memory. The DPTR is under the control of

program. DPTR is also manipulated as one 16 bit register, DPH & DPL are each

assigned an address. The 89C51 microcontroller has additional DPTR. The dual DPTR

structure is a way by which the chip will specify the address of an external data memory

location. There are two 16-bit DPTR registers that address the external memory, and a

single bit called DPS (bit0 in AUXR1) that allows the program code to switch between

them.

Stack Pointer (SP) : The stack refers to an area of internal RAM that is used in

conjunction with certain opcodes to store and retrieve data quickly. The register used to

access the stack is called Stack Pointer. The 8 bit stack pointer register is used by the

89C51 to hold an internal RAM address that is called then top of the stack. The stack

pointer increments before storing the data on the stack. As retrieved from the stack the

34 | P a g e

Page 35: Yuvaraja project

SP is decremented by one. The number in Stack Pointer points to the location of the last

"valid" address within the Stack. With the beginning of every new routine, Stack

Pointer increases by 1; upon return from routine, SP decreases by 1. Upon reset (or

turning the power on), the stack pointer contains the value 07h.

Program Counter (PC): Used to access code memory. Program counter always points

to the address of the next instruction in memory to be executed. Upon reset (or turning

the power on), the program counter resets to the starting location of the program.

Instruction Register: When an instruction is fetched from the Flash memory, it is loaded

in the instruction register.

Timing & Control unit: The timing and control unit synchronizes the operation of the

microcontroller and generates control signals necessary for communication between the

microcontroller and the peripherals.

Program Status Word (PSW): The Program Status Word (PSW) register is an 8 bit

register. It is also referred to as the flag register. It contains the math flags, user program

flag F0, and the register select bits that identify which of the four general purpose

register banks is currently in use by the program.

Oscillator: Oscillator circuit is used for providing a microcontroller with a clock. Clock

is needed so that microcontroller could execute a program or program instructions.

Stable pace provided by the oscillator allows harmonious and synchronous functioning

of all other parts of MCU. The manufacturers make available 89C51 designs that can

run at specified maximum and minimum frequencies, typically 1 megahertz to 33

megahertz. Minimum frequencies imply that some internal memories are dynamic and

must always operate above a minimum frequency or data will be lost.

35 | P a g e

Page 36: Yuvaraja project

Interrupts: An interrupt is a signal from a device attached to a computer or from a

program within the computer that causes the main program that operates the computer

to stop and points out what to do next. In general, there are hardware interrupts and

software interrupts. A hardware interrupt is related to the hardware of the system. For

example, when an I/O operation is completed such as reading some data into the

computer from a keyboard interrupt the main program. As the name implies the

software interrupts related to the software of the system. It occurs when an application

program terminates or requests certain services from the operating system.

Timers/Counters: Timers are usually the most complicated parts of a microcontroller.

Physically, timer is a register whose value is continually increasing to FFFFh, and then

it starts all over again: 0h, 1h, 2h, 3h, 4h...FFFFh....0h, 1h, 2h, 3h......etc. The 89C51

MCU clock employs a quartz crystal. As this frequency is highly stable and accurate, it

is ideal for time measuring. Since one instruction takes 12 oscillator cycles to complete,

the math is easy. 89C51 has three Timers/Counters marked as T0, T1 & T2. Their

purpose is to measure time and count external occurrences, but can also be used as

clock in serial communication purpose called as, Baud Rate.

Serial Port: Serial port is used to provide communication among two devices. Serial

data communication has been widely used for long distance communication because of

the ease and the economy of using only one wire to transmit data. Serial port is also

referred as RS232 port. RS232 is a asynchronous way of communication.

Asynchronous transmission allows data to be transmitted without the sender having to

send a clock signal to the receiver. Instead, the sender and receiver must agree on

timing parameters in advance and special bits are added to each word, which are used to

synchronize the sending and receiving units.

36 | P a g e

Page 37: Yuvaraja project

When a word is given to the UART for Asynchronous transmissions, a bit called

the "Start Bit" is added to the beginning of each word that is to be transmitted. The Start

Bit is used to alert the receiver that a word of data is about to be sent, and to force the

clock in the receiver into synchronization with the clock in the transmitter.

CHAPTER 5

LIGHT DEPENDENT RESISTOR:

LDRs or Light Dependent Resistors are very useful especially in

light/dark sensorcircuits. Normally the resistance of an LDR is very high, sometimes as

high as 1000 000ohms, but when they are illuminated with light resistance drops dra-

matically.

Two cadmium sulphide (cds) photoconductive cells with spectral responses

similar to that of the human eye. The cell resistance falls with increasing light intensity.

Applications include smoke detection, automatic lighting control, and batch counting

and burglar alarm systems.

37 | P a g e

Page 38: Yuvaraja project

Fig: LDR Fig: Example Circuitry

This is an example of a light sensor circuit. When the light level is low

the resistance of the LDR is high. This prevents current from flowing to the base of the

transistors. Consequently the LED does not light. However, when light shines onto the

LDR its resistance falls and current flows into the base of the first transistor and then

the second transistor. The LED lights. The preset resistor can be turned up or down to

increase or decrease resistance, in this way it can make the circuit more or less sensi-

tive.

There are just two ways of constructing the voltage divider, with the LDR at the top, or

with the LDR at the bottom:

You are going to investigate the behaviour of these two circuits. You will also find out

how to choose a sensible value for the fixed resistor in a voltage divider circuit.

Remember the formula for calculating

Vout : Rbottom x Vin

Rbottom x Rtop

Sensitivity:

The sensitivity of a photo detector is the relationship between the light falling on the

38 | P a g e

Page 39: Yuvaraja project

device and the resulting output signal. In the case of a photocell, one is dealing with the

relationship between the incident light and the corresponding resistance of the cell.

Fig2: Resistance as function of Illumination Fig3: Spectral Response

Spectral Response:

Like the human eye, the relative sensitivity of a photoconductive cell is dependent on

the wavelength (color) of the incident light. Each photoconductor material type has its

own unique spectral response curve or plot of the relative response of the photocell ver-

sus wavelength of light.

Electrical Characteristics:

39 | P a g e

Page 40: Yuvaraja project

Applications:

Analog Applications

· Camera Exposure Control

· Auto Slide Focus - dual cell

· Photocopy Machines - density of toner

· Colorimetric Test Equipment

· Densitometer

• Digital Applications

• Automatic Headlight Dimmer

• Night Light Control

• Oil Burner Flame Out

• Street Light Control

• Absence / Presence (beam breaker)

• Position Sensor

40 | P a g e

Page 41: Yuvaraja project

CHAPTER 6

POWER SUPPLY UNIT

5.1 POWER SUPPLY CIRCUIT

Power supply is to provide the required level of DC power to the load using an

AC supply at the input. Different applications require different attributes, but more of-

ten than not these days DC power supplies provide an accurate output voltage - this is

regulated using electronic circuitry so that it provides a constant output voltage over a

wide range of output loads.

In most power supplies there are number of different elements. These may not all be

present in every design.

• Input transformer: The input transformer is used to transform the incoming line

voltage down to the required level for the power supply. Typically the input

transformer provides a step down function. It also isolates the output circuit from

the line supply.

• Rectifier: The power supply rectifier converts the incoming signal from an AC

format into raw DC. Either half wave or more commonly full wave rectifiers may

be used as they make use of both halves of the incoming AC signal.

41 | P a g e

Page 42: Yuvaraja project

• Smoothing: The raw DC from the rectifier is far from constant falling to zero

when the AC waveform crossed the zero axis, and then rising to its peak. The ad-

dition of a reservoir capacitor here fills in the troughs in the waveform, enabling

the next stage of the power supply to operate. Large value capacitors are normal-

ly used within this stage.

• Regulator: This stage of the power supply takes the smoothed voltage and uses

a regulator circuit to provide a constant output virtually regardless of the output

current and any minor fluctuations in the input level.

Fig 5.3 Voltage regulator circuit Diagram

42 | P a g e

Page 43: Yuvaraja project

CHAPTER 6

CONCLUSION

Recent development in Science and Technology provide a wide range of scope of

application of reduction power wastage. This project is useful in the domestic as well in

the industrial applications. It has the scope to enhance several devices by appropriate

add-on circuits. Even the Fire or Smoke detector can be configured to report to the user.

The cost involved is moderate and the status can be sent to the user(s) for the decision

43 | P a g e

Page 44: Yuvaraja project

CHAPTER 8

REFERENCES

1) David Tse, Pramod Viswanth (2005) “Fundamentals of Wireless

Communication” Cambridge University Press, Edition-I

2) Goankar Ramesh Goankar (2006), “Fundamentals of Microcontroller

and applications in Embedded system with PIC”

Cengafe Demalmar Learning Publishers,Edition-1

3) Larry O Cull,Richard Bennett, Sarah Cox (2003), “Embeded C

Programming and Microchip PIC” Cengage Demalmar Learning

Publishers Edition-I

4) Siegmund Redl, Mathias K.Weber (1995), “Introduction to GSM”

Artech house Publishers Edition-1

5) Thodre S. Rapport (2001), “Wireless Communication Principle and

Practice” Pearson Educaion Publishers. Edition-2

6) John B.Peatman (1988), “Design with Microcontrollers” McGraw Hill

International Edition-1

7) A. Bruce Carlson, Communication Systems, Tata McGraw Hill, 1986

8) Edward C. Jordan and Keith G. Balmain, “Electromagnetic waves and

radiating systems”, Prentice Hall, 2nd Edition, 1995.44 | P a g e

Page 45: Yuvaraja project

9) FLOYD: Digital Fundamentals, Universal Book Stall, New Delhi, 1993

10)George Kennedy: Electronic Communication Systems, Tata McGraw

Hill Publications, 1992

45 | P a g e