Mini Project Report On: Home Automation
Mini Project Report On: Home Automation
Report On
HOME
AUTOMATION
Acknowledgement:
Abstract
List of Tables
List of Figures
Chapter 1 Introduction
1.1 Introduction to embedded systems
1.2 Classification of embedded systems
1.3 Characteristics
1.4 Features
1.5 Applications
Chapter 7
KEIL Software
Chapter 8
Source coding
Chapter 9
Future aspects
Conclusion
Bibliography
Appendix: A: Data sheet (AT89C2051)
ABSTRACT
Traditionally electrical appliances in a home are controlled via switches that regulate
the electricity to these devices. As the world gets more and more technologically advanced, we
find new technology coming in deeper and deeper into our personal lives even at home. Home
automation is becoming more and more popular around the world and is becoming a common
practice. The process of home automation works by making everything in the house
automatically controlled using technology to control and do the jobs that we would normally
do manually. Home automation takes care of a lot of different activities in the house.
This project we propose a unique System for Home automation utilizing Dual Tone
Multi Frequency (DTMF) that is paired with a wireless module to provide seamless wireless
control over many devices in a house. The block diagram is a shown below. This user console
has many keys , each corresponding to the device that needs to be activated. The encoder
encodes the user choice and sends via a FM transmitter. The FM receiver receives the
modulated signal and demodulates it and the user choice is determined by the DTMF decoder.
Based upon this the required appliance is triggered.
Chapter 1 Introduction
INTRODUCTION
1
set. In the receiver part, the DTMF detector IC, for example IC MT 8870 detects the
number or code represented by DTMF back, through the inspection of the two
transmitted frequencies. The DTMF frequencies representing the number/ codes are
shown below.
A system is a part of the world that a person or group of persons during some
time interval and for some purpose choose to regard as a whole, consisting of interrelated
components, each component characterized by properties that are selected as being
relevant to the purpose.
Embedded System:
2
We can define an embedded system as “a computing device, built in to a
device that is not a computer, and meant for doing specific computing tasks”.
EA should be strapped to VCC for internal program executions. This pin also
receives the 12-volt programming enable voltage (VPP) during Flash programming when
12-volt programming is selected
The Essence:
3
Fig . Embedded System
RTS classification:
RTS is one which has to respond to events within a specified deadline
4
Hard Real Time Systems
Soft Real Time System
"Hard" real-time systems have very narrow response time
Example: Nuclear power system, Cardiac pacemaker.
"Soft" real-time systems have reduced constrains on "lateness" but still must operate
very quickly and repeatable.
Example: Railway reservation system – takes a few extra seconds the data remains
valid.
CHARACTERISTICS:
Designs are cost-sensitive
Have real-time performance constraints
Used with Real-Time Operating Systems (RTOS)
Software failure can be life-threatening
May have constraints on power consumption
Operate over a wide-range of environmental conditions
Fewer system resources then a desktop system
All code might be stored in ROM
Require specialized design tools
May have on-chip debugging resources
FEATURES:
• Response
• Security
• Availability
• Cost
• Size/Weight
• Survivability
• Maintainability
• Throughput
• Testability
• Low power
• Reliability
5
Safety If A System Is Developed With A Microprocessor, The Designer Has To
Go For External Memory Such As Ram, Rom Or EPROM And Peripherals And Hence
The Size Of The Pcb Will Be Large Enough To Hold All The Required Peripherals. But
The Micro controller Has Got All These Peripheral Facilities On A Single Chip So
Development Of A Similar System With A Micro controller Reduces Pcb Size And Cost
Of The Design.
6
Industrial measurement and control: Hydro electric utility research & management traffic
management systems, train marine vessel management systems.
Medical electronics: Diagnostic devices, real time medical imaging systems, surgical devices,
critical care systems.
Server I/O: Embedded servers, enterprise PC servers, PCI LAN/NIC controllers, RAID
devices, SCSI devices.
Telecommunications: ATM communication products, base stations, networking switches,
SONET/SDH cross connect, multiplexer.
Mobile data infrastructures: Mobile data terminals, pagers, VSATs, Wireless LANs,
Wireless phones.
The Micro controller Has Two 16 Bit Timers / Counters Built Within It, Which Makes
It More Suitable To This Application Since We Need To Produces One Accurate Timer
Delays. It Is Even More Advantageous That The Timers Also Act As Interrupt.
7
Chapter 2 Block diagram of DTMF 8870
BLOCK DIAGRAM
DTMF-8870
The following session gives the total description about the DTMF M8870 – 01 and it’s
interfacing to the controller.
General description:
DTMF stands for Dual Tone Multiple Frequency. . It is numbers 0-9 and the *
and the # you press on your push-button telephone. This allows us to use mobile phones
and house push-button phones to act as “remote controls” The idea of turning your air-
conditioner on at home, whilst on the way home from work is only possible with DTMF
phone.
8
Every push-button phone and mobile telephone in the world has a DTMF
keypad. These telephone DTMF keypads are also fitted to many radios which allow
these radios to dial each other up, or into the phone network as they have a DTMF
keypad. An interesting fact for scanner users is that a DTMF decoder is available.
One Frequency from each the ‘high’ and ‘low’ group is assigned to each of the
12 push buttons on your telephone. The four buttons “A, B, C & D” are not used in
telephones, and are found mostly in radios and other devices with DTMF keypads (fig
1).
DTMF keypad
The DTMF Matrix, ignoring the last column (A, B, C, and D) bits is a
telephone keypad. Every time you press a button on any kind of phone these ‘dual
tones’ (1=697Hz+1209Hz) are both heard by you and sent down the line. A DTMF
decoder, of sorts, is in fact part of every telephones circuitry-it needs it, like a decoder,
to recognize the tones.
The M-8870 is a full DTMF Receiver that integrates both band split filter
and decoder functions into a single 18-pin DIP or SOIC package. Manufactured using
CMOS process technology, the M-8870 offers low power consumption (35 mW max)
and precise data handling. Its filter section uses switched capacitor technology for both
the high and low group filters and for dial tone rejection. Its decoder uses digital
counting techniques to detect and decode all 16 DTMF tone The M-8870 is a full
DTMF Receiver that integrates both band split filter and decoder functions into a single
18-pin DIP or SOIC package. Manufactured using CMOS process technology, the M-
8870 offers low power consumption (35 mW max) and precise data handling. Its filter
section uses switched capacitor technology for both the high and low group filters and
9
for dial tone rejection. Its decoder uses digital counting techniques to detect and decode
all 16 DTMF tone pairs into a 4-bit code. Minimal external components required
include a low-cost 3.579545 MHz color burst crystal, a timing resistor, and a timing
capacitor.
Functional description:
M-8870 operating functions include a band split filter that separates the
high and low tones of the received pair, and a digital decoder that verifies both the
frequency and duration of the received tones before passing the resulting 4-bit code to the
output bus.
Filter:
The low and high group tones are separated by applying the dual-tone
signal to the inputs of two 6th order switched capacitor band pass filters with
bandwidths that correspond to the bands enclosing the low and high group tones. The
filter also incorporates notches at 350 and 440 Hz, providing excellent dial tone
rejection. Each filter output is followed by a single-order switched capacitor section that
smoothes the signals prior to limiting. Signal limiting is performed by high gain
comparators provided with hysteresis to prevent detection of unwanted low-level signals
and noise. The comparator outputs provide full-rail logic swings at the frequencies of
the incoming tones.
Decoder:
10
Steering Circuit:
Before a decoded tone pair is registered, the receiver checks for valid signal
duration (referred to as character-recognition-condition). This check is performed by an
external RC time constant driven by ESt. A logic high on ESt causes VC to rise as the
capacitor discharges. Provided that signal condition is maintained (ESt remains high)
for the validation period (tGTF), VC reaches the threshold (VTSt) of the steering logic
to register the tone pair, thus latching its corresponding 4-bit code into the output latch
(Q1, Q2, Q3, and Q4). At this point, the GT output is activated and drives VC to VDD.
GT continues to drive high as long as ESt remains high. Finally, after a short delay to
allow the output latch to settle, the delayed steering output flag (StD) goes high,
signaling that a received tone pair has been registered. The contents of the output latch
are made available on the 4-bit output bus by raising the three input (OE) to logic state
control high
VDD
11
The steering circuit works in reverse to validate the inter digit pause between signals.
Thus, as well as rejecting signals too short to be considered valid, the receiver will tolerate signal
interruptions (dropouts) too short to be considered a valid pause. This capability, together with
the ability to select the steering time constants externally, allows the designer to tailor
performance to meet a wide variety of system requirements.
4. Design considerations:
12
FIG : Application diagram
The input to the DTMF is given to the pin 2 (IN-) from any telephone line as shown in the
application diagram figure 4. The DTMF receiver receives the dual tone coming from the
telephone line and decodes the signal. The decoded 4 bit word is given to the outputs Q1, Q2,
Q3, an interrupt process when there is logic high on the StD pin. The figure 5 shows output
logics and Q4 as shown in the fig 4. The StD pin goes high indicating that the value on the out
put pins is updated. The control logic checks continuously for the high pulse on StD pin or
develops for the dual frequencies for the corresponding keys.
13
FIG : M8870 output truth table.
The proven reliability of DTMF signaling has created a vast spectrum of possible
applications. The mother board is provided to develop all these possible applications with DTMF
receiver.
14
FIG : Home DTMF remote control system
. One of these applications is the House hold DTMF remote control system. The
block diagram for this system is as shown in the figure 6. Remote ON/OFF control may
be given to electric appliances such as a slow cooker, exterior lighting and garage heater
15
Chapter 3 Power supply
Power Supply
CIRCUIT DIAGRAM:1
D1 LM7805
1 4 - + 2 1 3
1 2 IN U3 OUT
2 DB106 R1
GND
9V I/P 330E
C1
3
470uF/25V C2 C3
100uF/16V
0.1uF D2
LED
16
Design
Control Circuit:
17
WORKING:
The working of the circuit is quite simple and easily understandable by jus
observing the circuit. The working can be mainly discussed as three parts which are the
supply part, micro-controller part and the isolation part respectively. All these parts
together describe the working of the design of Home automation system.
The supply part/section mainly deals with the supply given to the circuit. Actually
it can be done in two ways i.e., either by giving 230V AC or by using a battery (9V) as
source of supply. Now in this design we are using a 9V battery as source of supply. This
9v is regulated to 5V using a voltage regulator as only 5V is required to drive the
microcontroller. This 5V is also given to the receiver. Actual working of this system
involves an RC5 remote which is used as Transmitter and TSOP1738 as IR receiver. And
here we are designed the system for only 6 applications. So only 6 buttons are used in the
RC5 remote. Each button is given certain address depending on the number of duty
cycles it has for 1ns. When a button is pressed, say 1, the receiver receives the signal
from the RC5 remote and the next operation is done by the micro-controller part.
In micro-controller section, there are mainly 2 parts. They are AT89C2051 micro-
controller and ULN 2003 driver (Darlington transistor). The microcontroller intakes the
received signal from the IR receiver (TSOP 1738). The main use of this controller is that
it recognizes and counts the number of duty cycles the received signal has and then
makes the respective output pin high according to the calculations done by it internally.
For example, let us consider that the button 1 has 1500 duty cycles in 1nS. When this
button is pressed, the transmitter in the remote sends this signal and the receiver receives
the signal. The received signal also contains same number of duty cycles but the micro
controller confirms it with the help of the external timers it has. After confirmation, the
controller makes the first output high. Here both the transmitter and receiver are of
Infrared type. This output is connected to Darlington transistor (ULN 2003) which is used
18
to drive the application. This gives a much higher current gain and also improves the life
of the microcontroller. All the six out puts of micro controller are given as input to the
Darlington transistor/pair IC which improves the gain of those outputs and gives the
respective six outputs. These outputs are connected to the Opto-Isolator which is
discussed in the isolation part.
The Isolation part involves the isolation of the AC and DC i.e., the output from
the controller is DC and the Input to the application required is AC and to make
difference of this nature of supply, an Opto isolator (MOC 3021) is used in between
them. The MOC 3021 IC consists of a The input to the isolator is taken from the
Darlington transistor IC. The pin1 of this Isolator IC is given to the supply or is in High
state and the second pin is grounded. The output from the ULN2003 IC is connected to
the second pin of the MOC 3021 IC which is low. The IC internally consists of a LED
and a DIAC. Whenever the led glows, the DIAC gets triggered and hence fires the gate of
the TRIAC connected to the IC. A feedback resistance is used for this operation.
Let us assume that a bulb is used as application here. One terminal of this bulb is
connected to the AC supply and the other is connected to the TRIAC. When the TRIAC
gets fired the bulb glows. This is the working of the Home Automation System using IR
signal.
Transformer:
A transformer is an electrical device which is used to convert electrical
power from one electrical circuit to another without change in frequency.
Transformers convert AC electricity from one voltage to another with
little loss of power. Transformers work only with AC and this is one of the reasons why
mains electricity is AC. Step-up transformers increase in output voltage, step-down
transformers decrease in output voltage. Most power supplies use a step-down
transformer to reduce the dangerously high mains voltage to a the secondary. There is no
19
electrical connection between the two coils; instead they are linked by an alternating
magnetic field created in the soft-iron core of the transformer. The two safer low voltage.
The input coil is called the primary and the output coil is called secondary. The two lines
in the middle of the circuit symbol represent the core. Transformers waste very little
power so the power out is (almost) equal to the power in. Note that as voltage is stepped
down current is stepped up. The ratio of the number of turns on each coil, called the
turn’s ratio, determines the ratio of the voltages. A step-down transformer has a large
number of turns on its primary (input) coil which is connected to the high voltage mains
supply, and a small number of turns on its secondary (output) coil to give a low output
voltage.
Turns ratio = Vp/ VS = Np/NS
VS X IS=VP X IP
Vp = primary (input) voltage
Np = number of turns on primary coil
Ip = primary (input) current
20
COMPONENTS USED:
1. Rectifier(IN4007 Diodes)
2. Voltage Regulator
3. TSOP 1738
4. Crystal oscillator
5. Triac bt136
6. Moc 3021
7. ULN 2003.
8. 2051 Uc
9. RTC
21
Chapter 4 Components Description
COMPONENTS DESCRIPTION
1.Rectifier
Rectifier circuits are found in all dc power supplies that operate from an ac
voltage source. They convert the ac input voltage to a pulsating dc voltage. The most
basic type of rectifier circuit is the half-wave rectifier. Although half-wave rectifiers have
some applications, the full-wave rectifiers are the most commonly used type in dc power
supplies. These are two types of full-wave rectifiers:
(1) full-wave center-tapped rectifier
(2) full-wave bridge rectifier
Here in this particular design we are using a bridge rectifier which is discussed as
follows.
The full –wave bridge rectifier uses four diodes, as shown in below figure. When
the input cycle is positive, diodes D1 and D2 are forward-biased and conduct current
through RL. During this time, diodes D3 and D4 are reverse-biased.
22
F
D1
D3
Vin
Vout
D2 D4 + 0
RL
-
During positive half-cycles of the input, D1 and D2 are forward-biased and conduct
current, D3 and D4 are reverse-biased.
When the input cycle is negative as shown in below figure , diodes D3 and D4 are
forward-biased and conduct current in the same direction through RL as during the
positive half-cycle. During the negative half-cycle, D1 and D2 are reverse-biased. A full-
wave rectifier output voltage appears across RL as a result of this action.
- - D3 D1
Vin
D2 Vout
+ + D4 + 0
RL
-
During negative half-cycles of the input, D3 and D4 are forward-biased and conduct
current, D1 and D2 are reverse-biased.
The above two figures explain the full-wave Bridge Rectifier.
23
The diodes used in this rectifier are
IN4007 which is discussed below.
IN4007 Diode
24
The number and voltage capacity of some of the important diodes available in the market
are as follows:
2.Voltage Regulator
With the exception of passive shunt regulators, all modern electronic voltage regulators
operate by comparing the actual output voltage to some internal fixed reference voltage.
Any difference is amplified and used to control the regulation element in such a way as to
25
reduce the voltage error. This forms a negative feedback servo control loop; increasing
the open-loop gain tends to increase regulation accuracy but reduce stability (avoidance
of oscillation, or ringing during step changes). There will also be a trade-off between
stability and the speed of the response to changes. If the output voltage is too low
(perhaps due to input voltage reducing or load current increasing), the regulation element
is commanded, up to a point, to produce a higher output voltage - by dropping less of the
input voltage (for linear series regulators and buck switching regulators), or to draw input
current for longer periods (boost-type switching regulators); if the output voltage is too
high, the regulation element will normally be commanded to produce a lower voltage.
However, many regulators have over-current protection, so entirely stop sourcing current
(or limit the current in some way) if the output current is too high, and some regulators
may also shut down if the input voltage is outside a given range (see also: crowbar
circuits).
The voltage Regulator used in this design is LM 7812.
LM78xx Regulator
The LM78XX series of three terminal regulators is available with several fixed
output voltages making them useful in a wide range of applications. One of these is local
on card regulation, eliminating the distribution problems associated with single point
regulation. The voltages available allow these regulators to be used in logic systems,
instrumentation, Hi-Fi, and other solid state electronic equipment.
Although designed primarily as fixed voltage regulators these devices can be used with
external components to obtain adjustable voltages and currents. The LM78XX series is
available in an aluminum TO-3 package which will allow over 1.0A load current if
adequate heat sinking is provided. Current limiting is included to limit the peak output
current to a safe value. Safe area protection for the output transistor is provided to limit
internal power dissipation.
26
If internal power dissipation becomes too high for the heat sinking
provided, the thermal shutdown circuit takes over preventing the IC from overheating.
Considerable effort was expanded to make the LM78XX series of regulators easy to use
and minimize the number of external components. It is not necessary to bypass the
output, although this does improve transient response. Input bypassing is needed only if
the regulator is located far from the filter capacitor of the power supply.
For output voltage other than 5V, 12V and 15V the LM117 series provides an output
voltage range from 1.2V to 57V.
Features
Voltage Range
LM7805C 5V
LM7812C 12V
LM7815C 15V
27
Introduction
TSOP1738 is an Infrared (IR) receiver which is widely used in large number of electronic
products for receiving and demodulating infrared signals. The received demodulated
signals can be easily decoded by a microcontroller. It supports RC5, RC6 code, Sony
format (SIRCS), NEC code, Sharp code, etc.
Specifications
28
The datasheet for TSOP1738 is as shown below;
Type fo Typ fo
e
TSOP1730 30 kHz TSOP1733 33KHZ
TSOP1736 36KHZ TSOP1737 36.7KHZ
TSOP1738 38KHZ TSOP1740 40KHZ
TSOP1756 56KHZ
Tamb=25_c
29
temperature
Storage Tstg -25….+85 *C
temperature
range
Operating Tamb -25….+85 *C
temperature
range
Power (Tamb<=85*C) Ptot 50 mW
consumption
Basic Characteristics
Tamb=25C
30
) tolerance: 2
Tpi-
5/fo<tpo<tpi+6/fo
,
Irradiance tpi- Ee max 30 W/m2
5/fo<tpo<tpi+6/fo
Directivity Angle of half Psi ½ +- deg
transmission 45
distance
4. Crystal Oscillators
31
substances with the most important of these for electronic circuits being the quartz
minerals because of their greater mechanical strength.
Quartz Crystal
32
components and there are two resonant frequencies, the lowest is a series type frequency
and the highest a parallel type resonant frequency.
5. TRIAC
INTRODUCTION
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
33
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.
DIODE
34
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.
35
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.
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. 6 - 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 semi-waves.
36
In figure 7 the theoretical application of a TRIAC, analogous is brought
back to that one of the SCR of figure 5.
Fig. 8 - 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 semiconductor.
37
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.
6. Opto-isolator
38
may be integrated into the package. An opto-isolator is usually thought of as a single
integrated package, but opto-isolation can also be achieved by using separate devices.
Digital opto-isolators change the state of their output when the input state
changes; analog isolators produce an analog signal which reproduces the input.
Configurations
Schematic diagram of a very simple opto-isolator with an LED and phototransistor. The
dashed line represents the isolation barrier, over which there is no electrical contact.
39
dependent on the load impedance and light intensity. In photoconductive mode, the diode
is connected to a supply voltage, and the magnitude of the current conducted is directly
proportional to the intensity of light. This optocoupler type is significantly faster than
photo transistor type, but the transmission ratio is very low; it is common to integrate an
output amplifier circuit into the same package.
The optical path may be air or a dielectric waveguide. When high noise
immunity is required an optical conductive shield can be integrated into the optical path.
The transmitting and receiving elements of an optical isolator may be contained within a
single compact module, for mounting, for example, on a circuit board; in this case, the
module is often called an optoisolator or opto-isolator. The photo sensor may be a
photocell, phototransistor, or an optically triggered SCR or TRIAC. This device may in
turn operate a power relay or contactor.
Application
40
Among other applications, opto-isolators can help cut down on ground loops,
block voltage spikes, and provide electrical isolation.
7. ULN 2003
41
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.
CIRCUIT DESCRIPTION
Now let's have a detailed look into the whole circuit section wisely. Before
getting in to the description, for the sake of easiness, let's confirm our aim or let's predict
our expectation regarding its working.
We are supposed to send a code word from the mobile phone, which is the
transmitter and is sending the corresponding DTMF frequencies along. At the receiver
end, i.e. at the land line end we need to detect the code back using our circuitry and it is
to be used for driving the devices, represented by the LEDs.
42
RING DETECTION_SECTION
Refer the circuit diagram of this sectionregarding the need of this section, we
want to use this circuitry in the device mode i.e. to control the device's turn off and turn
on while maintaining the normal functionality and usage of the land line to make and
accept calls. So we must allow sometime for the land line to get into the off hook mode,
also it is necessary to get the landline from on hook mode to off hook mode to enable the
DTMF reception. If the land line is already in the off hook mode, then it won't be able to
receive any signal as in the normal speech communication through networks. So using
this section we are aiming to automatically activate our circuitry after a number of rings
are heard from the landline, while the coupling for automation is done using a relay. Here
we have designed such that the DTMF signals will automatically be coupled to the
Decoding section just after the 6th ring.
Now getting into the detailed analysis, the initial high ring voltage is coupled to a
zener diode circuitry to reduce the voltage level for protection, at the same time
maintaining the enough magnitude for detection using the opto-coupler. See the details in
the circuit diagram. Whenever a ring occurs a sufficient amount of ring voltage is
established across the inputs of the opto-coupler which causes the internal transistor to
conduct and effectively the output 5th and 4th pin to get short. This results in an effective
coupling of input ring voltage to pass through. Now we will exploit this signal to use it as
a clock signal for the decade counter IC 4017, which will produce a high logic level at its
Q5 pin upon reception of the 6th ring, which was changed into a quality clock signal. The
diode-resistor- capacitor network along with the NAND gates of the IC 4093 is used to
shape up the irregular voltage signal obtained at the output of the opto- coupler into a
quality clock pulse for the IC 4017. Because of this, as mentioned earlier, just after the
6th ring the counter 4017 will produce a high level at the Q5 pin till the next clock
occurs. This logic 1 level of Q5 pin is then used to drive the monostable multivibrator
using 555 timer IC through BC 547 transistor coupling. The monostable multivibrator is
designed for a period of about 60 seconds which is the allotted time for the operator to
43
control the device using the palm device he has. Thus the monostable multivibrator will
produce logic 1 level for a period of about 60 seconds at its output which is used to drive
a relay as shown through transistor coupling, which will couple a low resistance in
between the RING and the TIP terminals of the landline, resulting in the manifestation of
a DC loop driving the landline from ON HOOK to OFF HOOK preparing the decoding
section for the reliable reception of the signal transmitted from the mobile phone.
Now, we have to contend with a problem arising from the past counting of the IC
4017. Suppose a fellow called to our landline and cut the phone at the 4th or 5th ring.
After this if somebody calls again then right at the first ring the landline will get into the
OFF HOOK mode contrary to our expectation at the 6th ring. How can we avoid this
error? To solve this, what we have with us is only the RESET pin of IC 4017. So the
solution is that we must reset the IC 4017 every time just after once the 6th ring has
occurred or the decoding section is coupled for decoding.
So for this we use the retrigerrable monostable multivibrator using IC 74LS123
commonly called as the ISS-PULSE-DETECTOR. For this we supply the same clock
pulse of 4017 to the IC74123, which has been designed for a period of more than twice as
long as the duration of a single ring signal, which is about 5 seconds.
The out put from the 4th pin of IC 74123, which is the TOGGLED Q output, is
then supplied to the active high RESET pin of IC 4017. Thus this arrangement will avoid
the past counting nature of IC 4017 by resetting it just after the completion of the 6th ring
and the consequent coupling of the decoding section. Now that we have effectively
coupled the signals from the palm device to the decoding section, let's see how the
decoding section performs the decoding function.
DECODING SECTION
44
The input capacitor-zener-resistor network is meant for both the
protection of the DTMF decoder IC 8870 from comparatively higher ring
voltage and the coupling of the signal to the same IC. Based on the
reference DTMF frequencies the DTMF decoder IC 8870 decodes the binary
equivalent of the keys or numbers in the number pad of the transmitting
mobile phones. The decoding scenario of the IC 8870 can be consolidated
as given below.
KEYS Q4 Q3 Q2 Q1
3 Off Off On On
5 O ff On Off On
6 Off On On Off
7 Off On On On
8 On Off Off O ff
9 On Off Off On
0 On Off On Off
* On Off On On
45
# On On Off On
A On On Off On
B On On On Off
C On On On On
The output of the DTMF decoder IC 8870 is binary code, which is then fed to the
binary to decimal decoder IC 74HC154 retrieving the original transmitted key or number.
But the IC 74HC154 has active low output pins. So these active low outputs are
converted to active high ones by passing them through NOT gates. Note that here we are
using only five outputs of IC 74HC154 to control four devices represented by LEDs as
an instance.
Specifically the pins we are using are the 13th pin which produces an active
low corresponding to the code *, the 2nd pin which produces an active low
corresponding to the code 1, the 3rd one for the code 2, the 4th one for the code 3 and
finally the 5th one for the code 4. Thus in the decoding section we retrieve back the same
number or code transmitted from the mobile phone.
Refer the circuit diagram of this section.using the converted active high outputs
of the decoding section we are now supposed to control the TURN OFF and TURN ON
of four LEDs. The output corresponding to the code * from the decoding section is used
to trigger a monostable circuitry in the output section, which is designed to produce a
high pulse at it's output for a period of about 5 seconds. This high pulse
46
with the duration of 5 seconds is used to activate the four tri-state buffers i.e. the ICs
74LS126 enabling the coupling of the respective inputs of the buffers to their respective
outputs. Now with in this 5 second duration we can have our control signals to pass
through the buffers and can be used to control the D flip flops i.e. the ICs 74LS74, which
has been set in the latching mode to get its output toggled upon receiving consequent
clock pulses, thus triggering the turn ON and turn OFF of the devices once the same code
is transmitted for a second time. In a nutshell, the latching mode peration of D flip flops
causes a device to get turn on from off state or vice versa on reception of the code word.
The IC 74LS74 is a positive edge triggered IC. One of the practical limitation we face
here is to create a positive edge at the clock input of the D flip flop IC, using the isolated
pulse coming through the buffer to its output. If we directly apply the pulse to the D flip
flop to work in the latching mode it won't work due to the lack of
establishment of the positive edge to its clock input, resulting from the occurrence of
logic 1 level at the clock input of D flip flop right at the time of biasing or when
connected to the power supply. For this purpose to create a positive edge going from
logic 0 level to logic 1 level we pass the pulse coming out of the buffer through another
NOT gate as shown.
Finally, we need to find out a code which we have to transmit from the mobile
phone so that we can establish a well shaped pulse as clock pulse at the clock input pin of
the D flip flop for it to work in latching mode i.e. to get the LEDs turned on if they were
in the off state and vice versa.
First of all we must activate the buffer in the output section for the predetermined
time by triggering the monostable circuitry there in. So the first symbol in the code word
should be *. Now, we need to transmit a high level through the activated buffer using
another symbol specific to each of the device represented. From the circuit diagram we
can see it can be 1 for the 1st device, 2 for the second one and so on.
Thus by sending *(ordinal number of the device) we can create a low to high
transition at the out of the buffer. But it's not yet been a well defined pulse with both
47
trailing and falling edge. So to get a falling edge we should now send a symbol other than
ordinal number of the device. Let it also be * to have a convenient code. Now, as we
know we use * for triggering the monostable circuitry in the output section we must not
end our code word with *. Other wise, it will cause the triggering input of the monostable
multivibrator to continue in the logic 1 level even after the specified 5
seconds which in turn forces it not to get triggered for a second time on pressing * as
there lacks the transition from low to high level at it's triggering input. Hence we must
end our code word with a symbol other than both * and ordinal number of the device. Let
it be 0. Thus, we got the code word that is to be send for our expected control as * ordinal
number of the device*0. For example, to change the state of first device we have to send
a code-*1*0, for the 2nd one *2*0 etc.
By following the similar logic, it is possible to find some other formats of code
words. For example, the code word * ordinal number of the device 0 is also seeming to
be worthy of.
Thus the whole control procedure can be consolidated as first of all we need to
make a call to the land line, just after the 6th ring it will automatically get on to the OFF
HOOK mode for about 1minutes, during this time we can control the required devices
with code words of specified format with in the installments of 5 seconds.
48
Chapter 7 Keil Software
49
Chapter 8 Source Coding
Source Code:
ORG 0000H
MOV P0,#00H
MOV P2,#00H
SWITCH4 EQU P3.0
SWITCH3 EQU P3.1
SWITCH2 EQU P3.2
50
SWITCH1 EQU P3.3
JB SWITCH1,NEXT1
JNB SWITCH3,LAMP134
JNB SWITCH2,LAMPOFF
SETB LED2 ; BACK MODE
SETB LED3 ; BACK MODE
CLR STOPLED ; STOPLED OFF
CLR LED1
CLR LED4
51
ACALL DELAY
SJMP MAIN
NEXT1:
JB SWITCH3,NEXT2
JNB SWITCH2,RIGHT
SETB LED1 ; FF MODE
SETB LED4 ; FF MODE
CLR STOPLED ; STOP LED
OFF
CLR LED2
CLR LED3
ACALL DELAY
SJMP MAIN
NEXT2:
JB SWITCH2,NEXT3
JNB SWITCH4,STOP
SETB LED4 ; LIFT MODE
CLR STOPLED ; STOP LED OFF
CLR LED1
CLR LED2
CLR LED3
ACALL DELAY
acJMP MAIN
52
NEXT3:
ACALL DELAY
SJMP MAIN
RIGHT:
53
LAMPON:
SETB LED5
ACALL DELAY ; LAMP , CAM NO
LJMP MAIN
LAMPOFF:
CLR LED5 ; LAMP , CAM OFF
ACALL DELAY
LJMP MAIN
JB SWITCH1,NEXT1
JNB SWITCH3,LAMP134
JNB SWITCHDD,LAMPOFF
SETB LED2 ; BACK MODE
SETB LED3 ; BACK MODE
CLR STOPLED ; STOPLED OFF
CLR LED1
CLR LED4
ACALL DELAY
SJMP MAIN
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
DELAYA:
MOV 71H,#0FFH
MOV 72H03H
54
LOOP:
DJNZ 70H,LOOP
DJNZ 71H,LOOP
RET
END
DJNZ 70H,LOOP
DJNZ 71H,LOOP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SOFTWARES:
1. Embedded C
2. Keil IDE
3. Uc-Flash
HARDWARES:
1. Micro controller
2. Power supply
3. DTMF DECODER
4.Appliances
5.Power driver and isolator
CONCLUSION
55
This project presents a dtmf based home appliances controlling. The controller based
on closed loop algorithm is designed and implemented with Atmel MCU in embedded
system the domain.
56
Hence we are controlling 6 home appliances controlling through DTMF technology
effectively. Because now a days GSM technology became very popular,here its very easy to use
for any applications with the help of 8051 controller.In all low end applications now a days we
are using 8051 controllers like industrial automation and data acquisition.
57
Chapter 9 Future Aspects
Future Scope
The controller we used having the following featurtes like 8 bit 8051
architecture in a tiny 20pin DIP package,128B RAM and 4kB on-chip Flash Program Memory.
For low end applications this controller is very easy to use and at the same time GSM also widely
accepted protocol for mobile communication.
In future for small scale systems 8051 controllers can be widely used along with the help
of GSM technology.
REFERENCES
Text Books:
8051 and Embedded systems BY Mazidi
BIBILOGRAPHY
Website:
www.howstuffworks.com
www.answers.com
www.radiotronix.com
MAGZINES:
Electronics for you
Electrikindia
Let us Go Wireless
58
APPENDIX
2051 Microcontroller:
59
Low-power Idle and Power-down Modes
2051 Pin-out and Description
Pin Description
Pin Name:
Purpose:
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.
60
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 below:
Port 3 also receives some control signals for Flash programming and verification.
61
RST
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
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
62
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.
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.
63
BLOCK DIAGRAM OF 2051
64
Power-down Mode
65
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
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.
66
67