gsm based remote appliance control system
TRANSCRIPT
-
7/27/2019 GSM Based Remote Appliance Control System
1/84
SSGBCOET,BHUSAWAL.
2012
GSM BASED
REMOTE APPLIANCE
CONTROL SYSTEM
Hardik Jasani
N O R T H M A H A R A S H T R A U N I V E R S I T Y
-
7/27/2019 GSM Based Remote Appliance Control System
2/84
Project Report
On
GSM BASED REMOTE APPLIANCE CONTROL
SYSTEM
Submitted by
JASANI HARDIK CHHAGANBHAI
YADAV AKHILESH BAHADUR
VIJAY KUMAR
In partial fulfilment of the award of
Bachelor of Engineering
(Electronics & Communication Engineering)
NORTH MAHARASHTRA UNIVERSITY, JALGAON
Department of Electronics & Communication Engineering
SHRI SANT GADGE BABA
COLLEGE OF ENGINEERING & TECHNOLOGY,
BHUSAWAL
(2011 - 2012)
-
7/27/2019 GSM Based Remote Appliance Control System
3/84
CERTIFICATE
This is to certify that the project entitled GSM BASED REMOTE
APPLIANCE CONTROL SYSTEM which is being submitted herewith for the award
of the Degree of Bachelor of Engineering in Electronics & Communication
Engineering of North Maharashtra University, Jalgaon. This is the result of the original
research work and contribution by Jasani Hardik Chhaganbhai, Yadav Akhilesh
Bahadur and Vijay Kumar under my supervision and guidance. The work embodied in
this report has not formed earlier for the basis of the award of any degree of compatible
certificate or similar title of this for any other examining body of university to the best of
knowledge and belief.
Place:
Date:
Prof. S. D. Deshmukh Prof. G. A. Kulkarni
Guide Head of the Department
Dr. R. P. Singh
Principal
-
7/27/2019 GSM Based Remote Appliance Control System
4/84
TABLE OF CONTENTS
CHAPTER Page No.
I. List of Abbreviations i
II. List of Figures ii
III. List of Tables iii
1. INTRODUCTION
1.1 Introduction 1
1.2 Necessity 2
1.3 Objectives 2
1.4 Theme 2
1.5 Organization 3
2. LITERATURE SURVEY2.1 Home Automation 4
2.2 Mobile Communication 10
2.3 GSM Architecture 12
3. SYSTEM DEVELOPMENT
3.1 Design of Power Section 18
3.2 Design of Relay Section 19
3.3 Design of Main Controller Board 21
3.4 Circuit Layouts 35
3.5 PCB Layouts 363.6 System Software Design 39
4. PERFORMANCE ANALYSIS
4.1 First Installation 46
4.2 Routine Operation 47
4.3 Control Words 47
4.4 Results 48
4.5 Timing States 49
5. CONCLUSION
5.1 Conclusions 505.2 Future Scope 50
5.3 Applications 51
5.4 Advantages 51
5.5 Limitations 52
REFERENCE 54
APPENDICES A-1
ACKNOWLEDGEMET
-
7/27/2019 GSM Based Remote Appliance Control System
5/84
i
LIST OF ABBREVIATIONS
AC Air Conditioner
AMPS Advanced Mobile Phone System
CAD Computer Aided Designing
CCTV Closed Circuit Television
CDMA Code Division Multiple Access
CMOS Complementary Metal Oxide Semiconductor Devices
CPU Central Processing Unit
DIY Do-It-Yourself
DSP Digital Signal Processors
EEPROM Electrically Erasable Programmable Read Only Memory
EDGE Enhanced Data rate for GSM Evolution
ETSI European Telecommunications Standards Institute
EV-DO EvolutionDigital Only
FPGA Field Programmable Gate Array
GMSK Gaussian Minimum Shift Keying
GPRS General Pocket Radio Service
GPS Global Positioning System
GSM Global System for Mobile Communication
HA Home Automation
IDE Integrated Development Environment
ISP InSystem Programming
LAN Local Area Network
LED Light Emitting Diode
LPC Linear Predictive Coding
PCB Printed Circuit Board
PDA Personal Digital Assistant
PEROM Programmable and Erasable Read Only Memory
RAM Random Access Memory
ROM Read Only MemorySIM Subscribers Identity Module
SMS Short Messaging Service
SMSC SMS Center
TCP Transmission Control Protocol
TDMA Time Division Multiple Access
TTL Transistor-Transistor Logic
UART Universal Asynchronous Receiver Transmitter
USIM Universal Subscriber Identity Module
-
7/27/2019 GSM Based Remote Appliance Control System
6/84
ii
LIST OF FIGURES
Figure No. Figure Name Page No.
1.1 Basic project organization 3
2.1 Sonos Wireless Music Centre Components 6
2.2 GSM Architecture 14
2.3 SIM card 16
3.1 Circuit diagram of power supply section 19
3.2 ULN 2803 pin configuration 19
3.3 HKE make JQC-3FC/T73 12VDC 20
3.4 Atmel AT89C52 22
3.5 89S52 Block Diagram 243.6 Clock generation circuitry 32
3.7 Pull-up network 32
3.8 Reset circuitry 33
3.9 Pin diagram of MAX232 34
3.10 Main controller board circuit 35
3.11 Relay board circuit 36
3.12 Power supply circuit 36
3.13 PCB layout of main controller board 37
3.14 PCB layout of Relay board 38
3.15 PCB layout of power supply board 38
3.16 Keil Vision IDE 40
3.17 Flowchart of system code 41
-
7/27/2019 GSM Based Remote Appliance Control System
7/84
iii
LIST OF TABLES
Table No. Table Name Page No.
3.1 Relay characteristics 20
3.2 Comparison of 89C52 with 89C51 21
3.3 89C52 pin functions 25
3.4 Port 1 alternate functions 26
3.5 Port 3 pin alternate functions 27
3.6 Timer 2 operating modes 30
3.7 Interrupt Sources 31
3.8 Interrupt Enable (IE) Register 32
4.1 Control words 47
4.2 Results 48
4.3 Timing states in the system 49
-
7/27/2019 GSM Based Remote Appliance Control System
8/84
1. INTRODUCTION
1.1 INTRODUCTION
With increasing penetration of technology in day to day life, the number of
electronic appliances, general to the most households, is increasing. Humans stride to
achieve automation and desire to reduce efforts made to control these appliances led to
various ways of controlling a large chunk of appliances with remote controls and remote
control methods. Television sets were first to be controlled with a remote control, that
made control of various functions such as channel selection, tuning and many more
functions a lot more fast and convenient. Since then, remote control has expanded its
spectrum by finding ways to ACs, CD/DVD players, microwave ovens, refrigerators, fans
and many more home appliances. These remote control methods generally make use of
infrared sensors and LEDs for communication between control unit and remote controller.
More complex remote controllers that can control more than one appliance are in use too.
Such remote controllers are frequently termed as Universal remote controller or simply
Universal remotes.
With the advent of home automation systems, switching control of some or all of
commonly used appliances, such as light bulbs, fans, water pump, ACs and geyser is also
explored. Such systems are capable of turning any appliance ON or OFF a particular
appliance by controlling the power supplied to it from supply board. The control is
actuated by sending control words with identification of particular appliances.
The control signals can be sent by infrared remote controls or by other methods
of signalling such as telephone call or through internet access. These systems can be
designed to control more functions of each appliance than just controlling its power
supply such as temperature of AC or speed of fan can be directly controlled by user.
These control parameters are sent with control words. But these remote controllers areoperational from within a limited radius of typically 10m. Also, it is not fully flexible,
that is, once the system is programmed for a particular need of home, it cant be modified
later.
Our attempt to solve the above discussed problem is by using noble features of
GSM cellular system for transporting control words to the control unit. This system
exploits Short Messaging Service (SMS) feature of GSM, which is very simple to use and
economic. GSM is ubiquitous and there are millions of mobile phone owners in India
hence the system is more likely to see real life implementations in masses in near future.
-
7/27/2019 GSM Based Remote Appliance Control System
9/84
2
1.2 NECESSITY
Necessity of GSM based remote appliance control system stems from the fact
that currently available methods of providing such services are too good to see any real
life implementation.
Internet based home automation system proves to be too much costly by
considering the cost of broadband connection and the efficiency related with it. So called
universal home remote controllers are sometimes too complex to configure and use. Also,
they require a line-of-sight between infrared source and sensors. This limits its range
between controller and appliance.
While this system solves above mentioned problems, it also offers widespread
operation range, practically wherever the GSM network has its reach. It is also very
economic considering the costs of SMS services and GSM connection charges.
1.3 OBJECTIVES
A task or project without a precise and well-defined objective has a least chance
of success. It is of very importance that objectives of the project be outlined well in
advance before considering solution to the problem.
The objective of this project can be listed as follows:
To study and implement the GSM techniques;
To study the embedded systems;
To study and implement microcontroller based systems;
To study the assembly program development;
To study the circuit design methods;
To prepare a comprehensive project report.
A modest effort has been made to complete the project according to the before
mentioned objectives. However, there may be some gray areas due to unintentional errors
on part of us.
1.4 THEME
The basic theme of the project is to develop a simple remote appliance control
system that fulfills the above objectives in cost-effective manner. The idea to use GSM in
the remote appliance control method is originated by the combined objective of studying
both of the fields of electronicssystem software development and hardware designing.
Home automation products represent an important class of embedded systems
that finds direct public uses. Home automation systems have made life easier for us,
-
7/27/2019 GSM Based Remote Appliance Control System
10/84
3
thanks to the microprocessors and microcontrollers which are widely used in embedded
system products. An embedded product uses a microprocessor or microcontroller to do
one and only one task.
Our project is an embedded system application wherein there is an extensive
interfacing of various relays and GSM module, which is an important part of the system.
Usage of relays, relay drivers, voltage converter ICs and serial communication devices
provide knowledge of interfacing these components. Basic wire wrapping knowledge
together with familiarity of resistors, capacitors and other basic circuit is also gained.
1.5 ORGANIZATION
The projects organization is based on the extensive interfacing of the GSM
modem and relay drivers with the 8051 based AT89C52 microcontroller. The specifically
selected version of microcontroller IC provides ample amount of ROM for program
memory and RAM for basic decoding of control messages. The microcontroller
communicates with GSM modem through serial communication by DB-9 connector with
the aid of RS-232 voltage converter. The strong driving currents for relays are provided
by ULN2803 relay driver IC. There are four relays; each being of solid state 1- relays.
The necessary DC voltages of 5V and 12V are derived from 230V AC mains supply by
bridge rectifier and fixed voltage regulator IC 7805. The organization in its simplest form
can be modeled as below.
Fig. 1.1 Basic project organization
89C52
Relay
Relay
Relay
Relay
Level
Converter
SMS
Relay
Driver
-
7/27/2019 GSM Based Remote Appliance Control System
11/84
4
2. LITERATURE SURVEY
Aim of this report is to choose the appropriate technologies and methods when
implementing a GSM based Home Automation System. To do this we will look at current
Home Automation implementations and the technologies that are currently available for
creating wireless remote switching systems. We should also look at other technologies
that may be appropriate for our project that has potential to improve the existing available
systems.
2.1 HOME AUTOMATION
Home Automation is a concept that has been developing reasonably slowly when
compared with the other technology such as televisions and computers. Whereas other
technologies such as high-definition televisions have developed and become much
cheaper, home automation is still generally quite an expensive and exclusive concept
for most people. We have tried here to look into what Home Automation is and what
current technologies exist. We shall look at how technologies were implemented in early
years and its situation in present era and the groups of people that will use the
technologies. We will look at the use of automation as a disability aid as well as it just
being a luxury within a home.
Home Automation (also referred to as Domotics) is the use of one or morecomputers to control basic home functions and features automatically and sometimes
remotely, an automated home is sometimes called a smart home. Home Automation
can be used for a wide variety of purposes; from turning lights on and off to
programming appliances within a home and the programming of timers for these
various devices. Home Automation is often used as a luxury convenience system
within a home and often it is expensive to have installed due to their relative
exclusivity in the current market. As Home Media devices become cheaper, Home
Automation is a technology that more people will be looking into to install in their house.
Home Automation (HA) is quite a broad area and therefore has a variety
of uses. Some areas are very important and can greatly improve the quality of life for
individuals, whilst other aspects of home automation are used for convenience rather than
an essential item. Starting off with the more essential aspect of home automation are
security aspects. Cameras and sensors can be connected to a home automation system.
These can be used to monitor and record activity around a building/house and can
make remote monitoring much easier. This can then make the technology of burglar
-
7/27/2019 GSM Based Remote Appliance Control System
12/84
5
alarms much more complex as they not only recognize movement with sensors but they
can also store and relay video images for the owner to then show the police if necessary.
Another use for home automation is with the elderly and people with impaired
physical mobility. Tasks that are simple for some people are much harder if you are
less mobile can be made much easier using an automated system.
Automated systems can be linked to motors and switches to perform tasks
controlled on a simple control panel. For example the opening and closing of curtains
in a room could be controlled by a remote control. The most dominant uses of home
automation are with home lighting, multimedia and smart home appliance control. This
tends to be the more exclusive market and often quite expensive.
Home Automation will only be adopted if it is at least as easy to use as the
original task in which it is replicating. For example if switching on a light via a home
automation system is more complicated than pressing a button on a wall then there is
arguably no advantage to having the device automated and it might just promote
user aggravation.
Home automation software in Australia is being used to shut down lighting and
devices in homes from their computers and mobile phones. A pilot study from the
company who produced the software showed that an office building was able to cut its
energy consumption by 25 percent. With the constant strive to create a greener planet;
Home automation could certainly help us in doing so.
2.1.1 Current Home Automation Systems
In the past many distributed audio systems within a house have consisted with a
large number of wired remote controls around a house which controls a central CD player
or Radio. The problem with these systems is that there is one audio source for many
rooms and each room cannot listen to a different CD concurrently. For this reason many
of the more modern systems are computer based systems. Most of the HA solutions
that are currently on sale use specialist hardware both to store the media and to
distribute it. An example is the Sonos Wireless Music Centre. The Sonos system uses
your current home computer, Sonos ZonePlayers in each of the rooms you require music
which then have speakers attached and a graphical remote control for each device.
-
7/27/2019 GSM Based Remote Appliance Control System
13/84
6
Fig 2.1 Sonos Wireless Music Centre Components
This system is designed so that it takes only basic computer skills to set up and
therefore saves the user money in not having to pay for a professional installation of
the product. It uses wireless technology for the ZonePlayers, Controllers and the
Computer to communicate and therefore doesnt require the inconvenience of installation
of network cabling to the building. The drawbacks with the Sonos system is that it only
covers music streaming within a home and does not control lighting and other
appliances. The other disadvantage is the system costs too much money for the smallest
room package and that doesnt include the cost of the computer that acts as a server if you
dont already have one. Another similar solution to the Sonos system is the
Cambridge Audio incognito system. This uses more dedicated hardware and has
more wired components compared to the Sonos system. More of the componentsare integrated into walls which makes a cleaner finish but are harder to setup and
move to a different room or house. The Cambridge Audio has optional modules to
allow video to be streamed as well as music. Neither of these system offer remote web
access to the system and they cannot control lighting or other appliances. The next few
products I will look at offer increases functionality beyond the scope of music and video.
One such company is Cyber Homes in UK. They offer tailored HA solutions
for individuals and families. They consult with the client and discover their needs then
come up with a selection of proposed solution and prices. They offer automation is Multi-
room Audio and Visual, Automated Lighting, CCTV and Security, Heating and Air-
conditioning and Occupancy Simulation. Occupancy Simulation is achieved by using the
other methods of HA they offer to achieve a realistic simulation that a house is being
lived in, aiming to achieve a house that appears to be occupied, and therefore less of a
target to burglary.
The advantages with companies such as Cyber Homes, is that they can offer
solution that are tailored to user need rather than having to adjust user home to work with
-
7/27/2019 GSM Based Remote Appliance Control System
14/84
7
the technology. The problem is that using tailored solution gains considerable extra cost.
A large proportion of this is paying for the design consultancy for designing your
system and also the installation costs that user will incur. Although the bespoke systems
are an expensive option, there is very little input required from the client apart from their
wishes on what they want the system to do, not how they are going to do it. This is why
very little technological experience is required for this option.
At the other end of the spectrum, there is DIY (Do-it-yourself) Home
Automation. This option is quite different to the tailored systems that companies such as
Cyber Homes have to offer. These can still offer a vast range of control within the
home, the difference being that this method is often very limited by a fixed
amount of available funds to equip the home. It is also necessary to be
technologically minded as the research into components needed and their
installation and maintenance all has to be carried out by the home owner
themselves. Websites such as DIY Home Automation offer consumer advice to people
trying to set up a system themselves. Sites like these are generally written to give friendly
advice, rather than a business, so may not necessarily contain the most up to date
information, or even the best practices in which to design a system.
The authors of the sites are usually enthusiasts rather than experts in the field.
This is why it is necessary for the home owner to have a fair amount of technical
knowledge or be technically minded, to help them siphon out the best information to
allow them to create a system that meets their needs.
The type of HA that is usually referred to in DIY HA is usually
controlled by a computer (usually an existing computer within the home) and signals
are usually sent through both wired or wireless Local Area Networks (LANs).
2.1.2 Problems With The Current Systems
The systems discussed above in the Current Home Automation Systems
section all have their own advantages and disadvantages, but we mainly concentrated
on their disadvantages. The purpose of this section is to outline some of the major
downfalls to the systems and mark out key points that make a system efficient and useful
and summarize these so as we can best address these issues when we come to develop our
own Home Automation System.
The first issue to look at is the ease of installation. Systems like the Sonos Media
system are relatively straight forward to install. They dont require much (if any)
additional wiring to be put in the house and this therefore limits disruption to the home
-
7/27/2019 GSM Based Remote Appliance Control System
15/84
8
with installation. It also means that the system is not tied down to having to stay in the
rooms in which it was initially installed as the components are relatively easy to relocate.
Other systems such as the tailored systems on offer by companies such as Cyber Homes
hardwire components and require cabling routed throughout a house. Often control panels
are sunken into the walls to give a nice sleek finish.
This does however limit the ease of relocating components significantly. DIY
Home Automation usually consists of message receiver modules.
The second clear disadvantages to some of the systems are cost. If a product is to
become successful it needs to be financial accessible to the mass market. Tailored
HA systems are not an option for a lot of people, therefore affordable plug and
play and easily configurable solutions need developing, even if they do have slightly
less functionality than the tailored systems. According to Kirchhoff and Linz they say that
forHA to be successful home automation cannot require technicians come to the users
home to integrate any kind of devices to home networks.
The problem with current HA systems is that the HA standards are extremely
fragmented. The problem with this is there is no universal standard, and lots of protocols
and devices are proprietary and this makes it harder for new systems to be developed as
quickly as one would like it to be. When we design our system we will either have to
create something that encompasses all existing technologies or we need to create
a system that can be integrated with existing technologies and standards.
Being a project one of its kind, one more topic that needs to be discussed in this
project is the evolution of the embedded system. An embedded system is a computer
system designed for specific control functions within a larger system, often with real-time
computing constraints. It is embedded as part of a complete device often including
hardware and mechanical parts. By contrast, a general-purpose computer, such as a
personal computer (PC), is designed to be flexible and to meet a wide range of end-user
needs. Embedded systems control many devices in common use today.
Embedded systems contain processing cores that are typically either
microcontrollers or digital signal processors (DSP). The key characteristic, however, is
being dedicated to handle a particular task. Since the embedded system is dedicated to
specific tasks, design engineers can optimize it to reduce the size and cost of the product
and increase the reliability and performance. Some embedded systems are mass-
produced, benefiting from economies of scale.
-
7/27/2019 GSM Based Remote Appliance Control System
16/84
9
Physically, embedded systems range from portable devices such as digital
watches and MP3 players, to large stationary installations like traffic lights, factory
controllers and the systems controlling nuclear power plants. Complexity varies from
low, with a single microcontroller chip, to very high with multiple units, peripherals and
networks mounted inside a large chassis or enclosure.
An embedded system is a computer system designed for specific control
functions within a larger system, often with real-time computing constraints. It is
embedded as part of a complete device often including hardware and mechanical parts.
By contrast, a general-purpose computer, such as a personal computer (PC), is designed
to be flexible and to meet a wide range of end-user needs. Embedded systems control
many devices in common use today.
Embedded systems span all aspects of modern life and there are many examples
of their use.
Telecommunications systems employ numerous embedded systems from
telephone switches for the network to mobile phones at the end-user. Computer
networking uses dedicated routers and network bridges to route data.
Consumer electronics include personal digital assistants (PDAs), MP3 players,
mobile phones, videogame consoles, digital cameras, DVD players, GPS receivers, and
printers. Many household appliances, such as microwave ovens, washing machines and
dishwashers, are including embedded systems to provide flexibility, efficiency and
features. Advanced HVAC systems use networked thermostats to more accurately and
efficiently control temperature that can change by time of day and season. Home
automation uses wired- and wireless-networking that can be used to control lights,
climate, security, audio/visual, surveillance, etc., all of which use embedded devices for
sensing and controlling.
Transportation systems from flight to automobiles increasingly use embedded
systems. New airplanes contain advanced avionics such as inertial guidance systems and
GPS receivers that also have considerable safety requirements. Various electric motors
brushless DC motors, induction motors and DC motors are using electric/electronic
motor controllers. Automobiles, electric vehicles, and hybrid vehicles are increasingly
using embedded systems to maximize efficiency and reduce pollution. Other automotive
safety systems include anti-lock braking system (ABS), Electronic Stability Control
(ESC/ESP), traction control (TCS) and automatic four-wheel drive.
-
7/27/2019 GSM Based Remote Appliance Control System
17/84
10
Medical equipment is continuing to advance with more embedded systems for
vital signs monitoring, electronic stethoscopes for amplifying sounds, and various
medical imaging (PET, SPECT, CT, MRI) for non-invasive internal inspections.
Embedded systems are especially suited for use in transportation, fire safety,
safety and security, medical applications and life critical systems as these systems can be
isolated from hacking and thus be more reliable. For fire safety, the systems can be
designed to have greater ability to handle higher temperatures and continue to operate. In
dealing with security, the embedded systems can be self-sufficient and be able to deal
with cut electrical and communication systems.
In addition to commonly described embedded systems based on small
computers, a new class of miniature wireless devices called motes is quickly gaining
popularity as the field of wireless sensor networking rises. Wireless sensor networking,
WSN, makes use of miniaturization made possible by advanced IC design to couple full
wireless subsystems to sophisticated sensors, enabling people and companies to measure
a myriad of things in the physical world and act on this information through IT
monitoring and control systems. These motes are completely self contained, and will
typically run off a battery source for many years before the batteries need to be changed
or charged.
2.2 MOBILE COMMUNICATION
Mobile telecommunication technologies have developed in successive
generations. The first generation (1G) appeared in the 1950s. The second generation
(2G) or GSM technology is used massively, but challenged globally by the next (third)
generation (3G) technologies. This sequence of generations is characterised by increasing
capacity (higher transmission speeds) and richer content of the message. Further
penetration of 3G depends critically on the integration of telecommunication services and
multimedia services, which turned out to be more complicated than most experts
predicted. Four obstacles on this expansion path can be distinguished: Firstly, after the
weakened financial position of mobile network operators, it became more difficult to
finance and construct the networks because the capital markets questioned the
profitability of these investments. This resulted in regulatory measures to facilitate the
financial viability of UMTS networks by allowing operators to share networks and
delay implementation. Secondly, many of the futuristic product and service designs
(for example computerised homes and mobile telephones functioning as credit cards or
parking tickets) of the new economy turned out to be more difficult and costly to develop
-
7/27/2019 GSM Based Remote Appliance Control System
18/84
11
and to market. Thirdly, many operators were drawn into costly license auctions
and mergers that slowed down and scaled down their investments in the latest
technology and new services. Fourthly, the operators underestimated the difficulties to
develop new business models for voice and data in 3G compared with mainly voice in
2G. Despite these obstacles the markets for mobile data and mobile Internet has
demonstrated a high and sustainable growth rate during last decade in India. Most
noteworthy are the immense and surprising successes of private SMS or short messaging
services, EMS or enhanced messaging services and the rapid growth of MMS or
multimedia messaging services. Less spectacular have been the popularity of sports, news
and weather information on the go. These markets leave ample space for a myriad of
multimedia applications. So far, technology itself seems not to be an obstacle.
Mobile phones send and receive radio signals with any number of cell site base
stations fitted with microwave antennas. These sites are usually mounted on a tower, pole
or building, located throughout populated areas, then connected to a cabled
communication network and switching system. The phones have a low-power transceiver
that transmits voice and data to the nearest cell sites, normally not more than 8 to 13 km
(approximately 5 to 8 miles) away.
When the mobile phone or data device is turned on, it registers with the mobile
telephone exchange, or switch, with its unique identifiers, and can then be alerted by the
mobile switch when there is an incoming telephone call. The handset constantly listens
for the strongest signal being received from the surrounding base stations, and is able to
switch seamlessly between sites. As the user moves around the network, the "handoffs"
are performed to allow the device to switch sites without interrupting the call.
Cell sites have relatively low-power (often only one or two watts) radio
transmitters which broadcast their presence and relay communications between the
mobile handsets and the switch. The switch in turn connects the call to another subscriber
of the same wireless service provider or to the public telephone network, which includes
the networks of other wireless carriers. Many of these sites are camouflaged to blend with
existing environments, particularly in scenic areas.
The dialogue between the handset and the cell site is a stream of digital data that
includes digitized audio (except for the first generation analog networks). The technology
that achieves this depends on the system which the mobile phone operator has adopted.
The technologies are grouped by generation. The first-generation systems started in 1979
-
7/27/2019 GSM Based Remote Appliance Control System
19/84
12
with Japan, are all analog and include AMPS and NMT. Second-generation systems,
started in 1991 in Finland, are all digital and include GSM, CDMA and TDMA.
The nature of cellular technology renders many phones vulnerable to 'cloning':
anytime a cell phone moves out of coverage (for example, in a road tunnel), when the
signal is re-established, the phone sends out a 're-connect' signal to the nearest cell-tower,
identifying itself and signaling that it is again ready to transmit. With the proper
equipment, it's possible to intercept the re-connect signal and encode the data it contains
into a 'blank' phone -- in all respects, the 'blank' is then an exact duplicate of the real
phone and any calls made on the 'clone' will be charged to the original account.
Third-generation (3G) networks, which are still being deployed, began in 2001.
They are all digital, and offer high-speed data access in addition to voice services and
include W-CDMA (known also as UMTS), and CDMA2000 EV-DO. China will launch a
third generation technology on the TD-SCDMA standard. Operators use a mix of
predesignated frequency bands determined by the network requirements and local
regulations.
In an effort to limit the potential harm from having a transmitter close to the
user's body, the first fixed/mobile cellular phones that had a separate transmitter, vehicle-
mounted antenna, and handset (known as car phones and bag phones) were limited to a
maximum 3 watts Effective Radiated Power. Modern handheld cell phones which must
have the transmission antenna held inches from the user's skull are limited to a maximum
transmission power of 0.6 watts ERP. Regardless of the potential biological effects, the
reduced transmission range of modern handheld phones limits their usefulness in rural
locations as compared to car/bag phones, and handhelds require that cell towers be spaced
much closer together to compensate for their lack of transmission power.
Some handhelds include an optional auxiliary antenna port on the back of the
phone, which allows it to be connected to a large external antenna and a 3 watt cellular
booster. Alternately in fringe-reception areas, a cellular repeater may be used, which uses
a long distance high-gain dish antenna or yagi antenna to communicate with a cell tower
far outside of normal range, and a repeater to rebroadcast on a small short-range local
antenna that allows any cell phone within a few meters to function properly.
2.3 GSM ARCHITECTURE
Global System for Mobile Communications, or GSM (originally from Groupe
Spcial Mobile), is the world's most popular standard for mobile telephone systems. The
GSM Association estimates that 80% of the global mobile market uses the standard.
-
7/27/2019 GSM Based Remote Appliance Control System
20/84
13
GSM is used by over 1.5 billion people across more than 212 countries and territories.
This ubiquity means that subscribers can use their phones throughout the world, enabled
by international roaming arrangements between mobile network operators. GSM differs
from its predecessor technologies in that both signaling and speech channels are digital,
and thus GSM is considered a second generation (2G) mobile phone system. This also
facilitates the wide-spread implementation of data communication applications into the
system.
The GSM standard has been an advantage to both consumers, who may benefit
from the ability to roam and switch carriers without replacing phones, and also to network
operators, who can choose equipment from many GSM equipment vendors. GSM also
pioneered low-cost implementation of the short message service (SMS), also called text
messaging, which has since been supported on other mobile phone standards as well. The
standard includes a worldwide emergency telephone number feature.
Newer versions of the standard were backward-compatible with the original
GSM system. For example, Release '97 of the standard added packet data capabilities by
means of General Packet Radio Service (GPRS). Release '99 introduced higher speed data
transmission using Enhanced Data Rates for GSM Evolution (EDGE).
2.3.1History
In 1982, the European Conference of Postal and Telecommunications
Administrations (CEPT) created the Groupe Spcial Mobile (GSM) to develop a standard
for a mobile telephone system that could be used across Europe. In 1987, a memorandum
of understanding was signed by 13 countries to develop a common cellular telephone
system across Europe. In 1989, GSM responsibility was transferred to the European
Telecommunications Standards Institute (ETSI) and phase-I of the GSM specifications
were published in 1990. The first GSM network was launched in 1991 by Radiolinja in
Finland with joint technical infrastructure maintenance from Ericsson. By the end of
1993, over a million subscribers were using GSM phone networks being operated by 70
carriers across 48 countries.
2.3.2 Technical details
GSM is a cellular network, which means that mobile phones connect to it by
searching for cells in the immediate vicinity. There are five different cell sizes in a GSM
networkmacro, micro, pico, femto and umbrella cells. The coverage area of each cell
varies according to the implementation environment. Macro cells can be regarded as cells
where the base station antenna is installed on a mast or a building above average roof top
-
7/27/2019 GSM Based Remote Appliance Control System
21/84
14
level. Micro cells are cells whose antenna height is under average roof top level; they are
typically used in urban areas. Picocells are small cells whose coverage diameter is a few
dozen metres; they are mainly used indoors. Femtocells are cells designed for use in
residential or small business environments and connect to the service providers network
via a broadband internet connection. Umbrella cells are used to cover shadowed regions
of smaller cells and fill in gaps in coverage between those cells.
Cell horizontal radius varies depending on antenna height, antenna gain and
propagation conditions from a couple of hundred meters to several tens of kilometers. The
longest distance the GSM specification supports in practical use is 35 kilometers. There
are also several implementations of the concept of an extended cell, where the cell radius
could be double or even more, depending on the antenna system, the type of terrain and
the timing advance.
Fig 2.2 GSM Architecture
Indoor coverage is also supported by GSM and may be achieved by using an
indoor picocell base station, or an indoor repeater with distributed indoor antennas fed
through power splitters, to deliver the radio signals from an antenna outdoors to the
separate indoor distributed antenna system. These are typically deployed when a lot of
call capacity is needed indoors; for example, in shopping centers or airports. However,
this is not a prerequisite, since indoor coverage is also provided by in-building penetration
of the radio signals from any nearby cell.
-
7/27/2019 GSM Based Remote Appliance Control System
22/84
15
The modulation used in GSM is Gaussian minimum-shift keying (GMSK), a
kind of continuous-phase frequency shift keying. In GMSK, the signal to be modulated
onto the carrier is first smoothed with a Gaussian low-pass filter prior to being fed to a
frequency modulator, which greatly reduces the interference to neighboring channels
(adjacent-channel interference).
2.3.3 GSM carrier frequencies
GSM networks operate in a number of different carrier frequency ranges
(separated into GSM frequency ranges for 2G and UMTS frequency bands for 3G), with
most 2G GSM networks operating in the 900 MHz or 1800 MHz bands. Where these
bands were already allocated, the 850 MHz and 1900 MHz bands were used instead (for
example in Canada and the United States). In rare cases the 400 and 450 MHz frequency
bands are assigned in some countries because they were previously used for first-
generation systems.
Regardless of the frequency selected by an operator, it is divided into timeslots
for individual phones to use. This allows eight full-rate or sixteen half-rate speech
channels per radio frequency. These eight radio timeslots (or eight burst periods) are
grouped into a TDMA frame. Half rate channels use alternate frames in the same timeslot.
The channel data rate for all channels is 270.83 kbit/s and the frame duration is 4.615 ms.
The transmission power in the handset is limited to a maximum of 2 watts in
GSM850/900 and 1 watt in GSM1800/1900.
2.3.4 Network structure
The network is structured into a number of discrete sections:
The Base Station Subsystem (the base stations and their controllers).
The Network and Switching Subsystem (the part of the network most similar
to a fixed network). This is sometimes also just called the core network.
The GPRS Core Network (the optional part which allows packet based
Internet connections).
The Operations support system (OSS) for maintenance of the network.
2.3.5 Subscriber Identity Module (SIM)
One of the key features of GSM is the Subscriber Identity Module, commonly
known as a SIM card. The SIM is a detachable smart card containing the user's
subscription information and phone book. This allows the user to retain his or her
information after switching handsets. Alternatively, the user can also change operators
-
7/27/2019 GSM Based Remote Appliance Control System
23/84
16
while retaining the handset simply by changing the SIM. Some operators will block this
by allowing the phone to use only a single SIM, or only a SIM issued by them; this
practice is known as SIM locking.
Fig. 2.3 SIM card
2.3.6 GSM service security
GSM was designed with a moderate level of service security. The system was
designed to authenticate the subscriber using a pre-shared key and challenge-response.
Communications between the subscriber and the base station can be encrypted. The
development of UMTS introduces an optional Universal Subscriber Identity Module
(USIM), that uses a longer authentication key to give greater security, as well as mutually
authenticating the network and the user - whereas GSM only authenticates the user to the
network (and not vice versa). The security model therefore offers confidentiality and
authentication, but limited authorization capabilities, and no non-repudiation.
GSM uses several cryptographic algorithms for security. The A5/1 and A5/2
stream ciphers are used for ensuring over-the-air voice privacy. A5/1 was developed first
and is a stronger algorithm used within Europe and the United States; A5/2 is weaker and
used in other countries. Serious weaknesses have been found in both algorithms: it is
possible to break A5/2 in real-time with a ciphertext-only attack, and in February 2008,
Pico Computing, Inc revealed its ability and plans to commercialize FPGAs that allow
A5/1 to be broken with a rainbow table attack. The system supports multiple algorithms
so operators may replace that cipher with a stronger one.
On 28 December 2009 German computer engineer Karsten Nohl announced that
he had cracked the A5/1 cipher. According to Nohl, he developed a number of rainbow
tables (static values which reduce the time needed to carry out an attack) and have found
new sources for known plaintext attacks. He also said that it is possible to build "a full
-
7/27/2019 GSM Based Remote Appliance Control System
24/84
17
GSM interceptor from open source components" but that they had not done so because of
legal concerns.
Although security issues remain for GSM newer standards and algorithms may
address this. New attacks are growing in the wild which take advantage of poor security
implementations, architecture and development for smart phone applications. Some
wiretapping and eavesdropping techniques hijack the audio input and output providing an
opportunity for a 3rd party to listen in to the conversation. Although this threat is
mitigated by the fact the attack has to come in the form of a Trojan, malware or a virus
and might be detected by security software.
2.3.7 GSMs strength
GSM is the first to apply the TDMA scheme developed for mobile radio
systems. It has several distinguishing features:
1. Roaming in European countries
2. Connection to ISDN through RA box
3. Use of SIM cards
4. Control of transmission power
5. Frequency hopping
6. Discontinuous transmission
7. Mobile-assisted handover
-
7/27/2019 GSM Based Remote Appliance Control System
25/84
18
3. SYSTEM DEVELOPMENT
System development can be divided into sections as below:
(1)Design of power section
(2)Design of relay circuit
(3)Design of main controller board
(4)Circuit diagrams
(5)PCB layouts
(6)System software development.
3.1 DESIGN OF POWER SECTION
The project requires DC voltage supply of +5V and +12V and a common ground
which is derived from AC supply of 230V mains.
1) Selection of transformer
We use bridge rectifier configuration because it has half PIV and higher
rectification efficiency than other configurations.
We need to select a transformer with a center-tapping on secondary.
We need Vdc = 12V and 5V.
So we select a transformer with secondary of 12-0-12.
2) Selection of diode
Possible PIV across each diode is Vdc = 12V.
So we have to select four diodes with PIV more than 12V.
We select 1N4007 silicon diodes as D1 to D4 considering worst case scenario.
3) Selection of regulator IC
To get 5V regulated supply out of 12V, we use fixed voltage monolithic regulator
IC LM7805.
It utilizes common ground for input and output.
A capacitor C3 of 0.1uF is connected at output of LM7805 to improve the
transient response.
4) Selection of filter capacitor
To filter the ripple out, we use an electrolyte capacitor of value C1 = 1000uF.
5) Selection of indication circuit components
To indicate power status of circuit, we have simply formed an LED indicator
circuit.R1 = (Vdc - Vdrop) / Imax
-
7/27/2019 GSM Based Remote Appliance Control System
26/84
19
= (5-0.7)/10mA = 430
We select a standard resistance value of 470 .
An LED with drop 0.7V in series with R1 is connected across Vdc and GND.
Lit LED indicates power ON condition.6) Selection of heat sink
IC LM7805 generates a large amount of heat, to dissipate that heat we have
mounted heat sink.
Fig. 3.1 Circuit diagram of power supply section
3.2 DESIGN OF RELAY CIRCUIT
1) Selection of relay driver
Select ULN2803APG from TOSHIBA as it serves our purpose well here.
The ULN2803APG Series are highvoltage, highcurrent darlington drivers
comprised of eight NPN darlington pairs. All units feature integral clamp diodes
for switching inductive loads.
Applications include relay, hammer, lamp and display (LED) drivers.
Fig. 3.2 ULN 2803 pin configuration
-
7/27/2019 GSM Based Remote Appliance Control System
27/84
20
2) Selection of relays
Relays are very important part of this project. It acts as a switch to turn a home
appliance on or off. Usually the home appliances operate on AC mains which is
230V at 50Hz in India. So we have to choose relays with minimum switching
voltage capacity of 240V AC and minimum switching current of 5A.
We select HK make JQC-3FC/T73 model PCB mounted Sugar Cube relay. It has
maximum voltage switching capacity of 250V AC and maximum current
switching capacity of 7A.
About relay:
Fig. 3.3 HKE make JQC-3FC/T73 12VDC
Characteristics of relay:
Max. Switching current 7A, 10A
Max. switching voltage 28V DC/ 250V AC
Dielectric strength Vrms
Between open contacts
Between coil and contacts
Between contacts form
750VAC
1000VAC
1000VACAmbient temperature -40 - +85oC
Operation/Release time 10/8 ms
Contact Capacity 10A 240VAC, 6.3A 28VDC
Table 3.1 Relay characteristics
3) Selection of indication circuit components
To indicate the status of the relay, an LED is connected to relay input.
It acts similar to the indication circuit in the power supply section.
R1 = (V - Vdrop) / Imax
Bigger dot in this Small dot in
this corner upper corner
Rectangular cut in
middle top side of this
face
-
7/27/2019 GSM Based Remote Appliance Control System
28/84
21
= (5 - 0.7)/10mA = 430
We select a standard resistance value of 470 .
An LED with drop 0.7V in series with R1 is connected across Vdc and GND.
Lit LED indicates power ON condition.3.3 DESIGN OF MAIN CONTROLLER BOARD
1) Selection of microcontroller
Selection criteria:
1.The first and foremost criterion for selecting a microcontroller is that it must
meet the task at hand efficiently and cost effectively. In analyzing the need of a
microcontroller based project we must see whether an 8 bit, 16 bit or 32 bit
microcontroller can best handle the computing need of the task most efficiently.
Among other consideration in this category are speed, power consumption,
amount of on chip RAM and ROM, the number of I/O pin, and cost per unit.
2.Second is how easy is to develop product around it. Key considerations are the
availability of an assembler, debugger, emulator, technical support.
3.Its readily availability in needed quantity, both now and in future.
Though very slight difference between the features of AT89C51 and AT89C52,
they are very similar in their pin configurations and operations. The differences between
AT89C51 and AT89C52 have been tabulated below.
Microcontroller AT89C52 AT89C51
RAM 256 Bytes 128 Bytes
Flash 8 KB 4 KB
Number of Timers/Counters 3 (16-bit each) 2 (16-bit each)
Number of Interrupt Sources 8 6
Table 3.2 Comparison of 89C52 with 89C51
Taking all the above considerations we have chosen ATMEL 89C52
microcontroller because it meets selection most appropriately.
3.3.1 Brief History of Microcontrollers:
In 1981, Intel Corporation introduced an 8-bit microcontroller called the 8051,
this microcontroller had 128 bytes of RAM, 4 bytes of on chip ROM, two timers, one
serial port, and four ports (each 8-bit wide) all on a single chip. At this time it was
referred to as a system on chip. The 8052 is an 8-bit processor, meaning that the CPU
can work on only 8 bit at a time. Data larger than 8 bit have to be broken up into 8 bit
-
7/27/2019 GSM Based Remote Appliance Control System
29/84
22
pieces to be processed by the CPU. The 8051 now has a total of four I/O ports, each 8 bit
wide.
The 8051 became widely popular after Intel allowed other manufacturers to
make and market any flavor of the 8051 with the condition that they remain code
compatible with 8051. This had lead to many versions of 8051 with a different speed and
amount of on chip ROM marketed by more than half a dozen manufacturers. There are
two other members of the 8051 family, they are 8051 and 8031. 8052 is a version of 8051
with higher RAM and ROM.
Features of microcontroller Atmel 89S52:
Compatible with MCS-51 Products
8K Bytes of In-System Reprogrammable Flash Memory
Endurance: 1,000 Write/Erase Cycles
Fully Static Operation: 0 Hz to 24 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
Programmable Serial Channel
3.3.2 Description
The AT89S52 is a low-power, high-performance CMOS 8-bit microcomputer
with 8K bytes of Flash programmable and erasable read only memory (PEROM). The
device is manufactured using Atmels high-density nonvolatile memory technology and is
compatible with the industry-standard 80C51 and 80C52 instruction set and pinout.
Fig. 3.4 Atmel AT89C52
-
7/27/2019 GSM Based Remote Appliance Control System
30/84
23
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
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 con-tents but freezes the oscillator, disabling all other chip functions until the next
interrupt occurs.
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 Atmels high-density nonvolatile memory technology and is compatible with the
industry-standard 80C51 instruction set and pinout.
-
7/27/2019 GSM Based Remote Appliance Control System
31/84
24
Fig. 3.5 89S52 Block Diagram
-
7/27/2019 GSM Based Remote Appliance Control System
32/84
25
Pin No Function Name
1 External count input to Timer/Counter 2, clockout T2 P1.0
2Timer/Counter 2 capture/reload trigger and
direction controlT2 EX P1.1
3
8 bit input/output port (P1) pins
P1.2
4 P1.3
5 P1.4
6 P1.5
7 P1.6
8 P1.7
9 Reset pin; Active high Reset
10Input (receiver) for serial
communicationRxD
8 bitinput/output
port (P3) pins
P3.0
11Output (transmitter) for serial
communicationTxD P3.1
12 External interrupt 1 Int0 P3.213 External interrupt 2 Int1 P3.3
14 Timer1 external input T0 P3.4
15 Timer2 external input T1 P3.5
16 Write to external data memory Write P3.6
17 Read from external data memory Read P3.7
18Quartz crystal oscillator (up to 24 MHz)
Crystal 2
19 Crystal 1
20 Ground (0V) Ground
21
8 bit input/output port (P2) pins
/
High-order address bits when interfacing with external
memory
P2.0/ A8
22 P2.1/ A9
23 P2.2/ A10
24 P2.3/ A11
25 P2.4/ A12
26 P2.5/ A13
27 P2.6/ A14
28 P2.7/ A15
29 Program store enable; Read from external program memory PSEN
30Address Latch Enable ALE
Program pulse input during Flash programming Prog
31External Access Enable; Vcc for internal program executions EA
Programming enable voltage; 12V (Flash programming) Vpp
32
8 bit input/output port (P0) pins
Low-order address bits when interfacing with external
memory
P0.7/ AD7
33 P0.6/ AD6
34 P0.5/ AD5
35 P0.4/ AD4
36 P0.3/ AD3
37 P0.2/ AD2
38 P0.1/ AD1
39 P0.0/ AD0
40 Supply voltage; 5V (up to 6.6V) Vcc
Table 3.3 89C52 pin functions
-
7/27/2019 GSM Based Remote Appliance Control System
33/84
26
3.3.3 Pin Description
(1)VCC
Supply voltage of 5V (or 12V for VPP) in programming mode.
(2)GND
This pin serves for ground connection of 0 volts.
(3)Port 0
Port 0 is an 8-bit open drain bi-directional 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 pullups.
Port 0 also receives the code bytes during Flash programming and outputs the
code bytes during program verification. External pullups are required during program
verification.
(4)Port 1
Port 1 is an 8-bit bi-directional I/O port with internal pullups. 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 pullups and can be used as inputs. As inputs, Port 1 pins that
are externally being pulled low will source current (I IL) because of the internal pullups.
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.
Existing Alternate Function
P1.0 T2 Timer/counter 2 External Count input, clock out
P1.1 T2 EX Timer/counter 2 Trigger input
Table 3.4 Port 1 alternate functions
(5)Port 2
Port 2 is an 8-bit bi-directional I/O port with internal pullups. 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 pullups and can be used as inputs. As inputs, Port 2 pins that
are externally being pulled low will source current (I IL) because of the internal pullups.
-
7/27/2019 GSM Based Remote Appliance Control System
34/84
27
Port 2 emits the high-order address byte during fetches from external program
memory and during accesses to external data memory that use 16-bit addresses (MOVX
@DPTR). In this application, Port 2 uses strong internal pullups when emitting 1s.
During access to external data memory that uses 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.
(6)Port 3
Port 3 is an 8-bit bi-directional I/O port with internal pullups. 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 pullups and can be used as inputs. As inputs, Port 3 pins that
are externally being pulled low will source current (I IL) because of the pullups.
Port 3 also serves the functions of various special features of the AT89C52, as
shown in the following table. Port 3 also receives some control signals for Flash
programming and verification.
Port Pin Alternate Functions
P3.0 RXD (serial input port)
P3.1 TXD (serial output port)
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 (external data memory write strobe)
P3.7 RD (external data memory read strobe)
Table 3.5 Port 3 pin alternate functions
(7)RST
Reset input. A high on this pin for two machine cycles while the oscillator is
running resets the device.
(8)ALE/PROG
Address Latch Enable 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.
-
7/27/2019 GSM Based Remote Appliance Control System
35/84
28
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.
(9)PSEN
Program Store Enable is the read strobe to external program memory. When the
AT89C52 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.
(10)EA/VPP
External Access Enable. EA must be strapped to GND in order to enable the
device to fetch code from external program memory locations starting at 0000H up to
FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally latched on
reset. EA should be strapped to VCC for internal program executions. This pin also
receives the 12-volt programming enable voltage (VPP) during Flash programming when
12-volt programming is selected.
(11)XTAL1
Input to the inverting oscillator amplifier and input to the internal clock
operating circuit.
(12)XTAL2
Output from the inverting oscillator amplifier. A crystal of frequency 4 to 24
MHz is connected between pins XTAL1 and XTAL2.
Special Function Registers (SFRs)
A map of the on-chip memory area called the Special Function Register (SFR)
space is shown in Table 1. Note that not all of the addresses are occupied, and unoccupied
addresses may not be implemented on the chip.Read accesses to these addresses will in
general return random data, and write accesses will have an indeterminate effect.
Timer 2 Registers Control and status bits are contained in registers T2CON
(shown in Table 2) and T2MOD for Timer 2. The register pair (RCAP2H, RCAP2L) are
the Capture/Reload registers for Timer 2 in 16-bit capture mode or 16-bit auto-reload
mode.
-
7/27/2019 GSM Based Remote Appliance Control System
36/84
29
Interrupt Registers The individual interrupt enable bits are in the IE register.
Two priorities can be set for each of the six interrupt sources in the IP register.
Data Memory
The AT89C52 implements 256 bytes of on-chip RAM. The upper 128 bytes
occupy a parallel address space to the Special Function Registers. That means the upper
128 bytes have the same addresses as the SFR space but are physically separate from SFR
space. When an instruction accesses an internal location above address 7FH, the address
mode used in the instruction specifies whether the CPU accesses the upper 128 bytes of
RAM or the SFR space. Instructions that use direct addressing access SFR space.
For example, the following direct addressing instruction accesses the SFR at
location 0A0H (which is P2).
MOV 0A0H, #data
Instructions that use indirect addressing access the upper 128 bytes of RAM. For
example, the following indirect addressing instruction, where R0 contains 0A0H,
accesses the data byte at address 0A0H, rather than P2 (whose address is 0A0H).
MOV @R0, #data
Note that stack operations are examples of indirect addressing, so the upper 128
bytes of data RAM are available as stack space.
Timer 0 and 1
Timer 0 and Timer 1 in the AT89C52 operate the same way as Timer 0 and
Timer 1 in the AT89C51.
Timer 2
Timer 2 is a 16-bit Timer/Counter that can operate as either a timer or an event
counter. The type of operation is selected by bit C/T2 in the SFR T2CON (shown in
Table 2).
Timer 2 has three operating modes: capture, auto-reload (up or down counting),
and baud rate generator. The modes are selected by bits in T2CON, as shown in Table
below. Timer 2 consists of two 8-bit registers, TH2 and TL2. In the Timer function, the
TL2 register is incremented every machine cycle. Since a machine cycle consists of 12
oscillator periods, the count rate is 1/12 of the oscillator frequency.
-
7/27/2019 GSM Based Remote Appliance Control System
37/84
30
RCLK+TCLK CP/RL2 TR2 MODE
0 0 1 16-bit auto reload
0 1 1 16-bit capture
1 X 1 Baud Rate generatorX X 0 (Off)
Table 3.6 Timer 2 operating modes
In the Counter function, the register is incremented in response to a 1-to-0
transition at its corresponding external input pin, T2. In this function, the external input is
sampled during S5P2 of every machine cycle. When the samples show a high in one cycle
and a low in the next cycle, the count is incremented. The new count value appears in the
register during S3P1 of the cycle following the one in which the transition was detected.
Since two machine cycles (24 oscillator periods) are required to recognize a 1-to-0
transition, the maximum count rate is 1/24 of the oscillator frequency. To ensure that a
given level is sampled at least once before it changes, the level should be held for at least
one full machine cycle.
Capture Mode
In the capture mode, two options are selected by bit EXEN2 in T2CON. If
EXEN2 = 0, Timer 2 is a 16-bit timer or counter which upon overflow sets bit TF2 in
T2CON. This bit can then be used to generate an interrupt. If EXEN2 = 1, Timer 2
performs the same operation, but a 1-to-0 transition at external input T2EX also causes
the current value in TH2 and TL2 to be captured into RCAP2H and RCAP2L,
respectively. In addition, the transition at T2EXcauses bit EXF2 in T2CON to be set. The
EXF2 bit, like TF2, can generate an interrupt. The capture mode is illustrated in Figure 1.
Auto-reload (Up or Down Counter)
Timer 2 can be programmed to count up or down when configured in its 16-bit
auto-reload mode. This feature is invoked by the DCEN (Down Counter Enable) bit
located in the SFR T2MOD. Upon reset, the DCEN bit is set to 0 so that timer 2 will
default to count up. When DCEN is set, Timer 2 can count up or down, depending on the
value of the T2EX pin.
UART
It is the Universal Asynchronous Receiver Transmitter. The UART in the
AT89C52 operates the same way as the UART in the AT89C51. It is used for serial
communication with other compatible devices.
-
7/27/2019 GSM Based Remote Appliance Control System
38/84
31
Interrupts
The AT89C52 has a total of six interrupt vectors: two external interrupts (INT0
and INT1), three timer interrupts (Timers 0, 1, and 2), and the serial port interrupt. These
interrupts are all shown in Figure 6.
Each of these interrupt sources can be individually enabled or disabled by setting
or clearing a bit in Special Function Register IE. IE also contains a global disable bit, EA,
which disables all interrupts at once.
Note that Table shows that bit position IE.6 is unimplemented. In the AT89C51,
bit position IE.5 is also unimplemented. User software should not write 1s to these bit
positions, since they may be used in future AT89 products.
Timer 2 interrupt is generated by the logical OR of bits TF2 and EXF2 in
register T2CON. Neither of these flags is cleared by hardware when the service routine is
vectored to. In fact, the service routine may have to determine whether it was TF2 or
EXF2 that generated the interrupt, and that bit will have to be cleared in software.
The Timer 0 and Timer 1 flags, TF0 and TF1, are set at S5P2 of the cycle in
which the timers overflow. The values are then polled by the circuitry in the next cycle.
However, the Timer 2 flag, TF2, is set at S2P2 and is polled in the same cycle in which
the timer overflows.
Symbol Position Function
EA IE.7
Disables all interrupts. If EA = 0, no interrupt is
acknowledged. If EA = 1, each interrupt source
is individually enabled or disabled by setting or
clearing its enable bit.
- IE.6 Reserved
ET2 IE.5 Timer 2 interrupt enable bit
ES IE.4 Serial Port interrupt enable bit.
ET1 IE.3 Timer 1 interrupt enable bit.
EX1 IE.2 External interrupt 1 enable bit.
ET0 IE.1 Timer 0 interrupt enable bit
EX0 IE.0 External interrupt 0 enable bit.
Table 3.7 Interrupt Sources
-
7/27/2019 GSM Based Remote Appliance Control System
39/84
32
(LSB) (MSB)
A T2 S T1 X1 T0 X0
Enable Bit = 1 enables the interrupt
Enable Bit = 0 disables the interrupt
Table 3.8 Interrupt Enable (IE) Register
2) Design of clock generation circuit
The 8052 has an on-chip oscillator but requires an external clock to run it. Most
often a quartz crystal oscillator is connected to inputs XTAL1 (pin 19) and XTAL2 (pin
18). The quartz crystal oscillator connected to XTAL1 and XTAL2 also needs two
capacitors of 30pF value. One side of each capacitor is connected to ground as shown in
figure below.
Fig. 3.6 Clock generation circuitry
3) Design of pull-up networks
Fig. 3.7 Pull-up network
-
7/27/2019 GSM Based Remote Appliance Control System
40/84
33
In the 8051 based systems where there is no exrernal memory connection, the
pins of port 0 must be connected externally to a 10K-ohm pullup resistor. This is due to
the fact that P0 is an open drain unlike P1, P2 and P3. With external pull-up resistors
connected to P0, it can be used as a simple I/O port, just like P1 and P2.
4) Design of reset circuit
Pin 9 is the reset pin. It is an input and is active high (normally low). Upon
applying a high pulse to this pin, the microcontroller will reset and terminate all activities.
This is often referred to as a power-on reset. Activating a power-on reset will cause all
values in the registers to be lost. It will set program counter to all 0s.
Following figure shows the way of connecting the RST pin to the power-on
circuitry. An 8.2K-ohm resistor and 10 uF capacitor forms the RST circuitry.
Fig. 3.8 Reset circuitry
5) Selection of line converter IC
The 8052 has two pins that are used specifically for transferring and receivingdata serially. These two pins are called as TxD and RxD and are part of the port 3 group
(P3.0 and P3.1). Pin 11 of the 8052 (P3.1) is assigned to TxD and pin 10 (P3.0) is
designated as RxD. These pins are TTL compatible; therefore, they require a line driver to
make them RS232 compatible. One such line driver is the MAX232 chip. This is
discussed next.
3.3.4 MAX232
Since the RS232 is not compatible with 8052, we employ RS232 (voltage
converter) to convert the signals to TTL voltage levels that will be acceptable to the
-
7/27/2019 GSM Based Remote Appliance Control System
41/84
34
8051s TxD and RxD pins. One example of such a converter is MAX232 from Maxim
Corp. The RS232 voltage levels to TTL voltage levels, and vice versa. Other advantage of
the MAX232 chip is that it uses a +5V power source which, is same as the source voltage
for 8052.
The MAX232 has two sets of line drivers for transferring and receiving data, as
shown in the figure below. The line drivers used for TxD are called T1 and T2, while line
drivers for RxD are designated as R1 and R2. In many of the applications only one of
each is used. For example, T1 and R1 are used together for TxD and RxD of the 8052,
and the second is left unused. The T1in pin is the TTL side and is connected to TxD of
the microcontroller, while T1out is the RS232 side that is connected to the RxD pin of
RS232 DB connector. The R1 line driver has a designation of R1in and R1out on pin
numbers 13 and 12, respectively. The R1in (pin 13) is the RS232 side that is connected to
the TxD pin of the RS232 DB connector, and R1out (pin 12) is the TTL side that is
connected to the RxD pin of the microcontroller. MAX232 requires four capacitors
ranging from 1 to 22 uF. The most widely used value for this capacitors is 22 uF.
Fig. 3.9 Pin diagram of MAX232
Applications of MAX232:
1. Portable Computers
2. Low-Power Modems
-
7/27/2019 GSM Based Remote Appliance Control System
42/84
35
3. Interface Translation
4. Battery-Powered RS-232 Systems
5. Multidrop RS-232 Networks
3.4 CIRCUIT LAYOUT
1. Main controller board
Fig. 3.10 Main controller board circuit
-
7/27/2019 GSM Based Remote Appliance Control System
43/84
36
2. Relay Board
Fig. 3.11 Relay board circuit
3. Power supply board
Fig. 3.12 Power supply circuit
-
7/27/2019 GSM Based Remote Appliance Control System
44/84
37
3.5 PCB LAYOUTS
1) PCB Layout for Main Controller Board
Fig. 3.13 PCB layout of main controller board
-
7/27/2019 GSM Based Remote Appliance Control System
45/84
38
2) PCB layout for Relay Board
Fig. 3.14 PCB layout of Relay board
3) PCB Layout for Power Supply Board
Fig. 3.15 PCB layout of power supply board
-
7/27/2019 GSM Based Remote Appliance Control System
46/84
39
3.6 SYSTEM SOFTWARE DESIGN
As our project work involved the applications of software, on consulting with
our project guide we came to the conclusion that we shall use Embedded C for
programming utilizing the Keil software.
Use of embedded processors in passenger cars, mobile phones, medical
equipment, aerospace systems and defense systems is widespread, and even everyday
domestic appliances such as dish washers, televisions, washing machines and video
recorders now include at least one such device. There is a large and growing international
demand for programmers with 'embedded' skills, and many desktop developers are
starting to move into this important area.
The applications of Embedded C are exploited through the Keil software. Keil
was founded in 1986 to market add-on products for the development tools provided by
many of the silicon vendors. It soon became evident that there was a void in the
marketplace that must be filled by quality software development tools. It was then that
Keil implemented the first C compiler designed from the ground-up specifically for the
8051 microcontroller.
Need of programming in Embedded C
The compiler produces HEX files that we download into the ROM of the
microcontroller. The size of HEX file produced by the compiler is one of the main
concerns of microcontroller programmers for the following 2 reasons:
1.Microcontrollers have limited on chip ROM.
2.The code space for 8051 is limited to 64 Kbytes.
The choice of programming language can affect the compiled program size.
While Assembly language produces a hex life that is much smaller than C
programming, in assembly language it is tedious and time consuming process to write
system program code. While in Embedded C it is much easier to write the system
program code, but the hex files size produced is much larger if we need assembly
language.
The following are some of major reasons for writing C instead of Assembly:
1. It is easier & less time consuming to write in C than Assembly.
2. C is easier to modify & update.
3. You can use code available in function libraries.
4. C code is portable to other microcontrollers with little or no modifications.
5. It is easier to develop and understand.
-
7/27/2019 GSM Based Remote Appliance Control System
47/84
40
KEIL Micro Vision is an integrated development environment used to create
software to be run on embedded systems such as a microcontroller. It allows for such
software to be written either in assembly or C programming languages and for that
software to be simulated on a computer before being loaded onto the microcontroller.
The code language used is C.
Fig. 3.16 Keil Vision IDE
3.6.1 ALGORITHM
Before designing any program it is necessary to first develop its algorithm and
basic flowchart. Algorithm is the set of simple and easily understandable statements that
aims to solve the problem in few steps. An algorithm is a representation of a solution to a
problem. If a problem can be defined as a difference between a desired situation and the
current situation in which one is, then a problem solution is a procedure, or method, for
transforming the current situation to the desired one. We solve many such trivial
problems every day without even thinking about it, for example making breakfast,
travelling to the workplace etc.
1. Initialize the receiver
2. Check for new commands
3. Read commands
4. Update status of relays
-
7/27/2019 GSM Based Remote Appliance Control System
48/84
41
5. Delete message
6. Go to step 1
3.6.2 FLOWCHART
Flowcharting is a tool developed in the computer industry, for showing
the steps involved in a process. A flowchart is a diagram made up of boxes, diamonds
and other shapes, connected by arrows - each shape represents a step in the process, and
the arrows show the order in which they occur. Flowcharting combines symbols and
flowlines, to show figuratively the operation of an algorithm.
Fig. 3.17 Flowchart of system code
START
Initialize receiver
Check
whether new
message?
Switch relay
No
Yes
Delete message
Request new command
Receive message from
Modem
Get message
-
7/27/2019 GSM Based Remote Appliance Control System
49/84
42
3.6.3 SYSTEM PROGRAM
#include // standard 8052 library
#include // for using printf
sbit RELAY1=P1^4;
sbit RELAY2=P1^5;
sbit RELAY3=P1^6;
sbit RELAY4=P1^7;
unsigned char z,ret;
unsigned char MSGMODE[] = "AT+CMGF=1"; //text message mode
unsigned char MSGREAD[] = "AT+CMGS=1"; //read 1st message
unsigned char MSGDEL[] = "AT+CMGD=1"; //delete message
void send_rqst(void);
unsigned char get_response(void);
void relay(unsigned char);
void del_msg(void);
void carriage_return(void);
void serial_init(void);
void main(void);
{
serial_init();
RELAY1=0;
RELAY2=0;
RELAY3=0;
RELAY4=0;
while(1){
send_rqst(); // send request
ret = get_response(); // get message
relay(ret); // switch relay
del_msg(); // delete message
}
}
-
7/27/2019 GSM Based Remote Appliance Control System
50/84
43
/* set up serial link */
void serial_init()
{
SCON = 0x50;// 8-bit UART mode
TMOD = 0x20; // timer 1 mode 2 auto reload
TH1 = 0xFD; // 9600 8-n-1
TR1 = 1; // run timer1
}
/* SEND MESSAGE REQUEST */
void send_rqst()
{for (z=0;z
-
7/27/2019 GSM Based Remote Appliance Control System
51/84
44
/* Switch relay according to input */
void relay(unsigned char ret)
{
switch(ret)
{
case '1':
RELAY1=1;
break;
case '2':
RELAY2=1;
break;
case '3':
RELAY3=1;
break;
case '4':
RELAY4=1;
break;
case '5':
RELAY1=0;
break;
case '6':
RELAY2=0;
break;
case '7':
RELAY3=0;
break;case '8':
RELAY4=0;
break;
}
}
-
7/27/2019 GSM Based Remote Appliance Control System
52/84
45
/* delete message */
void del_msg()
{
for (z=0;z
-
7/27/2019 GSM Based Remote Appliance Control System
53/84
46
4. PERFORMANCE ANALYSIS
4.1 FIRST INSTALLATION
The operation of complete unit with basic setup is explained here:
1. Prepare a rough map of the room or hall in which the appliance control is to be
achieved. Detailing should be restricted to interested appliances and wiring or
electric installations and fittings.
2. Check the appliances ratings for current consumption rating (I). If the current
drawn is not mentioned then it can be reckoned from power rating as
I (A) = Power (W) / 230 (V).
3. If the current rating is lower than or equal to 5A, then the appliance is readily
compatible with the relays used. If not, relay(s) must be replaced with those
having current rating higher than I.
4. Trace out the suitable central switchboard panel in the hall. This point can be
easily selected as the switchboard that is equidistant from most appliances or from
their respective supply points.
5. Open the switchboard panel and find out phase wire points in plug sockets. Phase
lines are live conductors which can be identified by phase testers. Open the phase
line connection to socket and connect the relay path wires to just openedterminals.
6. Now the connection of the mains supply to the appliances connected to these
sockets are controlled by two switchesphysical make or break switches and the
relay board switches.
7. Note the serial numbers of socket against relay numbers.
8. Plug the power connector of appliances to sockets and remember its serial
numbers.
9. Turn on the switches of appliances to be used.
10.Connect the DC adapter of GSM modem and AC supply socket to switchboard.
These plugs are to be connected where we have not connected relays, as they are
always kept in ON condition.
11.Place the SIM card in GSM modem in the mentioned manner and lock it.
12.SIM card should be chosen to provide good coverage in the whole home.
13.Turn the modem and main controller board ON and switch them OFF only when
system is not to be used for long time such as 1 day or more.
-
7/27/2019 GSM Based Remote Appliance Control System
54/84
47
4.2 ROUTINE OPERATION
1. To control any appliance, its serial no. must be remembered first.
2. Select the write text message function from menu in the mobile phone.
3. Write the control word followed by # (brackets not to be included). If more than
one action is required, write them serially, separated by ,.
4. Example: To turn appliance 1 on, write message 1#, to turn it off 5#. To switch
appliance 4 on and turn appliance 2 off, write 4#,6#.
5. Send the message to the mobile phone number of the SIM by pressing SEND or
CONNECT key. For frequent operation, this number should be stored in the
phone directory.
6. When the message is received by modem, it is decoded and respective appliances
are turned on or off.
7. If, for some reason, the system doesnt work, press RESET key on main controller
board. That should turn all the appliances off irrespective of their initial
conditions.
4.3 CONTROL WORDS
Appliance Serial No.Control Words
To turn ON To turn OFF
1 1# 5#
2 2# 6#
3 3# 7#
4 4# 8#
1 and 2 1#,2# 5#,6#
1 and 3 1#,3# 5#,7#
1 and 4 1#,4# 5#,8#
2 and 3 2#,3# 6#,7#
2 and 4 2#,4# 6#,8#
3 and 4 3#,4# 7#,8#
1, 2 and 3 1#,2#,3# 5#,6#,7#
1, 2 and 4 1#,2#,4# 5#,6#,8#
1, 3 and 4 1#,3#,4# 5#,7#,8#
2, 3 and 4 2#,3#,4# 6#,7#,8#
1,2,3 and 4 1#,2#,3#,4# 5#,6#,7#,8#
Table 4.1 Control words
-
7/27/2019 GSM Based Remote Appliance Control System
55/84
48
The control message sent to the system may contain any of the codeword given
in the table 4.1 and other possible combinations. The order of the commands has no effect
on the operation as will be seen soon in the results table 4.2.
4.4 RESULTS
CaseSENT MESSAGE
(INPUT)RESPONSE (OUTPUT)
1 1# APPL 1 turns on
2 2# APPL 2 turns on
3 3# APPL 3 turns on
4 4# APPL 4 turns on
5 5# APPL 1 turns off
6 6# APPL 2 turns off
7 7# APPL 3 turns off8 8# APPL 4 turns off
9 1#,2# APPL 1 and APPL 2 turns on
10 1#,3# APPL 1 and APPL 3 turns on
11 1#,4# APPL 1 and APPL 4 turns on
12 2#,1# Same response as case 12
13 2#,3# APPL 2 and APPL 3 turns on
14 2#,4# APPL 2 and APPL 4 turns on
15 3#,4# APPL 3 and APPL 4 turns on
16 5#,6# APPL 1 and APPL 2 turns off
17 5#,7# APPL 1 and APPL 3 turns off
18 5#,8# APPL 1 and APPL 4 turns off
19 6#,7# APPL 2 and APPL 3 turns off
20 6#,8# APPL 2 and APPL 4 turns off
21 7#,