Learning Center
Plans & pricing Sign in
Sign Out
Your Federal Quarterly Tax Payments are due April 15th Get Help Now >>



									                     DTMF BASED HOME AUTOMATION SYSTEM


CHAPTER                                                  Page No.

In this design, we present a Home Automation System using telephone lines. The system consists
of two subsystems. One is the Remote Control system. The other one is the Phone Monitoring
system. The Remote Control system used the Dual Tone Multi-frequency signals to control the
operations of various appliances. The hardware and software are designed based on the standard
telephone system. The Phone Monitoring system provides convenient services for the user to
better monitoring the usage of their phones. Experimental results show that the two subsystems
provide better home services and living quality for modern lives.


         Most often, the users would like to have remote control on some preliminary operations
of their home appliances before they go back to home. These operations may be the turn on or
off the air conditioner, the cooker, the light, the video, or the security system, or even some
things that he or she forgot to do before leaving, etc. It will be comfortable and convenient for
people to live in such a modern house with the above functions. Besides, phone is an important
bridge of two parties. Sometimes it is important to keep the information of conversations to
protect the family. In this case, it is useful to have extra functions to monitor the usage of
phones. These functions include automatic warning and recording.
         The above needs bring up the idea of Home Automation in modern lives. That includes
two major parts. One is the RC (Remote Control) system. The other is the PM (Phone
Monitoring) system. Both applications introduced, were designed based on the standard
telephone system. This means that the above systems can be installed for public use widely. Both
systems were designed based on the DTMF (Dual Tone Multi-frequency) signals that are
produced by the telephone system. The DTMF signals were sent from the user end to the
destination end. The RC system detects the number of phone ring and a set of defined codes to
determine if a remote control signal has been sent out to control the operation of target appliance.
If the control signal is confirmed by the system, the system will send out a control signal to
initiate the operation of the appliance.
         The PM system will send out a warning signal and automatically record the content of the
Conversation if it detects an in or out call of the phone. In this design, we will discuss the design
of the Home Automation system using a standard DTMF phone system.
         The code is written in assembly language in AT89c2051 microcontroller and is compiled
through the compiler Kiel software.

       The supply taken for the kit is 9v battery. This 9v is given to voltage regulator to regulate
9v to 5v. This is done because the supply required for the microcontroller is only 5v. The design
mainly consists of two sections. They are transmitter and receiver section. The two phones act as
transmitter and receiver itself. But the receiver section consists of processing section also, i.e.,
the processing switching on a particular device as per the instruction given.

         The DTMF in both the phones is the heart of the circuit. Each key has some built in
frequency on which they operate. Here in this design only ON/OFF of two appliances are shown.
Every phone has both encoder and decoder. The encoder in the transmitter section sends the data
to the decoder in the receiving phone. This data is given to the opto isolator. Every opto isolator
works on a specified frequency. Optic isolation unit shown in Figure 5 has been designed to
detect number of rings. When the input of the circuit is exited by high amplitude sinusoidal ring
signal, 0-5 V square wave signal appears at the output port. The output port of the optic isolation
circuit is connected to RA0 pin of the PIC based microcontroller. 16 pulses appear at the output
for every ring. PIC based controller counts the pulses to determine the number of rings. When
the number of rings specified is reached, the controller opens the telephone line. For example,
controller counts 128 pulses for 8 rings. 4N25 opto-coupler integrated circuit provides the optic
isolation between the controller circuit and telephone line. When the frequency is matched the
isolator sends the data to the microcontroller. The microcontroller reads the data first and
according to the command given to it, it will give the required output. This output is passed
through the hex inverter IC. This will make ON the required appliance.

       The whole working depends on the key pressed as well as the command given to the
micro controller. In this way the DTMF based home automation works. Here totally we can
operate 12 appliances.

Crystal Oscillators

One of the most important features of an oscillator is its Frequency Stability, or in other words its
ability to provide a constant frequency output under varying conditions. Some of the factors that
affect the frequency stability of an oscillator include: temperature, variations in the load and
changes in the power supply. Frequency stability of the output signal can be improved by the
proper selection of the components used for the resonant feedback circuit including the amplifier
but there is a limit to the stability that can be obtained from normal LC and RC tank circuits. For
very high stability a quartz crystal is generally used as the frequency determining device to
produce other types of oscillator circuit known generally as Crystal Oscillators.

When a voltage source is applied to a small thin piece of crystal quartz, it begins to change shape
producing a characteristic known as the Piezo-electric Effect. This piezo-electric effect is the
property of a crystal by which an electrical charge produces a mechanical force by changing the
shape of the crystal and vice versa, a mechanical force applied to the crystal produces an
electrical charge. Then, piezo-electric devices can be classed as transducers as they convert
energy of one kind into energy of another. This piezo-electric effect produces mechanical
vibrations or oscillations which are used to replace the LC tank circuit and can be seen in many
different types of crystal substances with the most important of these for electronic circuits being
the quartz minerals because of their greater mechanical strength.

The quartz crystal used in Crystal Oscillators is a very small, thin piece or wafer of cut quartz
with the two parallel surfaces metalized to make the electrical connections. The physical size and
thickness of a piece of quartz crystal is tightly controlled since it affects the final frequency of
oscillations and is called the crystals "characteristic frequency". Then once cut and shaped the
crystal can not be used at any other frequency. The crystals characteristic or resonant frequency
is inversely proportional to its physical thickness between the two metalized surfaces. A
mechanically vibrating crystal can be represented by an equivalent electrical circuit consisting of
low Resistance, large Inductance and small Capacitance as shown below.
Quartz Crystal

A quartz crystal has a resonant frequency similar to that of a electrically tuned tank circuit but
with a much higher Q factor due to its low resistance, with typical frequencies ranging from
4kHz to 10MHz. The cut of the crystal also determines how it will behave as some crystals will
vibrate at more than one frequency. Also, if the crystal is not of a parallel or uniform thickness it
have two or more resonant frequencies having both a fundamental frequency and harmonics such
as second or third harmonics. However, usually the fundamental frequency is more stronger or
pronounced than the others and this is the one used. The equivalent circuit above has three
reactive components and there are two resonant frequencies, the lowest is a series type frequency
and the highest a parallel type resonant frequency.

We have seen in the previous tutorials, that an amplifier circuit will oscillate if it has a loop gain
greater or equal to 1 and it has positive feedback. In a Crystal Oscillator circuit the oscillator
will oscillate at the crystals fundamental series resonant frequency as the crystal always wants to
oscillate when a voltage source is applied to it. However, it is also possible to "tune" a crystal
oscillator to any even harmonic of the fundamental frequency, (2nd, 4th, 8th etc.) and these are
known generally as Harmonic Oscillators while Overtone Oscillators vibrate at odd multiples
of the fundamental frequency, 3rd, 5th, 11th etc). Generally, crystal oscillators that operate at
overtone frequencies do so using their series resonant frequency.


Approvals in their outer aspect, SCR and TRIAC are resembled like many water drops. To
distinguish them, therefore, is impossible, if it is not rerun to the exact acknowledgment of the
acronym and to the ritrovamento of this on a common prontuario. But the acronyms, today
attributed to these semiconductors, are many, too many for being collections all in a handbook
modernized to the capacity of the amateurs. Which, often, during their activity, are found in
embarrassment, because, ignoring the characteristic electrical workers, they cannot lead those
tests that serve to identify the components and to know their state of efficiency. Here because the
idea is risen us to conceive a simple circuit, of immediate realization, absolutely economic, to
entrust our hobbyist readers, with which they can distinguish, with a sure rapidity, a SCR from a
TRIAC, estimating some, at the same time, the behavior electrical worker, is worth to say the
validity works them. But since the principle of operation of the device is based on the use, from
part of the SCR, of average cycle of the alternated voltage, while the TRIAC works with the
entire cycle of the same voltage, alla presentation of the apparatus must make to precede those
theoretical slight knowledge that regulates the way to behave itself of these particular diode , that
by now all know and whose employment is often from we prescribed for the construction of the
many plans that, month for month, come publishes to you on this periodical.


Known also under the name of controlled diode, the SCR inner is composed from three P-N
splices, that they form a semiconductor of P-N-P-N type, similar to two normal diode connects
to you in series. They finishes relative to the anode makes head more external the P
semiconductor, while the cathode remains connected with the N semiconductor situated in the
opposite part. A1 according to field of P material is connected the representative electrode of the
gate ones, said also "door". The symbol electrical worker, that it characterizes diode SCR, is that
one represented in figure 1, while the outer aspect more common than this semiconductor it can
be identified with one of the graphical expressions brought back in figure 2.

Fig. 1 - Symbol electrical worker of diode SCR, famous also with the denomination of controlled
diode. With the G letter it comes indicated the electrode of gate, or door, through which it comes
applied to the component the voltage impulse that of it provokes the conduction (primes). With
the letter To the electrode of anode is marked and with the K that one of cathode.

Fig. 2 - These are the two types of diode SCR (silicon-controlled-rectifier) more commonly
findable in commerce and mainly it uses you from the amateurs.

Operation of the SCR

Applying to the anode of the SCR a negative voltage regarding the cathode, some conduction is
not obtained electrical worker, therefore as it happens in a common semiconductor diode . The
SCR can therefore be assimilated to an open switch. Inverting the polarity of the voltage, the
SCR contrarily remains still blocked to how much happens in a normal diode , in which
conduction would be had electrical worker; but the block remains until does not arrive on gate a
positive impulse regarding the cathode, of such amplitude to put the diode controlled in
complete conduction. And this commutation happens in a extremely short time, of the order of
0,5 us. As it can immediately be deduced, this time is the much short one than that one
demanded from the analogous electromechanical systems. Once primed, the SCR remains
conductor without need of some voltage of commando on the gate. conserving this condition also
when on the gate ones they come applies new impulses to you of commando. For turning off the
SCR, that is in order to bring back it to the state of interdiction, two exist arrange: the voltage
between anode can be reduced to zero and cathode, or the anode regarding the cathode can be
made to become negative. In this case the alternated voltage is revealed much useful, because it
passes for the zero when it inverts the own polarity to every semi period. In figure 5 light bulb to
filament in alternating current is introduced the example of a according to electronic interrupting
SCR in a circuit of feeding of one. We see of it hour the behavior theoretical.
Fig. 3 - Theoretical circuit of application of a according to interrupting diode SCR, closed
or open, of ignition of lamp LP.

In absence of it marks them on the gate ones, the SCR is behaved like a opened switch, that is it
does not lead current and lamp LP remains extinguished. But when an impulse of voltage to
every half-cycle of the alternated voltage is applied, the switch closes itself and lamp LP is
ignited. Not however in the full load of its brightness, because the SCR is behaved like a normal
diode in series to the circuit, that it straightens the alternated voltage. In practical, the ignition of
the lamp is reduced to 50%. In figure 6 the new condition is illustrated electrical worker of the
circuit of figure 5, in which I SCR transforms in a diode rectifier of the alternated voltage.

Fig. 4 - The diode SCR, connected in series with a conductor covered from alternating
current, is behaved like a rectifying element, leaving via free the passage of the sun positive


In figure 7 the theoretical application of a TRIAC, analogous is brought back to that one of the
SCR of figure 5.
Fig. 5 - Example of employment of a TRIAC, as electronic switch, in a circuit of ignition of
one lamp fed in alternating current (C.A).

In absence of tension impulse that in this case, with the exception of how much it happens in the
SCR can be is positive that negative, the TRIAC does not lead, that is is behaved as an open
switch and lamp LP remains extinguished. Applying instead one small tension, positive or
negative, on the gate ones, the TRIAC becomes conductor and is equivalent to a closed switch.
But this time the semiconductor let’s to cross from both the semi waves of the alternated tension,
as it indicates the design of figure 8.

Fig. 6 - Since in the TRIAC two diode are contained connect to you in ant parallel, all the
semi waves, those positive ones and those negatives of the alternating current cross the

And that because the inner structure of the TRIAC is correspondent to that one of two
diode SCR connects to you in parallel, with the polarity opposite. in ant parallel. but with the
electrode of I prime in common.
We have said that the TRIAC can be primed applying a tension impulse on its gate ones. But this
auto innesca component when the value of the tension alternated applied on the two anodes
exceeds a sure limit, called tension of breakdown. Making then to diminish the current and to
increase the cargo resistance of the TRIAC, a point is caught up in which the current it is not
more in a position to maintaining in conduction the semiconductor.
The minimal value of the current that can maintain primed the TRIAC comes commonly
indicated like current of Hold, that is maintenance current.

    3. ULN 2003
        In electronics, the Darlington transistor (often called a Darlington pair) is a compound
structure consisting of two bipolar transistors (either integrated or separated devices) connected
in such a way that the current amplified by the first transistor is amplified further by the second
one. This configuration gives a much higher current gain (written β, hfe, or hFE) than each
transistor taken separately and, in the case of integrated devices, can take less space than two
individual transistors because they can use a shared collector. Integrated Darlington pairs come
packaged in transistor-like packages.

A Darlington pair can be sensitive enough to respond to the current passed by skin contact even
at safe voltages. Thus it can form the input stage of a touch-sensitive switch.

The datasheet of this transistor is as shown below.


Dual-tone multi-frequency signaling (DTMF) is used for telecommunication signaling over
analog telephone lines in the voice-frequency band between telephone handsets and other
communications devices and the switching center. The version of DTMF used for push-button
telephone tone dialing is known as Touch-Tone, first used by AT&T in commerce as a registered
trademark, and is standardized by ITU-T Recommendation Q.23. It is also known in the UK as

Other multi-frequency systems are used for internal signaling within the telephone network.

Multifrequency signaling

Prior to the development of DTMF, telephone systems employed pulse dialing (Dial Pulse or DP
in the U.S.) or loop disconnect (LD) signaling to dial numbers. It functions by rapidly
disconnecting and re-connecting the calling party's telephone line, similar to flicking a light
switch on and off. The repeated interruptions of the line, as the dial spins, sounds like a series of
clicks. The exchange equipment counts these dial pulses to determine the dialed number. Loop
disconnect range was restricted by telegraphic distortion and other technical problems, and
placing calls over longer distances required either operator assistance (operators used an earlier
kind of multi-frequency dial) or the provision of subscriber trunk dialing equipment.

Multifrequency signaling (see also MF) is a group of signaling methods, that use a mixture of
two pure tone (pure sine wave) sounds. Various MF signaling protocols were devised by the Bell
System and CCITT. The earliest of these were for in-band signaling between switching centers,
where long-distance telephone operators used a 16-digit keypad to type the next portion of the
destination telephone number in order to contact the next downstream long-distance telephone
operator. This semi-automated signaling and switching proved successful in both speed and cost
effectiveness. Based on this prior success with using MF by specialists to establish long-distance
telephone calls, Dual-tone multi-frequency (DTMF) signaling was developed for the consumer to
signal their own telephone-call's destination telephone number instead of talking to a telephone
Due to DTMF over analog telephone lines in the voice-frequency band between telephone
handsets and other communications-terminating devices and the switching center, the previously
semi automated system that needed human intervention from a telephone operator, who then
dialed a sequence of MF digits that were then routed and switched via automation. AT&Ts
Compatibility Bulletin No. 105, AT&T described the product as "a method for pushbutton
signaling from customer stations using the voice transmission path." In order to prevent using a
consumer telephone to interfere with the MF-based routing and switching between telephone
switching centers, DTMF's frequencies differ from all of the pre-existing MF signaling protocols
between switching centers: MF/R1, R2, CCS4, CCS5, and others that were later replaced by SS7
digital signaling. DTMF as used for push-button telephone tone dialing was known throughout
the Bell System by the trademark Touch-Tone. This term was first used by AT&T in commerce
on December 1, 1960 and then was introduced to the public on November 18, 1963. It was
AT&T's registered trademark from September 4, 1962 to March 13, 1984, and is standardized by
ITU-T Recommendation Q.23. It is also known in the UK as MF4.

Other vendors of compatible telephone equipment called the Touch-Tone feature Tone dialing or
DTMF, or used their own registered trade names such as the Digi tone of Northern Electric, now
known as Nortel Networks.

The DTMF system uses eight different frequency signals transmitted in pairs to represent sixteen
different numbers, symbols and letters - as detailed below.

As a method of in-band signaling, DTMF tones were also used by cable television broadcasters
to indicate the start and stop times of local commercial insertion points during station breaks for
the benefit of cable companies. Until better out-of-band signaling 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.

The engineers had envisioned phones being used to access computers, and surveyed a number of
companies to see what they would need for this role. This led to the addition of the number sign
(#, sometimes called 'octothorpe' or 'pound' in this context - 'hash' or 'gate' in the UK) and
asterisk or "star" (*) keys as well as a group of keys for menu selection: A, B, C and D. In the
end, the lettered keys were dropped from most phones, and it was many years before these keys
became widely used for vertical service codes such as *67 in the United States and Canada to
suppress caller ID.

Public payphones that accept credit cards use these additional codes to send the information from
the magnetic strip.

The U.S. military also used the letters, relabeled, in their now defunct Autovon phone system.
Here they were used before dialing the phone in order to give some calls priority, cutting in over
existing calls if need be. The idea was to allow important traffic to get through every time. The
levels of priority available were Flash Override (A), Flash (B), Immediate (C), and Priority (D),
with Flash Override being the highest priority. Pressing one of these keys gave your call priority,
overriding other conversations on the network. Pressing C, Immediate, before dialing would
make the switch first look for any free lines, and if all lines were in use, it would disconnect any
non-priority calls, and then any priority calls. Flash Override will kick every other call off the
trunks between the origin and destination. Consequently, it was limited to the White House
Communications Agency.

Precedence dialing is still done on the military phone networks, but using number combinations
(Example: Entering 93 before a number is a priority call) rather than the separate tones and the
Government Emergency Telecommunications Service has superseded Autovon for any civilian
priority telco access.

Present-day uses of the A, B, C and D keys on telephone networks are few, and exclusive to
network control. For example, the A key is used on some networks to cycle through different
carriers at will (thereby listening in on calls). Their use is probably prohibited by most carriers.
The A, B, C and D tones are used in amateur radio phone patch and repeater operations to allow,
among other uses, control of the repeater while connected to an active phone line.

DTMF tones are also used by some cable television networks and radio networks to signal the
local cable company/network station to insert a local advertisement or station identification.
These tones were often heard during a station ID preceding a local ad inserts. Previously,
terrestrial television stations also used DTMF tones to shut off and turn on remote transmitters.

DTMF signalling tones can also be heard at the start or end of some VHS (Video Home System)
cassette tapes. Information on the master version of the video tape is encoded in the DTMF tone.
The encoded tone provides information to automatic duplication machines, such as format,
duration and volume levels, in order to replicate the original video as closely as possible.

DTMF tones are sometimes used in caller ID systems to transfer the caller ID information,
however in the USA only Bell 202 modulated FSK signaling is used to transfer the data.

A DTMF can be heard on most Whelan Outdoor Warning systems.


1209 Hz on 697 Hz to make the 1 tone
The DTMF keypad is laid out in a 4×4 matrix, with each row representing a low frequency, and
each column representing a high frequency. Pressing a single key (such as '1' ) will send a
sinusoidal tone for each of the two frequencies (697 and 1209 hertz (Hz)). The original keypads
had levers inside, so each button activated two contacts. The multiple tones are the reason for
calling the system multi frequency. These tones are then decoded by the switching center to
determine which key was pressed.

DTMF keypad frequencies (with sound clips)

         1209 Hz 1336 Hz 1477 Hz 1633 Hz

697 Hz        1       2        3       A

770 Hz        4       5        6       B

852 Hz        7       8        9       C

941 Hz        *       0        #       D

Special tone frequencies

National telephone systems define additional tones to indicate the status of lines, equipment, or
the result of calls with special tones. Such tones are standardized in each country and may
consist of single or multiple frequencies. Most European countries use a single frequency, where
the United States uses a dual frequency system, presented in the following table.

      Event           Low frequency High frequency

Busy signal               480 Hz       620 Hz

Ring back tone (US)       440 Hz       480 Hz

Dial tone                 350 Hz       440 Hz

The tone frequencies, as defined by the Precise Tone Plan, are selected such that harmonics and
inter modulation products will not cause an unreliable signal. No frequency is a multiple of
another, the difference between any two frequencies does not equal any of the frequencies, and
the sum of any two frequencies does not equal any of the frequencies. The frequencies were
initially designed with a ratio of 21/19, which is slightly less than a whole tone. The frequencies
may not vary more than ±1.8% from their nominal frequency, or the switching center will ignore
the signal. The high frequencies may be the same volume or louder as the low frequencies when
sent across the line. The loudness difference between the high and low frequencies can be as
large as 3 decibels (dB) and is referred to as "twist."
The minimum duration of the tone should be at least 70 ms, although in some countries and
applications DTMF receivers must be able to reliably detect DTMF tones as short as 45ms.

As with other multi-frequency receivers, DTMF was originally decoded by tuned filter banks.
Late in the 20th century most were replaced with digital signal processors. DTMF can be
decoded using the Goertzel algorithm.

DTMF Decoder:

DTMF Decoder is a very easy to use program to decode DTMF dial tones found on telephone
lines with touch tone phones.
DTMF Decoder is also used for receiving data transmissions over the air in amateur radio
frequency bands.

The following are the frequencies used for the DTMF (dual-tone, multi-frequency) system,
which is also referred to as tone dialing. The signal is encoded as a pair of sinusoidal (sine wave)
tones from the table below which are mixed with each other. DTMF is used by most PSTN
(public switched telephone networks) systems for number dialing, and is also used for voice-
response systems such as telephone banking and sometimes over private radio networks to
provide signaling and transferring of small amounts of data.

                              Table of DTMF frequencies (CCITT)

                                                      Tone B [Hz]
                                             1209     1336 1477       1633

                                       697     1        2       3       A

                                       770     4        5       6       B
                       Tone A [Hz]
                                       852     7        8       9       C

                                       941     *        0       #       D

“Live” tone signals are fed from telephone line or radio into soundcard of computer. Either line-
or microphone input jack is used. It is highly recommended to ensure galvanic decoupling
between PC and telephone line or radio receiver. DTMF Decoder output is clear text consisting
of the symbols shown in table above. An exact log is displayed; when, which number was dialed.
This log is automatically stored into a log file for later exploration.

2051 Microcontroller:

The 2051 is a 20 pin version of the 8051. It is a low-voltage, high-performance CMOS 8-bit
microcomputer with 2K bytes of Flash programmable and erasable read only memory. Atmel
manufactures the chip using high-density nonvolatile memory technology. The 2051 and is
compatible with the industry-standard MCS-51 instruction set. By combining a versatile 8-bit
CPU with Flash on a monolithic chip, the Atmel 2051 is a powerful microcontroller. It provides
a very flexible, cost-effective solution to many embedded control applications.

Operational features of the 2051

The 2051 features Compatibility with MCS-51 ™ Products, 2K Bytes of Reprogrammable Flash
Memory with 1,000 Write/Erase Cycles. The operating range of the 2051 is 2.7V to 6V. Among
these features, the 2051 also contains the following features:

Fully Static Operation: 0 Hz to 24 MHz

Two-level Program Memory Lock

128 x 8-bit Internal RAM

15 Programmable I/O Lines

Two 16-bit Timer/Counters

Six Interrupt Sources

Programmable Serial UART Channel

Direct LED Drive Outputs

On-chip Analog Comparator

Low-power Idle and Power-down Modes

2051 Pin-out and Description
Pin Description

Pin Name:                           Purpose:

VCC                                            Supplies voltage and power.

GND                                            Ground.

Port 1

Port 1 is an 8-bit bi-directional I/O port. Port pins P1.2 toP1.7 provide internal pull-ups. P1.0 and
P1.1 require external pull-ups. P1.0 and P1.1 also serve as the positive input (AIN0) and the
negative input (AIN1), respectively, of the on-chip precision analog comparator. The Port 1
output buffers can sink 20mA and can drive LED displays directly. When 1s are written to Port 1
pins, they can be used as inputs. When pins P1.2 to P1.7 are used as inputs and are externally
pulled low, they will source current (IIL) because of the internal pull-ups. Port 1 also receives
code data during Flash programming and verification.

Port 3

 Port 3 pins P3.0 to P3.5, P3.7 are seven bi-directional I/O pins with internal pull-ups. P3.6 is
hard-wired as an input to the output of the on-chip comparator and is not accessible as a general
purpose I/O pin. The Port 3 output buffers can sink 20mA. When 1s are written to Port 3 pins
they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that
are externally being pulled low will source current (IIL) because of the pull-ups.
Port 3 also serves the functions of various special features of the AT89C2051 as listed

Port 3 also receives some control signals for Flash programming and verification.


 Reset input. All I/O pins are reset to 1s as soon as RST goes high. Holding the RST pin high for
two machine cycles while the oscillator is running resets the device.

Restrictions on Instructions

The AT89C2051 and is the economical and cost-effective member of Atmel’s family of
microcontrollers. Therefore, it contains only 2K bytes of flash program memory. It is fully
compatible with the MCS-51 architecture, and can be programmed using the MCS-51 instruction
set. However, there are a few considerations one must keep in mind when utilizing certain
instructions to program this device. All the instructions related to jumping or branching should
be restricted such that the destination address falls within the physical program memory space of
the device, which is 2K for the AT89C2051. This should be the responsibility of the software
programmer. For example, LJMP 7E0H would be a valid instruction for the AT89C2051 (with
2K of memory), whereas LJMP 900H would not.

1. Branching instructions:


 These unconditional branching instructions will execute correctly as long as the programmer
keeps in mind that the destination branching address must fall within the physical boundaries of
the program memory size (locations 00H to 7FFH for the 89C2051). Violating the physical space
limits may cause unknown program behavior.

CJNE [...], DJNZ [...], JB, JNB, JC, JNC, JBC, JZ, JNZ
With these conditional branching instructions the same rule above applies. Again, violating the
memory boundaries may cause erratic execution.

 For applications involving interrupts the normal interrupt service routine address locations of the
80C51 family architecture have been preserved.

2. MOVX-related instructions, Data Memory:

The 2051 contains 128 bytes of internal data memory. Thus, in the 2051 the stack depth is
limited to 128 bytes, the amount of available RAM. External DATA

memory access is not supported in this device, nor is external PROGRAM memory execution.
Therefore, no MOVX [...] instructions should be included in the program. A typical 80C51
assembler will still assemble instructions,

even if they are written in violation of the restrictions mentioned above. It is the responsibility of
the controller user to know the physical features and limitations of the device being used and
adjust the instructions used correspondingly.

Power-down Mode

In the power down mode the oscillator is stopped, and the instruction that invokes power down is
the last instruction executed. The on-chip RAM and Special Function Registers retain their
values until the power down mode is terminated. The only exit from power down is a hardware
reset. Reset redefines the SFRs but does not change the on-chip RAM. The reset should not be
activated before VCC is restored to its normal operating level and must be held active long
enough to allow the oscillator to restart and stabilize.

P1.0 and P1.1 should be set to “0” if no external pull-ups are used, or set to “1” if external pull-
ups are used.

The 2051 is a low voltage (2.7V - 6V), high performance CMOS 8-bit microcontroller with 2
Kbytes of Flash programmable and erasable read only memory (PEROM). This device is
compatible with the industry standard 8051 instruction set and pin-out. The 2051 is a powerful
microcomputer which provides a highly flexible and cost effective solution to many embedded
control applications.

In addition, the 2051 is designed with static logic for operation down to zero frequency and
supports two software selectable power saving modes. The Idle Mode stops the CPU while
allowing the RAM, timer/counters, serial port and interrupt system to continue functioning. The
Power Down Mode saves the RAM contents but freezes the oscillator disabling all other chip
functions until the next hardware reset.

Uses of the 2051 Microcontroller:

The 2051 is used in many applications.

       Controlling 7-segment displays

-     Clocks

       Sensor projects

-     Temperature

Used to Control LCD ( 8051 )


1. Introduction
Opto-isolators, or opto-couplers, are made up of a light emitting device, and a light sensitive device, all
wrapped up in one package, but with no electrical connection between the two, just a beam of light. The
light emitter is nearly always an LED. The light sensitive device may be a photodiode, phototransistor, or
more esoteric devices such as thyristers, triacs etc.

The cheapest kind has phototransistors. Below is a basic circuit diagram using one of these types

The output of this circuit simply follows the input:
Note the slight curving of the square wave input. All opto-isolators will only work up to a certain
frequency. Some are much faster than others. Make sure that the opto-isolator you use is fast
enough for the signals you are putting through it - more details in section 4. The reason the rise
time is slower than the fall time of the output waveform is that the rising edge is due to the 4k7
pull-up resistor, which has to discharge the capacitance in the opto transistor. If this needs to be
speeded up, the 4k7 resistor value can be reduced, at the expense of using more current when the
output is low.

When the LED is driven with a current of 10mA or so, it shines onto the phototransistor, which
then starts to conduct (turn on). This takes the output voltage low. However much electrical
noise is on one side, it can never be transmitted over to the other side. We may use an opto-
isolator to send PWM signals from the low-power electronics side to the MOSFET drivers on the
high-power side, and we may use them to transmit information from the high- power side back to
the low-power side.

To complete the isolation of the low and high power sides, each must be powered by a
completely separate battery. The high power side will be powered by the main 12v or 24v
battery. The low-power side can be powered by a much smaller battery, maybe 6v.

2. Opto-isolator parameters
If you open a datasheet for an opto-isolator in a separate browser window, we can go through some of
the parameters and describe what they mean. Click here to open a datasheet for the Sharp PC123 in
another window, because we will be referring to it.

Collector-emitter voltage
This is the maximum voltage that can be present from the collector to the emitter of the receiving
phototransistor (when it is turned off - no light) before it may break-down.
Creepage distance
This is physically how far a spark would have to travel around the outside of the package to get from one
side to the other. If the package has contaminants on it, solder flux, or dampness, then a lower-
resistance path can be created for noise signals to travel along.

Forward current
This is the current passing through the sending LED. Typically, an opto-isolator will require about 5mA to
turn the output transistor on.

Forward voltage
This is the voltage that is dropped across the LED when it is turned on. Most normal diodes drop about
0.7v, but with LEDs it is typically 1 - 2 volts.

Collector dark current
This is the current that can flow through the output phototransistor when it is turned off.

Collector-emitter saturation voltage
When the output transistor is fully turned on (saturated), this is the voltage there will be between the
collector and emitter.

Isolation resistance
This is the resistance from a pin in the input side to a pin on the output side. It should be very high.

Response time
Thee rise and fall times are the times that the output voltage takes to get from zero to maximum. The
rise time is very much dependant on the load resistor, since it is this that is pulling the output up.
Therefore this value is always quoted with a fixed load resistance. Note however that the value, 100
Ohms, is much less than you are likely to use in practice. This is another of the manufacturer's attempts
to make the product look better than it is!

Cutoff frequency
This is effectively the highest frequency of square wave that can be sent through the opto-isolator. It is
actually the frequency at which the output voltage is only swinging half the amplitude than at DC levels
(-3dB = half). It is therefore linked with the rise and fall times.

Current Transfer Ratio (CTR)
This is the ratio of how much collector current in the output transistor that you get given a certain
amount of forward current in the input side LED. It is affected by how close the LED and phototransistor
are inside the device, how efficient they both are, and many other factors. In fact it is not a constant but
varies wildly with LED forward current as we will see.

2.1. The graphs
The graphs are essential to see how the device actually performs, rather than how the manufacturer
wants you to think it performs on initial reading of the front page parameters! We'll take an example
and work it through the graphs.
       The first few graphs on power dissipation are not really of any great interest to us. They are
        more useful for people designing low-power consumption circuits.
       Fig 7: The Current Transfer Ratio vs. Forward Current is a useful graph. This shows how the CTR
        varies wildly. In our design, we will start with a required collector current for the output
        phototransistor. From that, we can calculate how much forward current is required in the LED to
        produce it using this graph. For example, if we required 10mA of collector current, then we must
        follow the line of this graph until the forward current times the CTR is 10mA. This occurs at
        about If=6mA / CTR=180%.
       Figure 9 shows how the CTR will be affected as the electronics get hot, which they are bound to
        do as the motors and MOSFETs start dissipating power. It shows at 100 degrees the CTR has
        derated to about 60%, so we should re-estimate our required LED forward current based on
        this. Assume the % values for CTR in figure 7 are only 60% of what they are shown, then we
        need about If = 10mA, to get a collector current of If x CTR x 60% = 10mA x 180% x 60%.
       Fig 6: Forward Current vs. Forward Voltage. This is the LED diode curve. We now know we need
        10mA of forward current, and from this graph we can see that the LED will drop about 1.1 volts
        at 50 degrees C. If we power this LED from the output of a CMOS device (0 to 5 volts), then we
        can calculate the series resistor required: R = (5-Vf)/If = (5-1.1)/10mA = 390 Ohms.
       Figure 8 allows us see the collector-emitter voltage that will be present when the output
        phototransistor is turned on. Follow the If = 10mA line until it crosses the 10mA Ic of the vertical
        axis. The Vce(on) is about 1 volt. This is the voltage we will have at the output when the light is
        on. We can now calculate the load resistor, Rl, that we require from the collector to battery
        positive, Vb. This is Rl = (Vb-Vceon)/Ic = (12-1)/10mA = 1.1k.
       Figure 11 shows how much current will flow through the phototransistor when the LED is off.
        Worst case, when hot, is about 10 microAmps. With this current, the output voltage will be Vo =
        Ic(off) x Rl = 0.00001 x 1100 = 0.01V. This is how much lower than Vb the output will be, i.e. 12 -
        0.01 = 11.99V. This is the output voltage with no light input.
       Figure 12 allows us to see how fast a signal the opto-isolator can cope with given the conditions
        that we have now laid down. The load resistor is 1.1k, follow the tr and tf lines to get tr=25, and
        tf=20 microseconds. Now the fastest signal will be when the output rises as soon as it has fallen,
        and falls as soon as it has risen. A complete cycle takes 20+25=45 microseconds. This is the
        minimum time that one pulse can take. For the PWM signal, it is the thinnest pulse. If you want
        the PWM signal to increase in steps of, say, 5%, so there are 20 discrete speed settings, then
        one 5% slot will be 45 microseconds, so the complete frequency will be 20 slots worth, or 900
        microseconds, which is a frequency of 1.1kHz.

This has shown how a design is developed using the given parameters from a datasheet.

3. Types of opto-isolator
The opto-isolator in the example above was a simple photo-transistor output type. These are the
cheapest types, although they're not always the most useful. For a start, the LED required 10mA of
forward current. If you are driving it from a microcontroller, it may not be capable of sinking that much
current, so you would then need a transistor to boost it. In this case, you may better off using a logic to
logic opto-isolator. These require a 5 volt supply and will accept a logic level input. The output may also
be logic-level, or it may still be open-collector like the example above. Logic level opto- isolators
generally can be run at much higher frequencies. 10Mbits per second is typical.
4. Frequency and Rise & Fall times
We are likely to be driving at least some of the opto-isolators with PWM signals for speed control of the
motors. What frequency are these PWM signals, and will the opto-isolators be able to cope with them?

The PWM signals are generated elsewhere in your circuit of course, so you may already have
decided what frequency they will be. This frequency, together with the number of discrete speed
steps that you have, determines how fast the opto-isolator must be. The diagram below show a
PWM signal with 12 discrete speed steps, with a 1/12 level signal (signal A). This means the
signal is high for one twelfth of the time:

The number of speed steps may be greater. Most microcontrollers with PWM outputs use an 8-
bit register, giving 256 discrete speed steps.

The frequency of this PWM signal is the reciprocal of its total time period, tp. Fpwm = 1/tp.
However, any circuit that transmits this must be able to respond to the single pulse. To respond
to this, it must be able to respond to a frequency rather higher than Fpwm, that shown in orange in
signal B. The frequency of this signal is

The 16 in the equation comes from the number of discrete steps, so in general, we can say that if
we want n discrete steps, the opto-isolaator must be able to handle a frequency of
Most opto-isolator datasheets quote the rise and fall tmes of the opto-isolator outputs rather than
a maxmum frequency. How can we use these values? The diagram below shows a more realistic
signal from an opto-isolator.

 In this diagram, the rise and fall times are shown equal, but they are often not - especially with
open-collector or open-drain type optos where an external pull-up resistor controls the rise time.
It can be seen from this and the previous equations that

Therefore, if we are given an opto with defined rise and fall times, we can work out:

The maximum frequency for n discrete speed steps:

The maximum number of speed steps for a PWM frequency of FPWM:



The Hewlett Packard (Agilent) HCPL-3120 optocoupler has the following parameters:

tr = tf = 0.1μs

Given that the PWM frequency has been set at 25kHz to be above audible range, what is the
greatest number of discrete speed steps that can be attained.

Using the equation

n = 400. Therefore n 8-bit PWM register with 256 discrete steps would work fine.

Note that even if we drove this optocoupler with more than 400 steps, all that would happen is
that there would be no measurable difference between a setting of, say, 650, and 651, and if a
1024 discrete step PWM signal was set to a level 1/1024 (signal high for one 1024th of the time),
then the opto would not respond, and the effective level would be zero.

More complicated PWM signals
This next diagram shows a PWM signal with 12 discrete steps, set at 3/12 level:

The three segments during which the signal is high are not necessarily next to each other. This
signal will generate a smoother resultant speed in the motor than if all three pulses were next to
each other. Some PWM generators may generate a signal like this, some may have all three
pulses next to each other, in which case the required response time of the optocoupler need not
be so high.

The opto isolator used in this design is MOC 3021.

Inverter(Logic Gate):

In digital logic, an inverter or NOT gate is a logic gate which implements logical negation. The
truth table is shown on the right.

This represents perfect switching behavior, which is the defining assumption in Digital
electronics. In practice, actual devices have electrical characteristics that must be carefully
considered when designing inverters. In fact, the non-ideal transition region behavior of a
CMOS inverter makes it useful in analog electronics as a class A amplifier (e.g., as the output
stage of an operational amplifier.
Electronic implementation

NMOS            PMOS           Static CMOS            Schematic of a Saturated-Load Digital
Inverter        Inverter       Inverter               Inverter

An inverter circuit outputs a voltage representing the opposite logic-level to its input. Inverters
can be constructed using a single NMOS transistor or a single PMOS transistor coupled with a
resistor. Since this 'resistive-drain' approach uses only a single type of transistor, it can be
fabricated at low cost. However, because current flows through the resistor in one of the two
states, the resistive-drain configuration is disadvantaged for power consumption and processing
speed. Alternately, inverters can be constructed using two complimentary transistors in a CMOS
configuration. This configuration greatly reduces power consumption since one of the transistors
is always off in both logic states. Processing speed can also be improved due to the relatively low
resistance compared to the NMOS-only or PMOS-only type devices. Inverters can also be
constructed with Bipolar Junction Transistors (BJT) in either a resistor-transistor logic (RTL) or
a transistor-transistor logic (TTL) configuration.

Digital electronics circuits operate at fixed voltage levels corresponding to a logical 0 or 1 (see
Binary). An inverter circuit serves as the basic logic gate to swap between those two voltage
levels. Implementation determines the actual voltage, but common levels include (0, +5V) for
TTL circuits.

Digital building block
This schematic diagram shows the arrangement of NOT gates within a standard 4049 CMOS hex
inverting buffer.

The digital inverter is considered the base building block for all digital electronics. Memory (1
bit register) is built as a latch by feeding the output of two serial inverters together. Multiplexers,
decoders, state machines, and other sophisticated digital devices all rely on the basic inverter.

The Hex Inverter is an integrated circuit that contains six (hexa-) inverters. For example, the
7404 TTL chip which has 14 pins and the 4049 CMOS chip which has 16 pins, 2 of which are
used for power/referencing, and 12 of which are used by the inputs and outputs of the six
inverters (the 4049 has 2 pins with no connection).

Performance measurement

Digital inverter quality is often measured using the Voltage Transfer Curve, which is a plot of
input vs. output voltage. From such a graph, device parameters including noise tolerance, gain,
and operating logic-levels can be obtained.

Voltage Transfer Curve for a 20 μm Inverter constructed at North Carolina State University

Ideally, the voltage transfer curve (VTC) appears as an inverted step-function - this would
indicate precise switching between on and off - but in real devices, a gradual transition region
exists. The VTC indicates that for low input voltage, the circuit outputs high voltage; for high
input, the output tapers off towards 0 volts. The slope of this transition region is a measure of
quality - steep (close to -Infinity) slopes yield precise switching.

The tolerance to noise can be measured by comparing the minimum input to the maximum
output for each region of operation (on / off).

The output voltage, VOH, can be a measure of signal driving strength when cascading many
devices together.

The logic IC used is 74LS04.
Result and Conclusion:

        Remote control system by telephone presented in this paper is based on PIC and has very
secure structure. Designed circuit is isolated both optically and electrically; therefore it does not
create any effect on telephone line. With pin-check system, non-authorized people can not
connect to or use this system. In this application, secure, cheap and safe remote control system
for intelligent houses has been presented.

Future scope:

There exists great future scope in this thesis work.

1.) The devices control using the DTMF signal can also be controlled using the TCP/IP protocols
as it increases the range of control.

2.) The wireless techniques can be used where telephone lines does not exist.

3.) The also supports the use of blue tooth and other advanced techniques.
4.) If the user environment is noise then noise can be eliminated using the signal-processing



Electronic devices and circuits By Louis boylsted and Naschalsky.

Linear Integrated circuits By Roy choudhary

The 8051 Microcontroller and Embedded Systems By Mohammad Ali Mazidi

Electrical machinery By P.s.Bimra

Internet Sources

To top