1. 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
2. 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|Page
3. 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|Page
4. 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|Page
5. TABLE OF CONTENTS
CHAPTER TITLE PAGE NO
NO.
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|Page
7. 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|Page
8. 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|Page
9. 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|Page
10. 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
11. 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
12. 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
13. U 10 5V
5V 1 14 U 8
2 1A VC C 13 R EL AY 1
U 14
+ C 3 31 39 3 1Y 6A 12 1 1 8 R EL AY 2
C 1 E A /V P P 0 .0 38 4 2A 6Y 11 2 1 7 LED 1
C R Y STAL 19 P 0 .1 37 5 2Y 5A 10 3 1 6 LED 2
X1 P 0 .2 36 6 3A 5Y 9 4 1 5 LED 3
R 1 Q 2 P 0 .3 35 7 3Y 4A 8 5 1 4 LED 4
C 2 18 P 0 .4 34 G N D 4Y 6 1 3
1k X2 P 0 .5 33 7 1 2
P 0 .6 32 8 1 1
9 P 0 .7 74H C 14 9 1 0
3 2 .6 7 8 K H Z U 5 R ESET 21 R S U LN 2803
P 2 .0 22 EN
X3
1 8 5V 12 P 2 .1 23 LC D O
X1 VC C 7 13 IN T 0 P 2 .2 24 LC D 1
2 O U T 6 14 IN T 1 P 2 .3 25 LC D 2
3 X2 SC L 5 S 1 D5 A T0 P 2 .4 26 LC D 3
4 BAT SD A T1 P 2 .5 27
1
B T1 G N D 1 P 2 .6 28
2 P 1 .0 /T 2 P 2 .7
3 .3 V D S1307 3 P 1 .1 /T 2 X 17
4 P 1 .2 R D 16 U 4
P 1 .3 W R
2
5 29
6 P 1 .4 PSEN 30 5 4
7 P 1 .5 A L E /P 11 6 3
8 P 1 .6 TXD 10 7 2
P 1 .7 R XD 8 1
8052 5V 24C 16
AT89C51 INTERFACING 16X2 LCD AND MAX 232
13 | P a g e
14. VCC V CC
10K PO T
1
2 5
3 9
P1 .0 4 4
P1 .1 5 8
CT S
P1 .2 6 TXD 3
P2 .0 7 7
RXD RT S
U1 P2 .1 8 2
P2 .2 9 6
39 21 P2 .3 10 1
P 0.0 P 0.0/ AD0 P2. 0/A 8
P 0.1 38 22 P2 .4 11
37 P 0.1/ AD1 P2. 1/A 9 23 P2 .5 12
P 0.2 P 0.2/ AD2 P 2. 2/A 10
36 24 P2 .6 13 Connec t or DB9
P 0.3 P 0.3/ AD3 P 2. 3/A 11
35 25 P2 .7 14
P 0.4 P 0.4/ AD4 P 2. 4/A 12
P 0.5 34 26 15
33 P 0.5/ AD5 P 2. 5/A 13 27 16
P 0.6 P 0.6/ AD6 P 2. 6/A 14
32 28
P 0.7 P 0.7/ AD7 P 2. 7/A 15
1 10 LCD
P 1.0 P3. 0/RX D
2 11
3 P 1.1 P3. 1/ TXD 12
P 1.2 P3. 2/ INT0 P 3. 2
4 13
P 1.3 P 1.3 P3. 3/ INT1 P 3. 3
P 1.4 5 14
P 1.4 P 3.4/ T0 P 3. 4
P 1.5 6 15
P 1.5 P 3.5/ T1 P 3. 5
7 16 6 V CC
P 1.6 P 1.6 P 3. 6/WR P 3. 6 1
8 17 9
P 1.7 P 1.7 P3. 7/RD P 3. 7 R2OUT
19 10 C
X1 T 2IN
30 C 0. 1M F
ALE A LE V
33pF 11.0592M Hz 29 12 2
PS EN P SE N- R1OUT V+
11 6
18 1 T 1IN V-
X2 C1+
31 0. 1M F
EA
33pF RST 9 20 0. 1M F 15
40 RST 3 GND
V CC C1- 14
T1OUT RTS
VCC 4 13
V CC C2+ R1I N CTS
89C51
1 0. 1M F 8 R XD
2 5 R2I N 7 T XD
PS EN-
3 C2- T2OUT
I CL232
T iny S witc h
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
15. 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
16. 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
17. 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
18. 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 Connected
NO: - Normally Open
COM: - 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
19. • 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
20. 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
21. 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
CEPT establishes a GSM group in order to develop the standards for a pan-
1982
European cellular mobile system
TDMA is chosen as access method (in fact, it will be used with FDMA) Initial
1987 Memorandum of Understanding (MoU) signed by telecommunication operators
(representing 12 countries)
21 | P a g e
22. 1989 The responsibility of the GSM specifications is passed to the ETSI
1990 Appearance of the phase 1 of the GSM specifications
1991 Commercial launch of the GSM service
Enlargement of the countries that signed the GSM- MoU> Coverage of larger
1992
cities/airports
1993 Coverage of main roads GSM services start outside Europe
1995 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
23. 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
24. 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
25. 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
26. 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
27. 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
28. 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
29. COMMANDS RESPONDING SMS SEND TO THE
ON / OFF IN HARDWARE 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 PASSWORD CHANGED
FORMAT OLD TO NEW
*xxxxxSTAT# ALL APPLICATIONS STATUS AC ON | IN LIGHT OFF |
ARE SEND TO THE OWNER MOTOR ON | FAN ON |
NUMBER OUT LIGHT OFF
*xxxxxxTIME TIME AND DATE UPDATED TO ------
DDMMYYHHMMSS# RTC
*xxxxxxRONOFddmmyyhh TIME DEPENDENT RELAY ON/ ------
ddmmyyhh# OFF
*xxxxxxPHON9791260935# OWNER NUMBER CHANGING OWNER NUBER
COMMAND 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
30. • 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
31. 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
32. 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
33. 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
Pin Alternate Name Alternate Function
P1.0 T2 Serial input
P1.1 T2EX Serial output
P1.2 ECI External interrupt 0
P1.3 CEX0 External interrupt 1
P1.4 CEX1 Timer 0 external input
P1.5 CEX2 Timer 1 external input
P1.6 CEX3 Signal write to external memory
P1.7 CEX4 Signal read from external memory
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
34. Pin Alternate Name Alternate Function
P3.0 RXD Serial input
P3.1 TXD Serial output
P3.2 INT0 External interrupt 0
P3.3 INT1 External interrupt 1
P3.4 T0 Timer 0 external input
P3.5 T1 Timer 1 external input
P3.6 WR Signal write to external
P3.7 RD 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
35. 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
36. 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
37. 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
38. 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
39. 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
40. 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
41. 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
42. • 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
43. 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
44. 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
45. 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