You are on page 1of 45


Sr. No.














ABSTRACT ..... 1-2





GSM . 7-9






11) PROGRAM USED . 15-17






CONCULSION .................. 30-41


BIBLOGRAPHY.. ...42-56


This project demonstrates a novel method which enables users to control industrial appliances
and systems from remote using a cell phone-based interface. In its most simple form Home
Automation is the ability to control lighting & household appliances remotely. Almost
everyone already has a limited amount of Home Automation. Home Automation is analogous
to earlier developments in factory and office automation. It includes the remote control and
monitoring of domestic appliances, home security and energy management. To access the
control unit, the user should send an authentication code (DTMF) along with the
required/desired function/action to his/her home control system via Global System for Mobile
communication (GSM). Upon being properly authenticated, the cell phone-based interface at
home (control unit) would relay the commands to a microcontroller that would perform the
required function/action, and return a function completion code that would be sent to the
source of the original command (users cell phone).


Imagine being able to control all the electrical appliances of your home from virtually any
place you are in the world! For example, say one cold winter day, you are stuck in traffic on
the motorway after a long day at work. By pressing a few keystrokes on your mobile phone,
you activate a macro which turns on the heating, prepares your Jacuzzi, and switches on your
electrical fireplace and lava-lamps at your premises.
In today's times the GSM mobile terminal has become one of the items that are constantly
with us. Just like our wallet/purse, keys or watch, the GSM mobile terminal provides us with
a communication channel that enables us to communicate with the world. The want for a
person to be reachable or to call anyone at any time is very appealing.
Using the cybernetic concept of action space, we in fact extend the action space of the human
with the mobile terminal, enabling the subscriber to talk to another subscriber and thus
exchange information, issue or receive commands.
This Project is used to control our household electrical devices from anywhere through the
cell phone. The circuit consists of a DTMF tone detector and a powerful 8 bit Microcontroller
AT89C51. The microcontroller controls all the system. In this project we control total four
The Microcontroller senses the DTMF signal through the DTMF decoder IC MT8870 and it
switch on/off the corresponding devices according to the user need. The circuit has an inbuilt
phone ring sensor circuit and the system will take over the phone control if it was not taken
manually. Press the corresponding numbers to turn on/off the devices.
The aim of the project is to investigate a cost effective solution that will provide controlling
of home appliances remotely and will also enable home security against intrusion in the
absence of home owner.
The motivation is to facilitate the users to automate their homes having ubiquitous access.
The system provides availability due to development of a low cost system. The home
appliances control system with an affordable cost was thought to be built that should be
mobile providing remote access to the appliances and allowing home security.
Home security has been a major issue where crime is increasing and everybody wants to take
proper measures to prevent intrusion. In addition there was a need to automate home so that
user can take advantage of the technological advancement in such a way that a person getting

off the office does not get melted with the hot climate. Therefore this paper proposes a system
that allows user to be control home appliances ubiquitously and also provide security on
detection of intrusion via SMS using GSM technology.
The home automation today needs to make use of the latest technological components
available. In this project, we present the design and implementation of a home automation









Communication). This technique is successfully merged in a single wireless home automation

system. This system offers a complete, low cost, powerful and user friendly way of real-time
monitoring and remote control of a house.
It has 2 independent relay switches with normally open and normally closed switch contacts,
these can be programmed to switch on for a pre-determined length of time whenever the
GSM-AUTO is called.
The relay switches can also be temporarily or permanently switched on or off by sending the
GSM-AUTO a command.


Industrial automation is the residential extension of "building automation". It is automation of

the home, housework or household activity. Industrial automation may include centralized
control of lighting, HVAC (heating, ventilation and air conditioning), appliances, and other
systems, to provide improved convenience, comfort, energy efficiency and security. Home
automation for the elderly and disabled can provide increased quality of life for persons who
might otherwise require caregivers or institutional care.
A home automation system integrates electrical devices in a house with each other. The
techniques employed in home automation include those in building automation as well as the
control of domestic activities, such as home entertainment systems, houseplant and yard
watering, pet feeding, changing the ambiance "scenes" for different events (such as dinners or
parties), and the use of domestic robots. Devices may be connected through a computer
network to allow control by a personal computer, and may allow remote access from the
internet. Through the integration of information technologies with the home environment,
systems and appliances are able to communicate in an integrated manner which results in
convenience, energy efficiency, and safety benefits.
Industrial automation can also provide a remote interface to home appliances or the
automation system itself, via telephone line, wireless transmission or the internet, to provide
control and monitoring via a smart phone or web browser.
An example of a remote monitoring in home automation could be when a smoke detector
detects a fire or smoke condition, then all lights in the house will blink to alert any occupants
of the house to the possible fire. If the house is equipped with a home theatre, a home
automation system can shut down all audio and video components to avoid distractions, or
make an audible announcement. The system could also call the home owner on their mobile
phone to alert them, or call the fire department or alarm monitoring company.
With Industrial Automation, the consumer can select and watch cameras live from an Internet
source to their home or business. Security cameras can be controlled, allowing the user to
observe activity around a house or business right from a Monitor or touch panel. Security
systems can include motion sensors that will detect any kind of unauthorized movement and
notify the user through the security system or via cell phone.

Home automation security system is a specialized field dealing with specified requirements
of homes in the usage of easy-to-use technologies for security and comforts of the residents.
Home automation includes all that a building automation provides like the climate controls,
door and window controls and security etc plus additionally controlling multimedia home
theatres, pet feeding, plant watering, blinds and so on. But there exists a difference in that
home automation emphasizes more on comforts through ergonomics and ease of operation.
With the fast development in the field, doorways for wireless home automation system are
being opened in a big way.


The new stream, automation home information system has developed into a vast one and the
current market is flooded with a flurry of home automation system and device manufacturers.
Home consumers like you have a choice to make that suits your pocket and need alike. Here
are some of the types that you may want to consider.


This type is perhaps the first one to hit the market in the early years. Here each device like the
heater or your AC will have an independent control dedicated for it unlike the central control
system. These are very handy and are user friendly.


The main feature of this type of systems is emergency shut-down. Rest of the features
includes hardware and software components developed under SCADA (special software) for
better control automated control that reduce human interaction. With this you can preset or
change the control parameters, for example, the thermostat of several ACs and ON/OFF


These are computerized systems programmed to handle all functions of multiple utilities like
ACs, heaters, home entertainments, doors, windows, refrigerators and cooking systems etc
regardless of whether you are home or out. You can connect to your control system from
office through telephone or internet. The latest information on home automation system can
be had from the suppliers who install it. The best part of this is, with computerized control,
you can afford to forget things and still be safe and timely on controls.

Automation is the process of automatically performing everyday functions around the home
to save you time, energy, money and at the same time offering improved security
Home automation saves your time and effort by controlling you home automatically for
performing routine functions such as watering your grass, or turning off all lights, setting the
thermostat to economy mode, control scheduled appliances operation and arming the security
system when you retire for the night.
The concept of home automation is to connect all of these systems and devices to a
central controller so that they can be controlled from anywhere and react to one another.

A cellular communication links mobile system subscribers into the public system or to
another cellular systems MS subscriber.
Information sent between the MS subscriber and the cellular network uses radio
communication .This removes the necessity for the fixed wiring in a traditional telephone
Due to this, the MS subscriber is able to move around and become fully mobile, perhaps
travelling in a vehicle or on foot.


There are many advantages for the network provider as well as the mobile subscriber.

Network expansion flexibility
Revenue or profit margins
Easier re-configuration

GSM (Global System for Mobile Communications, originally Groupe Spcial Mobile), is a
standard set developed by the European Telecommunications Standards Institute (ETSI) to
describe technologies for second generation (or "2G") digital cellular networks. Developed as
a replacement for first generation analog cellular networks, the GSM standard originally
described a digital, circuit switched network optimized for full duplex voice telephony. The
standard was expanded over time to include first circuit switched data transport, then packet
data transport via GPRS. Packet data transmission speeds were later increased via EDGE.
The GSM standard is succeeded by the third generation (or "3G") UMTS standard developed
by the 3GPP. GSM networks will evolve further as they begin to incorporate fourth
generation (or "4G") LTE Advanced standards. "GSM" is a trademark owned by the GSM

GSM is the legacy network of the evolution to the third generation (3G) technologies
Universal Mobile Telecommunication System (UMTS), also known as WCDMA, and High
Speed Packet Access (HSPA). Commonly referred to as the GSM family of technologies, the
following diagram represents the evolution from second generation (2G) GSM and General
Packet Radio System (GPRS) to 3G Enhanced Data for GSM Evolution (EDGE), UMTS and
GSM has a straightforward, cost-effective migration path to 3G through GPRS, EDGE and
UMTS-HSPA, as well as beyond 3G via the HSPA Evolution (HSPA+), LTE and System
Architecture Evolution (SAE) initiatives. Each step in the GSM-based migration path
leverages the network infrastructure deployed for the previous steps and is backwards
compatible. For example, a UMTS phone can provide voice and data service when connected
to a GSM network. This family of technologies also provides a viable, flexible 3G migration
path for Code Division Multiple Access (CDMA) and Time Division Multiple Access
(TDMA) operators. In fact, the majority of TDMA operators have already migrated to GSM
and many CDMA operators have likewise migrated.



Decoder & Controlling





Incoming Call



Air Conditioner









1. IC 89c51
2. DTMF IC 8870
5. ULN 2803 IC

AT89C51 a low-power, high-performance CMOS 8-bit microcontroller with 4K bytes of insystem programmable Flash memory. The device is manufactured using Atmels
high-density non-volatile memory technology and is compatible with the industry standard
80C51 instruction set and pin out. The on-chip Flash allows the program memory to be
reprogrammed in-system or by a conventional non-volatile memory programmer. By
combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip,
the Atmel AT89C51 is a powerful microcontroller which provides a highly-flexible and costeffective solution to many embedded control applications. The AT89C51 provides the
following standard features: 4K bytes of Flash, 128 bytes of RAM, 32 I/O lines, Watchdog
timer, two data pointers, two 16-bit timer/counters, a five-vector two-level interrupt
architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In
addition, the AT89S51 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 interrupter hardware reset.

Compatible with MCS-51 Products

4K 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
128 x 8-bit Internal RAM
32 Programmable I/O Lines
Two 16-bit Timer/Counters
Six Interrupt Sources
Programmable Serial Channel
Low-power Idle and Power-down Modes

A microcontroller (sometimes abbreviated C, uC or MCU) is a small computer on a single

integrated circuit containing a processor core, memory, and programming input/output
peripherals. Program memory in the form of NOR Flash or or OTP ROM is also often
included on chip, as well as a typically small amount of RAM. Microcontrollers are designed
for embedded applications, in contrast to the microprocessors used in personal computers or
other general purpose applications.
Microcontrollers are used in automatically controlled products and devices, such as
automobile engine control systems, implantable medical devices, remote controls, office
machines, appliances, power tools, toys and other embedded system. By reducing the size
and cost compared to a design that uses a separate microprocessor, memory, and input/output
devices, microcontrollers make it economical to digitally control even more devices and
processes. Mixed signal microcontrollers are common, integrating analog components needed
to control non-digital electronic systems.
Some microcontrollers may use four-bit words and operate at clock rate frequencies as low as
4 kHz, for low power consumption (milliwatts or microwatts). They will generally have the
ability to retain functionality while waiting for an event such as a button press or other

interrupt; power consumption while sleeping (CPU clock and most peripherals off) may be
just nanowatts, making many of them well suited for long lasting battery applications. Other
microcontrollers may serve performance-critical roles, where they may need to act more like
a digital signal processor(DSP), with higher clock speeds and power consumption.

The first single-chip microprocessor was the 4-bit Intel 4004 released in 1971, with the Intel
8008 and other more capable microprocessors becoming available over the next several
years. However, both processors required external chips to implement a working system,
raising total system cost, and making it impossible to economically computerize appliances.
The Smithsonian Institution says TI engineers Gary Boone and Michael Cochran succeeded
in creating the first microcontroller in 1971. The result of their work was the TMS 1000,
which went commercial in 1974. It combined read-only memory, read/write memory,
processor and clock on one chip and was targeted at embedded systems.
Partly in response to the existence of the single-chip TMS 1000, Intel developed a computer
system on a chip optimized for control applications, the Intel 8048, with commercial parts
first shipping in 1977. It combined RAM and ROM on the same chip. This chip would find
its way into over one billion PC keyboards, and other numerous applications. At that time
Intel's President, Luke J. Valenter, stated that the microcontroller was one of the most
successful in the company's history, and expanded the division's budget over 25%.
Most microcontrollers at this time had two variants. One had an erasable EPROM program
memory, which was significantly more expensive than the PROM variant which was only
programmable once. Erasing the EPROM required exposure to ultraviolet light through a
transparent quartz lid. One-time parts could be made in lower-cost opaque plastic packages.
In 1993, the introduction of EEPROM memory allowed microcontrollers (beginning with the
Microchip PIC 16x84 to be electrically erased quickly without an expensive package as
required for EPROM, allowing both rapid prototyping, and In system programming. The
same year, Atmel introduced the first microcontroller using Flash memory. Other companies
rapidly followed suit, with both memory types.

Cost has plummeted over time, with the cheapest 8-bit microcontrollers being available for
under $0.25 in quantity (thousands) in 2009, and some 32-bit microcontrollers around $1 for
similar quantities.
Nowadays microcontrollers are cheap and readily available for hobbyists, with large online
communities around certain processors.
In the future, MRAM could potentially be used in microcontrollers as it has infinite
endurance and its incremental semiconductor wafer process cost is relatively low.

About 55% of all CPUs sold in the world are 8-bit microcontrollers and microprocessors.
According to Semico, over four billion 8-bit microcontrollers were sold in 2006.
A typical home in a developed country is likely to have only four general-purpose
microprocessors but around three dozen microcontrollers. A typical mid-range automobile
has as many as 30 or more microcontrollers. They can also be found in many electrical
devices such as washing machines, microwave ovens, and telephones.

A microcontroller can be considered a self-contained system with a processor, memory and
peripherals and can be used as an embedded system. The majority of microcontrollers in use
today are embedded in other machinery, such as automobiles, telephones, appliances, and
peripherals for computer systems. While some embedded systems are very sophisticated,
many have minimal requirements for memory and program length, with no operating system,
and low software complexity. Typical input and output devices include switches, relays,
solenoids, LEDs, small or custom LCD displays, radio frequency devices, and sensors for
data such as temperature, humidity, light level etc. Embedded systems usually have no
keyboard, screen, disks, printers, or other recognizable I/O devices of a personal computer,
and may lack human interaction devices of any kind.


Microcontrollers must provide real time (predictable, though not necessarily fast) response to
events in the embedded system they are controlling. When certain events occur, an interrupt
system can signal the processor to suspend processing the current instruction sequence and to
begin an interrupt service routine (ISR, or "interrupt handler"). The ISR will perform any
processing required based on the source of the interrupt before returning to the original
instruction sequence. Possible interrupt sources are device dependent, and often include
events such as an internal timer overflow, completing an analog to digital conversion, a logic
level change on an input such as from a button being pressed, and data received on a
communication link. Where power consumption is important as in battery operated devices,
interrupts may also wake a microcontroller from a low power sleep state where the processor
is halted until required to do something by a peripheral event.

Typically microcontroller programs must fit in the available on-chip program memory, since
it would be costly to provide a system with external, expandable, memory. Compilers and
assemblers are used to convert high-level language and assembler language codes into a
compact machine code for storage in the microcontroller's memory. Depending on the device,
the program memory may be permanent, read-only memory that can only be programmed at
the factory, or program memory may be field-alterable flash or erasable read-only memory.
Manufacturers have often produced special versions of their microcontrollers in order to help
the hardware and software developments of the target system. Originally these included
EPROM versions that have a "window" on the top of the device through which program
memory can be erased by ultraviolet light, ready for reprogramming after a programming
("burn") and test cycle. Since 1998, EPROM versions are rare and have been replaced by
EEPROM and flash, which are easier to use (can be erased electronically) and cheaper to
Other versions may be available where the ROM is accessed as an external device rather
than as internal memory, however these are becoming increasingly rare due to the widespread
availability of cheap microcontroller programmers.
The use of field-programmable devices on a microcontroller may allow field update of the
firmware or permit late factory revisions to products that have been assembled but not yet

shipped. Programmable memory also reduces the lead time required for deployment of a new
Where hundreds of thousands of identical devices are required, using parts programmed at
the time of manufacture can be an economical option. These mask programmed parts have
the program laid down in the same way as the logic of the chip, at the same time.
A customizable microcontroller incorporates a block of digital logic that can be personalized
in order to provide additional processing capability, peripherals and interfaces that are
adapted to the requirements of the application. For example, the AT91CAP from Atmel has a
block of logic that can be customized during manufacturer according to user requirements.

Other microcontroller features

Microcontrollers usually contain from several to dozens of general purpose input/output pins
(GPIO). GPIO pins are software configurable to either an input or an output state. When
GPIO pins are configured to an input state, they are often used to read sensors or external
signals. Configured to the output state, GPIO pins can drive external devices such as LEDs or
Many embedded systems need to read sensors that produce analog signals. This is the
purpose of the analog to digital convertor (ADC). Since processors are built to interpret and
process digital data, i.e. 1s and 0s, they are not able to do anything with the analog signals
that may be sent to it by a device. So the analog to digital converter is used to convert the
incoming data into a form that the processor can recognize. A less common feature on some
microcontrollers is a digital to analog convertor (DAC) that allows the processor to output
analog signals or voltage levels.
In addition to the converters, many embedded microprocessors include a variety of timers as
well. One of the most common types of timers is the Programmable Interval Timer(PIT). A
PIT may either count down from some value to zero, or up to the capacity of the count
register, overflowing to zero. Once it reaches zero, it sends an interrupt to the processor
indicating that it has finished counting. This is useful for devices such as thermostats, which
periodically test the temperature around them to see if they need to turn the air conditioner
on, the heater on, etc.

A dedicated Pulse Width Modulation(PWM) block makes it possible for the CPU to control
power convertors, resistive loads, motors, etc., without using lots of CPU resources in tight
timer loops. Universal Asynchronous Receiver/Transmitter (UART) block makes it possible
to receive and transmit data over a serial line with very little load on the CPU. Dedicated onchip hardware also often includes capabilities to communicate with other devices (chips) in
digital formats such as IC and Serial Peripheral Interfaces(SPI).

Higher Integration
Micro-controllers may not implement an external address or data bus as they integrate RAM
and non-volatile memory on the same chip as the CPU. Using fewer pins, the chip can be
placed in a much smaller, cheaper package.
Integrating the memory and other peripherals on a single chip and testing them as a unit
increases the cost of that chip, but often results in decreased net cost of the embedded system
as a whole. Even if the cost of a CPU that has integrated peripherals is slightly more than the
cost of a CPU and external peripherals, having fewer chips typically allows a smaller and
cheaper circuit board, and reduces the labor required to assemble and test the circuit board.
A micro-controller is a single integrated system, commonly with the following features:

Central processing unit- ranging from small and simple 4-bit processors to complex
32- or 64-bit processors

volatile memory (RAM) for data storage

ROM, EPROM, EEPROM or Flash memory for program and operating parameter

discrete input and output bits, allowing control or detection of the logic state of an
individual package pin

serial input/output such as serial ports (UARTs)

other serial

communications interfaces like

IC, Serial

Interface and Controller Area Network for system interconnect


peripherals such as timers, event counters, PWM generators, and watchdog

clock generator - often an oscillator for a quartz timing crystal, resonator or RC circuit

many include analog-to-digital converters, some include digital-to-analog converters

in-circuit programming and debugging support

This integration drastically reduces the number of chips and the amount of wiring and circuit
board space that would be needed to produce equivalent systems using separate chips.
Furthermore, on low pin count devices in particular, each pin may interface to several internal
peripherals, with the pin function selected by software. This allows a part to be used in a
wider variety of applications than if pins had dedicated functions. Micro-controllers have
proved to be highly popular in embedded systems since their introduction in the 1970s.
Some microcontrollers use a Harvard architecture: separate memory buses for instructions
and data, allowing accesses to take place concurrently. Where a Harvard architecture is used,
instruction words for the processor may be a different bit size than the length of internal
memory and registers; for example: 12-bit instructions used with 8-bit data registers.
The decision of which peripheral to integrate is often difficult. The microcontroller vendors
often trade operating frequencies and system design flexibility against time-to-market
requirements from their customers and overall lower system cost. Manufacturers have to
balance the need to minimize the chip size against additional functionality.
Microcontroller architectures vary widely. Some designs include general-purpose
microprocessor cores, with one or more ROM, RAM, or I/O functions integrated onto the
package. Other designs are purpose built for control applications. A micro-controller
instruction set usually has many instructions intended for bit-wise operations to make control
programs more compact. For example, a general purpose processor might require several
instructions to test a bit in a register and branch if the bit is set, where a micro-controller
could have a single instruction to provide that commonly-required function.
Microcontrollers typically do not have a math coprocessor, so floating point arithmetic is
performed by software.


Microcontrollers were originally programmed only in assembly language, but various highlevel programming languages are now also in common use to target microcontrollers. These
languages are either designed especially for the purpose, or versions of general purpose
languages such as the language. Compilers for general purpose languages will typically have
some restrictions as well as enhancements to better support the unique characteristics of
microcontrollers. Some microcontrollers have environments to aid developing certain types
of applications. Microcontroller vendors often make tools freely available to make it easier to
adopt their hardware.
Many microcontrollers are so quirky that they effectively require their own non-standard
dialects of C, such as SDCC for the 8051, which prevent using standard tools (such as code
libraries or static analysis tools) even for code unrelated to hardware features. Interpreters are
often used to hide such low level quirks.
Interpreter firmware is also available for some microcontrollers. For example, BASIC on the
early microcontrollers Intel 8052; BASIC and FORTH on the Zilog Z8 as well as some
modern devices. Typically these interpreters support interactive programming.
Simulators are available for some microcontrollers. These allow a developer to analyze what
the behavior of the microcontroller and their program should be if they were using the actual
part. A simulator will show the internal processor state and also that of the outputs, as well as
allowing input signals to be generated. While on the one hand most simulators will be limited
from being unable to simulate much other hardware in a system, they can exercise conditions
that may otherwise be hard to reproduce at will in the physical implementation, and can be
the quickest way to debug and analyze problems.
Recent microcontrollers are often integrated with on-chip debug circuitry that when accessed
by an in-circuit emulator via JTAG, allow debugging of the firmware with a debugger.

As of 2008 there are several dozen microcontroller architectures and vendors including:

ARM core processors (from many vendors)

Atmel AVR (8-bit), AVR32 (32-bit), and AT91SAM (32-bit)

Cypress Semiconductor's M8C Core used in their PSoC (Programmable System-onChip)

Freescale ColdFire (32-bit) and S08 (8-bit)

Freescale 68HC11 (8-bit)

Intel 8051

Many others exist, some of which are used in very narrow range of applications or are more
like applications processors than microcontrollers. The microcontroller market is extremely
fragmented, with numerous vendors, technologies, and markets. Note that many vendors sell
or have sold multiple architectures.


Pin Description

Supply voltage.
Port 0
Port 0 is an 8-bit open drain bidirectional I/O port. As an output port each pin can sink eight
TTL inputs. When 1s are written to port 0 pins, the pins can be used as high-impedance
inputs. Port 0 may also be configured to be the multiplexed low order address/data bus during
accesses to external program and data memory. In this mode P0 has internal pull ups. Port 0
also receives the code bytes during Flash programming, and outputs the code bytes during
program verification. External pull ups are required during program verification.

Port 1
Port 1 is an 8-bit bidirectional I/O port with internal pull ups. The Port 1 output buffers can
sink/source four TTL inputs. When 1s are written to Port 1 pins they are pulled high by the
internal pull ups and can be used as inputs. As inputs, Port 1 pins that are externally being
pulled low will source
Current (IIL) because of the internal pull ups. Port 1 also receives the low-order address bytes
during Flash programming and program verification.
Port 2
Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2 output buffers can
sink/source four TTL inputs. When 1s are written to Port 2 pins they are pulled high by the
internal pullups and can be used as inputs. As inputs, Port 2 pins that are externally being
pulled low will source current (IIL) because of the internal pullups. Port 2 emits the high-

order address byte during fetches from external program memory and during accesses to
external data memory that uses 16-bit addresses (MOVX @ DPTR). In this application it uses
strong internal pull-ups when emitting 1s. During accesses to external data memory that uses
8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register.
Port 2 also receives the high-order address bits and some control signals during Flash
programming and verification.

Port 3
Port 3 is an 8-bit bidirectional I/O port with internal 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 (IIL) because of the pullups. Port 3 also serves the functions of
various special features of the AT89C51 as listed below:

Port 3 also receives some control signals for Flash programming and Programming

Reset input. A high on this pin for two machine cycles while the oscillator is running resets
the device.
Address Latch Enable output pulse for latching the low byte of the address during accesses
to external memory.
This pin is also the program pulse input (PROG) during Flash programming.
In normal operation ALE is emitted at a constant rate of 1/6 the oscillator frequency, and may
be used for external timing or clocking purposes. Note, however, that one ALE pulse is
skipped during each access to external Data
Memory. If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH.
With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the
pin is weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is
in external execution mode.

Program Store Enable is the read strobe to external program memory. When the AT89C51 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.
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 receive the 12-volt
programming enable voltage (VPP) during flash programming, for parts that require 12-volt

Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
Output from the inverting oscillator amplifier.

2. DTMF ( IC 8870)
Most telephone equipment use a DTMF receiver IC. One common DTMF receiver IC is the
Motorola MT8870 that is widely used in electronic communications circuits. The MT8870 is
an 18-pin IC. It is used in telephones and a variety of other applications. When a proper
output is not obtained in projects using this IC, engineers or technicians need to test this IC
separately. A quick testing of this IC could save a lot of time in research labs and
manufacturing industries of communication instruments. Heres a small and handy tester
circuit for the DTMF IC. It can be assembled on a multipurpose PCB with an 18-pin IC base.
One can also test the IC on a simple breadboard. For optimum working of telephone
equipment, the DTMF receiver must be designed to recognise a valid tone pair greater than
40 ms in duration and to accept successive digit tone-pairs that are greater than 40 ms apart.
However, for other applications like remote controls and radio communications, the tone
duration may differ due to noise considerations. Therefore, by adding an extra resistor and
steering diode the tone duration can be set to different values. The circuit is configured in
balanced line mode. To reject common-mode noise signals, a balanced differential amplifier
input is used. The circuit also provides an excellent bridging interface across a properly
terminated telephone line. Transient protection may be achieved by splitting the input
resistors and inserting zener diodes (ZD1 and ZD2) to achieve voltage clamping. This allows
the transient energy to be dissipated in the resistors and diodes, and limits the maximum
voltage that may appear at the inputs. Whenever you press any key on your local telephone
keypad, the delayed steering output of the IC goes high on receiving the tone-pair, causing
LED to glow. It will be high for duration depending on the values of capacitor and resistors
Dual-tone multi-frequency (DTMF) signalling is used for telecommunication signalling
over analog telephone lines in the voice-frequency band between telephone handsets
and other communications devices and the switching centre. The version of DTMF used

for telephone tone dialling is known by the trademarked term Touch-Tone (cancelled
March 13, 1984), and is standardized by ITU-T Recommendation. It is also known in
the UK as MF4. Other multi-frequency systems are used for signalling internal to the
telephone network. As a method of in-band signalling, DTMF tones were also used by
cable television broadcasters to indicate the start and stop times



commercial insertion points during station breaks for the benefit of cable companies. Until

out-of-band signalling

equipment was

developed in the 1990s, fast,

unacknowledged, and loud DTMF tone sequences could be heard

during the

commercial breaks of cable channels in the United States and elsewhere.


A relay is an electrically operated switch. Current flowing through the coil of the relay creates
a magnetic field which attracts a lever and changes the switch contacts. The coil current can
be on or off so relays have two switch positions and most have double throw (changeover)
switch contacts as shown in the diagram.
Relays allow one circuit to switch a second circuit which can be completely separate from the
first. For example a low voltage battery circuit can use a relay to switch a 230v ac mains
circuit. There is no electrical connection inside the relay between the two circuits, the link is
magnetic and mechanical.

The coil of a relay passes a relatively large current, typically 30ma for a 12v relay, but it can
be as much as 100ma for relays designed to operate from lower voltages. Most ics (chips)
cannot provide this current and a transistor is usually used to amplify the small ic current to
the larger value required for the relay coil. The maximum output current for the popular 555
timer ic is 200ma so these devices can supply relay coils directly without amplification.
Relays are usually spdt or dpdt but they can have many more sets of switch contacts, for
example relays with 4 sets of changeover contacts are readily available. For further
information about switch contacts and the terms used to describe them please see the page on
Most relays are designed for pcb mounting but you can solder wires directly to the pins
providing you take care to avoid melting the plastic case of the relay.
The supplier's catalogue should show you the relay's connections. The coil will be obvious
and it may be connected either way round. Relay coils produce brief high voltage 'spikes'
when they are switched off and this can destroy transistors and ics in the circuit. To prevent
damage you must connect a protection diode across the relay coil.
The animated picture shows a working relay with its coil and switch contacts. You can see a
lever on the left being attracted by magnetism when the coil is switched on. This lever moves
the switch contacts. There is one set of contacts (spdt) in the foreground and another behind
them, making the relay dpdt.

The relay's switch connections are usually labelled COM, NC and NO:

COM = Common, always connect to this, it is the moving part of the switch.

NC = Normally Closed, COM is connected to this when the relay coil is off.

NO = Normally Open, COM is connected to this when the relay coil is on.

A relay is an electrically operated switch. Many relays use an electromagnet to operate a

switching mechanism mechanically, but other operating principles are also used. Relays are

used where it is necessary to control a circuit by a low-power signal (with complete electrical
isolation between control and controlled circuits), or where several circuits must be
controlled by one signal. The first relays were used in long distance telegraph circuits,
repeating the signal coming in from one circuit and re-transmitting it to another. Relays were
used extensively in telephone exchanges and early computers to perform logical operations.
A type of relay that can handle the high power required to directly control an electric motor
or other loads is called a contactor. Solid-state relays control power circuits with no moving
parts, instead using a semiconductor device to perform switching. Relays with calibrated
operating characteristics and sometimes multiple operating coils are used to protect electrical
circuits from overload or faults; in modern electric power systems these functions are
performed by digital instruments still called "protective relays".


Simple electromechanical relay.

Small "cradle" relay often used in electronics. The "cradle" term refers to the shape of the
relay's armature.
A simple electromagnetic relay consists of a coil of wire wrapped around a soft iron core, an
iron yoke which provides a low reluctance path for magnetic flux, a movable iron armature,
and one or more sets of contacts (there are two in the relay pictured). The armature is hinged
to the yoke and mechanically linked to one or more sets of moving contacts. It is held in
place by a spring so that when the relay is de-energized there is an air gap in the magnetic
circuit. In this condition, one of the two sets of contacts in the relay pictured is closed, and
the other set is open. Other relays may have more or fewer sets of contacts depending on their
function. The relay in the picture also has a wire connecting the armature to the yoke. This
ensures continuity of the circuit between the moving contacts on the armature, and the circuit
track on the printed circuit board (PCB) via the yoke, which is soldered to the PCB.
When an electric current is passed through the coil it generates a magnetic field that activates
the armature, and the consequent movement of the movable contact(s) either makes or breaks
(depending upon construction) a connection with a fixed contact. If the set of contacts was
closed when the relay was de-energized, then the movement opens the contacts and breaks
the connection, and vice versa if the contacts were open. When the current to the coil is
switched off, the armature is returned by a force, approximately half as strong as the magnetic
force, to its relaxed position. Usually this force is provided by a spring, but gravity is also
used commonly in industrial motor starters. Most relays are manufactured to operate quickly.
In a low-voltage application this reduces noise; in a high voltage or current application it
reduces arcing.
When the coil is energized with direct current, a diode is often placed across the coil to
dissipate the energy from the collapsing magnetic field at deactivation, which would

otherwise generate a voltage spike dangerous to semiconductor circuit components. Some

automotive relays include a diode inside the relay case. Alternatively, a contact protection
network consisting of a capacitor and resistor in series (snubber circuit) may absorb the
surge. If the coil is designed to be energized with alternating current (AC), a small copper
"shading ring" can be crimped to the end of the solenoid, creating a small out-of-phase
current which increases the minimum pull on the armature during the AC cycle.[1]
A solid-state relay uses a thyristor or other solid-state switching device, activated by the
control signal, to switch the controlled load, instead of a solenoid. An optocoupler (a lightemitting diode (LED) coupled with a photo transistor) can be used to isolate control and
controlled circuits.

Since relays are switches, the terminology applied to switches is also applied to relays. A
relay will switch one or morepoles, each of whose contacts can be thrown by energizing the
coil in one of three ways:

Normally-open (NO) contacts connect the circuit when the relay is activated; the
circuit is disconnected when the relay is inactive. It is also called a Form A contact or
"make" contact. NO contacts can also be distinguished as "early-make" or NOEM, which
means that the contacts will close before the button or switch is fully engaged.

Normally-closed (NC) contacts disconnect the circuit when the relay is activated; the
circuit is connected when the relay is inactive. It is also called a Form B contact or
"break" contact. NC contacts can also be distinguished as "late-break" or NCLB, which
means that the contacts will stay closed until the button or switch is fully disengaged.

Change-over (CO), or double-throw (DT), contacts control two circuits: one

normally-open contact and one normally-closed contact with a common terminal. It is
also called a Form C contact or "transfer" contact ("break before make"). If this type of
contact utilizes a "make before break" functionality, then it is called a Form D contact.

The following designations are commonly encountered:

SPST Single Pole Single Throw. These have two terminals which can be connected
or disconnected. Including two for the coil, such a relay has four terminals in total. It is
ambiguous whether the pole is normally open or normally closed. The terminology
"SPNO" and "SPNC" is sometimes used to resolve the ambiguity.

SPDT Single Pole Double Throw. A common terminal connects to either of two
others. Including two for the coil, such a relay has five terminals in total.

DPST Double Pole Single Throw. These have two pairs of terminals. Equivalent to
two SPST switches or relays actuated by a single coil. Including two for the coil, such a
relay has six terminals in total. The poles may be Form A or Form B (or one of each).

DPDT Double Pole Double Throw. These have two rows of change-over terminals.
Equivalent to two SPDT switches or relays actuated by a single coil. Such a relay has
eight terminals, including the coil.

The "S" or "D" may be replaced with a number, indicating multiple switches connected to a
single actuator. For example 4PDT indicates a four pole double throw relay (with 14
EN 50005 are among applicable standards for relay terminal numbering; a typical EN 50005compliant SPDT relay's terminals would be numbered 11, 12, 14, A1 and A2 for the C, NC,
NO, and coil connections, respectively.

A crystal oscillator is an electronic oscillator circuit that uses the mechanical
resonance of a vibrating crystal of piezoelectric material to create an electrical signal
with a very precise frequency. This frequency is commonly used to keep track of time
(as in quartz wristwatches), to provide a stable clock signal for digital integrated
circuits, and to stabilize frequencies for radio transmitters and receivers. The most
common type of piezoelectric resonator used is the quartz crystal, so oscillator circuits
designed around them became known as "crystal oscillators."

An electronic oscillator is an electronic circuit that produces a repetitive electronic signal,

often a sine wave or a square wave. They are widely used in many electronic devices.
Common examples of signals generated by oscillators include signals broadcast
by radio and television transmitters, clock signals that regulate computers and quartz clocks,
and the sounds produced by electronic beepers and video games.[1]
Oscillators are often characterized by the frequency of their output signal: an audio
oscillator produces frequencies in the audio range, about 16 Hz to 20 kHz. An RF oscillator
produces signals in the radio frequency (RF) range of about 100 kHz to 100 GHz. A lowfrequency oscillator (LFO) is an electronic oscillator that generates a frequency below
20 Hz. This term is typically used in the field of audio synthesizers, to distinguish it from an
audio frequency oscillator.
Oscillators designed to produce a high-power AC output from a DC supply are usually
called inverters.
There are two main types of electronic oscillator: the linear or harmonic oscillator and the
nonlinear or relaxation oscillator.

The basic form of a linear oscillator is an electronic amplifier connected in a feedback

loop with its output fed back into its input through a frequency selective electronic filter to
provide positive feedback. When the power supply to the amplifier is first switched on, the
amplifier's output consists only of noise. The noise travels around the loop and is filtered and
re-amplified until it increasingly resembles a sine wave at a single frequency.
Linear oscillator circuits can be classified according to the type of frequency selective filter
they use in the feedback loop:

In an RC oscillator circuit, the filter is a network of resistors and capacitors. RC

oscillators are mostly used to generate lower frequencies, for example in the audio range.
Common types of RC oscillator circuits are the phase shift oscillator and the Wien bridge

In an LC oscillator circuit, the filter is a tuned circuit (often called a tank circuit)
consisting of an inductor (L) and capacitor (C) connected together. Charge flows back
and forth between the capacitor's plates through the inductor, so the tuned circuit can
store electrical energy oscillating at its resonant frequency. There are small losses in the
tank circuit, but the amplifier compensates for those losses and supplies the power for the
output signal. LC oscillators are often used at radio frequencies, when a tunable
frequency source is necessary, such as in signal generators, tunable radio transmitters and
the local oscillators in radio receivers. Typical LC oscillator circuits are
the Hartley, Colpitts and Clapp circuits.

In a crystal oscillator circuit the filter is a piezoelectric crystal (commonly a quartz

crystal). The crystal mechanically vibrates as a resonator, and its frequency of vibration
determines the oscillation frequency. Crystals have very high Q-factor and also better
temperature stability than tuned circuits, so crystal oscillators have much better frequency
stability than LC or RC oscillators. They are used to stabilize the frequency of most radio
transmitters, and to generate the clock signal in computers and quartz clocks. Crystal
oscillators often use the same circuits as LC oscillators, with the crystal replacing
the tuned circuit; the Pierce oscillator circuit is commonly used. Quartz crystals are
generally limited to frequencies of 30 MHz or below. Surface acoustic wave (SAW)
devices are another kind of piezoelectric resonator used in crystal oscillators, which can
achieve much higher frequencies. They are used in specialized applications which require
a high frequency reference, for example, in cellular telephones.

In addition to the feedback oscillators described above, which use two-port amplifying active
elements such as transistors and op amps, linear oscillators can also be built using one-port
devices with negative resistance, such as magnetron tubes, tunnel diodes and Gunn diodes. In
these oscillators, a resonator, such as an LC circuit, crystal, or cavity resonator, is connected
across the negative resistance device, and a DC bias voltage is applied to supply energy. The
negative resistance of the active device can be thought of as cancelling the (positive) effective
loss resistance of the resonator and permitting a sustained oscillation. These circuits are
frequently used for oscillators at microwave frequencies.

A nonlinear or relaxation oscillator produces a non-sinusoidal output, such as

a square, sawtooth or triangle wave. It contains an energy-storing element (a capacitor or,
more rarely, an inductor) and a nonlinear switching circuit (a latch, Schmitt trigger, or
negative resistance element) that periodically charges and discharges the energy stored in the
storage element thus causing abrupt changes in the output waveform.
Square-wave relaxation oscillators are used to provide the clock signal for sequential
logic circuits such as timers and counters, although crystal oscillators are often preferred for
their greater stability. Triangle wave or sawtooth oscillators are used in the timebase circuits
that generate the horizontal deflection signals for cathode ray tubes in
analogue oscilloscopes and television sets. In function generators, this triangle wave may
then be further shaped into a close approximation of a sine wave.
Ring oscillators are built of a ring of active delay stages. Generally the ring has an odd
number of inverting stages, so that there is no single stable state for the internal ring voltages.
Instead, a single transition propagates endlessly around the ring.

ULN 2803 IC
The eight NPN Darlington connected transistors in this family of arrays are ideally suited for
interfacing between low logic level digital circuit (such as TTL, CMOS or PMOS/NMOS)
and the higher current/voltage requirements of lamps, relays, printer hammers or other similar
loads for a broad range of computer, industrial, and consumer applications. All devices
feature open-collector outputs and freewheeling clamp diodes for transient suppression.
The ULN2803 is designed to be compatible with standard TTL families while the ULN2804
is optimized for 6 to 15 volt high level CMOS or PMOS.



Relay Circuit

Relay Circuit



sbit relay1=P2^0;
sbit relay2=P2^1;
sbit relay3=P2^3;
void main()
int i=0;
char arr[16];

else if(P3==0xf2)
else if(P3==0xf3)
else if(P3==0xf4)
else if(P3==0xf5)

else if(P3==0xf6)
else if(P3==0xf7)
else if(P3==0xf8)
else if(P3==0xf9)

else if(P3==0xfa)
else if(strcmp(arr,"321")==0)
else if(strcmp(arr,"456")==0)
else if(strcmp(arr,"654")==0)
else if(strcmp(arr,"789")==0)
else if(strcmp(arr,"987")==0)

else if(strcmp(arr,"0")==0)



We can use of more and more devices of our home peripherals through the home
automation system. Here we have shown only four bulbs as home devices but we can use
any type of home appliances to the circuit to avail the facility.

For examples: Television, Fridge, Cooler, Air-conditioner, Fan, Heater etc.

There are two types of technologies to control home appliances, one is using GSM
Technology and second is INTERNET service. Through internet we can control the
By using sensors and cameras, the security of home may be increased to high level.
Special commands and equipment are used to make security.
By adding voice recognition circuit the locking system (password based) accession of home
may be create so that unauthorized persons cant use the home and its devices without

Home Automation has been taken into a new dimension. We have clearly demonstrated that
Mobile Home Automation is the birth of a brand new era open to endless possibilities.
Mobile Home Automation can be applied for your convenience. For example, living in a city
such as Delhi where the temperature can greatly vary between the morning and the evening,
Mobile Home Automation can be very beneficial. Say you leave to work in the morning on a

hot summery day and during the day you start to realize that the temperature aiming to go
below freezing, you can then remotely turn on the heating at your home.
We have shown how Mobile Home Automation can be performed using a main medium of
communication in this information age, the mobile phone. The basic level of home appliance
control and remote monitoring has been implemented. our project allows for greater
development of products. The code is open source and we are providing for development by
others for application in several ways. With our software, we could develop it for more
complicated applications.


Programming and Customizing the 8051 Microcontroller by TATA McGRAW

The 8051 Microcontroller and Embedded Systems by Muhammad Ali Mazidi,
Janice Gillispie Mazidi.