Home Automation Project Report
Home Automation Project Report
Home Automation Project Report
CONTROL
The home automation is one of the most emerging trends in modernization of home
appliance control. Presently, conventional wall switches are located in different parts
of the house and one has to physically go near them and press them to turn the loads
on/off. The problem arises when user is out of the premises; in that case controlling
the home appliances becomes impossible. The project aims at developing a system
that can overcome this limitation of today’s electricity system. Growing consumption
of electricity and wastage of electricity can be checked with this system
Using Dual Tone Multiple Frequency signaling the range of home automation system
can be effectively increased beyond the periphery of premises. Wide use of DTMF
signaling in conventional telephone networks allows us to use Telephone Networks
for accessing home automation system from almost any location around the globe.
The system developed in this project is aimed at exploiting this utility of telephone
networks.
The system can provide access to home automation system from any place, where any
type telephone coverage is possible. The system is protected by a password interface
to prevent unauthorized access. Whenever user makes a call to system, he has to enter
a password to activate the system then by dialing designated number of the appliance
to be operated he can check the status of device and can switch on/off the device.
DTMF decoder makes it possible to decode a DTMF signal to a BCD code which can
be used to provide different functioning for different signals. The acknowledgment for
the change in status of the device is provided through a buzzer. The system saves the
status of the devices in an EEPROM to avoid resetting of system in case of power
failure.
The system provides advantages as overcoming the limited range of Infrared and
other radio frequency type remote control. The other advantages provided by the
system are Ease of Access, Portability, low power consumption. The system is highly
useful for premises involving high power consumption appliances and thereby
checking electricity wastage. The system requires low maintenance and is quite robust
against power fail
ii
TABLE OF CONTENTS
Declaration ii
Certificate iii
Acknowledgements iv
Abstract v
List of tables ix
List of figures x
List of Abbreviations xii
Chapter 1. Introduction 1-4
1.1 Introduction 1
1.2 Project idea 2
1.3 Objective 3
1.4 Organization of the report 4
Chapter 2. Working of the project 5-13
2.1 Working Principle 5
2.2 Block diagram description 6
2.2.1 DTMF Decoder Section 7
2.2.2 Microcontroller and ROM Section 8
2.2.3 Power Supply Section 9
2.2.4 Load and Relay Section 10
2.3 Circuit Diagram of proposed Project 10
2.4 PCB layout of finalized circuit 12
2.4.1 PCB Layout of MCU 12
2.4.2 PCB Layout of power circuit 12
2.4.3 PCB Layout of finalized circuit 13
CHAPTER 3 HARDWARE SPECIFICATIONS 14-44
3.1 89C51(8051 family microcontroller) 14
3.1.1 Different Microcontrollers in market 14
3.1.2 Architecture 15
3.1.3 Execution Time 16
3.1.4 Key Features 16
3.1.5 PIN Diagram 18
iii
3.1.6 Instructions 20
3.1.7 Registers 23
3.2 Memory Interface 26
3.2.1 PIN Diagram 27
3.2.2 PINS 28
3.2.3 Monitoring acknowledgement unit 31
3.2.4 STOP Condition 32
3.2.5 Clocking 32
3.2.6 Byte Write/Read Operations at a glance 33
3.3 Power Supply 34
3.3.1 Power Supply Components 34
3.3.2 Power Supply Diagram 36
3.3.3 Crystal Oscillator 36
3.4 Relays 37
3.4.1 Types of Relays 37
3.4.2 Electromagnetic Relay 37
3.5 IC 8870 DTMF(Dual Tone Multi Frequency) 38
3.5.1 Features 39
3.5.2 CM8870IC 39
3.5.3 Applications 39
3.5.4 Block Diagram 40
CHAPTER 4-SOFTWARE SPECIFICATIONS 45-60
4.1 Sprint Layout5.0 45
4.1.1 Features 45
4.2 Keil C Cross Compiler 47
4.3 Program 48
4.4 MultiSim 60
CHAPTER 5-RESULT 61-62
CHAPTER 6-FUTURE SCOPE 63-66
6.1 Future of Home Automation 64
iv
Appendices
Appendix A. Software Methodology (Working with Keil) 67-73
A.1 Working with Keil 67
A.1.1 Target Selection 68
A.1.2 Include Header File 70
A.1.3 Building Target 71
v
LIST OF TABLES
vi
LIST OF FIGURES
vii
Fig 3.18 Crystal Oscillator 36
Fig 3.19 Fig Relay Mechanism 38
Fig. 3.20 DTMF Keypad 38
Fig.3.21 Block diagram of inside circuitry of DTMF decoder 40
Fig 3.22 Clock Circuitry 43
Fig 4.1 Designing of PCB layout in Sprint Layout5.0 46
Fig 4.2 Simulation of power supply using multisim 60
Fig 5.1 Complete picture of working project 62
Fig 5.2 PCB of working Project 62
Fig 6.1Future Enhancements in home automation 65
Fig 6.2 Home Automation in different ways 66
viii
LIST OF ABBREVIATIONS
ix
CHAPTER-1
INTRODUCTION
Imagine how helpful it will be to be able to switch on your air conditioning system ten
minutes before you get home on a hot afternoon in June. How about having a security
system that will detect smoke, excessive electrical power usage, burglar attempts and
unauthorized movements in your house and alert you? This is what home automation
is about and there is no end to its application. In fact, sophisticated home automation
systems are now being developed that can maintain an inventory of household items,
record their usage through an RFID (Radio Frequency Identification) tag, and prepare
a shopping list or automatically order replacements.
Home automation has made it possible to have what is often referred to as a 'smart
home', a home that can detect and identify you, automatically adjust the lighting to
your predefined taste, open doors automatically, play your favorite music, water your
flowers in the morning, switch on the security lights at night and switch them off in
the morning, heat water for bathe and tea, stream to you anywhere in the world via the
internet a live video of what is happening in and around your house. It makes it
possible to link lighting, entertainment, security, telecommunications, heating, and air
conditioning into one centrally controlled system. This allows you to make your
house an active partner in managing your busy life.
Now a day, you can hardly find a house without a home automation system which can
range from the remote for the television, burglar alarm and hi-tech security gates, to
an automated air conditioning system that maintains the temperature at a predefined
value.
1
1.2 PROJECT IDEA
Automation plays an increasingly important role in the global economy and in daily
experience. Engineers strive to combine automated devices with mathematical and
organizational tools to create complex systems for a rapidly expanding range of
applications and human activities. Many roles for humans in industrial processes
presently lie beyond the scope of automation. Human-level pattern recognition,
language recognition, and language production ability are well beyond the capabilities
of modern mechanical and computer systems. Tasks requiring subjective assessment
or synthesis of complex sensory data, such as scents and sounds, as well as high-level
tasks such as strategic planning, currently require human expertise.
Automation has had a notable impact in a wide range of highly visible industries
beyond manufacturing. Once ubiquitous telephone operators have been replaced
largely by automated telephone switchboards and answering machines, medical
processes such as primary screening in electrocardiograph or radiography and
laboratory analysis of human genes, blood plasmas, cells, and tissues are carried out at
much greater speed and accuracy by automated systems. Automated teller machines
have reduced the need for bank visits to obtain cash and carry out transactions. In
general, automation has been responsible for the shift in the world economy from
agrarian to industrial in the 19th century and from industrial to services in the 20th
century.
2
1.2.2 Office Automation
Office automation refers to the varied computer machinery and software used to
digitally create, collect, store, manipulate, and relay office information needed for
accomplishing basic tasks and goals. Raw data storage, electronic transfer, and the
management of electronic business information comprise the basic activities of an
office automation system, office automation helps in optimizing or automating
existing office procedures.
1.3 OBJECTIVE
The objective of this project is to implement a low cost, reliable and scalable home
automation system that can be used to remotely switch on or off any household
3
appliance, using a microcontroller to achieve hardware simplicity, low cost
piezoelectric buzzer for feedback and voice dial from any phone to toggle the switch
state. This project work is complete on its own in remotely and automatically
switching on and off of any electrical appliance not limited to household appliances,
and sends a feedback message indicating the new present state of the appliance. It
does not implement control of multiple appliances or automatic detection of faults in
the controlled appliance. This project is of contributory knowledge to the
development and implementation of home automation systems in Nigeria using low
cost, locally available components like microcontroller.
The presented report is organized in the form of chapters which describe about
different aspect of our project starting from the introduction which gives small insight
of the project along with the motivation for us behind developing our project and the
objective of the project. The second chapter describes in detail the working of project
with the help of block diagram and PCB layout whereas the third and fourth chapters
of this report deals with the description of hardware components used and the
software(s) used along with the programming of microcontroller.
4
CHAPTER-2
In this project, we show that how we can control electrical appliances with the help
of DTMF control and at the same time we can get a acknowledgement through voice
response system or piezoelectric buzzer.
In this project we use 89S52 controller to control all electrical appliances. Along with
89S52 controller we use CM 8870 DTMF decoder to decode DTMF tones from hands
free kit. We use piezoelectric buzzer for voice playback. Infra red eye sensor can
also be used to control electrical appliances via remote also.
One GSM base phone is connected with the DTMF decoder with hands free kit. We
cut the hands free speaker and cut the wires with the DTMF decoder. First of all we
dial the number connected with the circuit. Mobile phone is automatic shifted auto
answer mode. Auto answer mode setting is done with the enhancement setting of the
main setting.
Suppose a user calls the mobile phone interfaced with the home automation system.
For security purposes project is implemented with password protection mechanism. In
this case, user is asked for the password for gaining access to the home automation
system. In our case password is *8870 .When user dials these numbers , user hears
three beeps, that means user has accessed the home automation system. Now suppose
the user dials number ‘1’ (there is different tones for different keys on the mobile
handset) ,As a result these tones are decoded by the DTMF decoder also called as
Dual Tone Multi frequency signaling. Therefore different signal levels are achieved
by pressing on different keys.
5
The number ‘1’ pressed by the user is used by the DTMF decoder to achieve
particular signal level. This signal level is then processed by the microcontroller to
give the status of the appliance at number 1.
In this project we get 3 beeps if the appliances are in “OFF” state and two beeps if the
appliance is in “ON” state. To select a device we press *1 and user gets the response
whether the appliance is in OFF state or ON state. To turn OFF the appliance the user
presses and for switching it on user presses followed by the beeps of the respective
ON and OFF beeps. In case of power failure, the previous states of the electrical
appliances are preserved by interfacing an EEPROM that saves the statuses of various
loads.
The above block diagram shows the basic model for the DTMF decoder and its power
supply. The tracker is divided into four modules which are:
6
2) Microcontroller and ROM section
3) Power Supply Section
4) Load and relay Section
Every module has its own separate set of inputs and outputs which either are used for
controlling or for facilitating the decision making of next module. Now we will
discuss separately each and every module of the Home Automation System.
Features
• Full DTMF receiver
• Less than 35mW power consumption
• Industrial temperature range
• Uses quartz crystal or ceramic resonators
• Adjustable acquisition and release times.
7
2.2.2 Microcontroller and ROM section
Reset Circuitry
This is not a big circuit we are just using a capacitor to charge the microcontroller and
again discharging via resistor.
8
The speed with which a microcontroller executes instructions is determined by what is
known as the crystal speed. A crystal is a component connected externally to the
microcontroller. The crystal has different values, and some of the used values are
6MHZ, 10MHZ, and 11.059 MHz etc. Thus a 10MHZ crystal would pulse at the rate
of 10,000,000 times per second. The time is calculated using the formula No of
cycles per second = Crystal frequency in HZ / 12. For a 10MHZ crystal the number of
cycles would be, 10,000,000/12=833333.33333 cycles. This means that in one
second, the microcontroller would execute 833333.33333 cycles
9
2.2.4 Load and relay Section
In order to enable a circuit to be isolated from the system only under faulty
conditions, protective relays are used. In normal cases, it is open circuit relay. The
relay is usually provided with 4 terminals, two of which are connected to relay
winding and other two are connected to the circuit to be controlled. It has following
characteristics:
Sensitivity
Speed
Selectivity
These relays are electromagnetically operated. The parts of these relays are an iron
core & its surrounding coil of wire. An iron yoke provides a low reluctance path for
magnetic flux, the yoke being shaped so that the magnetic circuit can be closed by a
movable piece of iron called the armature, and a set of contacts
CM8870 decode the DTMF tones on pin no 2,3 via RC circuit. One crystal is
connected to the pin no 7,8 of the decoder . 8870 provide a 4 digit binary output on
pin no 11,12,13,14 of the IC. This output is connected to the microcontroller port 1
(pin no 1, 2, 3, 4). Pin no 40 of the controller is connected to the positive 5 volt
supply. We get this supply from the step down transformer with rectifier circuit and.
microcontroller get this signal and compare inside the controller. The 4 pins such as
11,12,13,14 of DTMF decoder are connected and are sent in digital form to 89C51
microcontroller. The microcontroller contains a password for security purposes, in
10
this project we are having password *8870 that is used to compare with the numbers
associated with bit levels coming from DTMF decoder.
The circuit diagram of the whole working project is shown in the following figure
11
2.4 PCB LAYOUT OF THE FINALIZED CIRCUIT
This section includes various PCB layouts of various sections of project. Given below
contains the snapshots of microcontroller section, power supply section and the
finalized circuit. These are drawn using software called Sprint Layout5.0.
This snapshot shows the microcontroller section that consists of 40 pins (89C51) and
layout is drawn in accordance with circuit diagram shown in figure 2.8. The software
has an option called ‘Track’. The above figure that shows different lines are called as
tracks. The thickness of the track can be adjusted in accordance with the PCB area.
12
This snapshot can be referred to as the power supply section of the project. The gaps
shown in snapshot between various tracks drawn are given for various ICs such as
voltage regulator, resistors and capacitors that filter AC component coming from
Step down transformer.
Using the method explained above, a fully PCB layout can be realised which is in
accordance with the circuit diagram as shown in figure 2.8
13
CHAPTER-3
HARDWARE SPECIFICATIONS
14
INTEL: These are the first to manufacture microcontrollers. These are not as
sophisticated other microcontrollers but still the easiest one to learn.
ATMEL: Atmel’s AVR microcontrollers are one of the most powerful in the
embedded industry. This is the only microcontroller having 1kb of ram even
the entry stage. But it is unfortunate that in India we are unable to find this
kind of microcontroller.
3.1.2 Architecture
15
3.1.3 Execution time
This instructs the microcontroller to put a value of ‘one’ in bit zero of port one.
Don’t worry about what bit zero and port one means. We shall learn it in more detail
as we proceed. They are a set of well defined instructions, which are used while
communicating with the microcontroller. Each of these instructions requires a
standard number of cycles to execute. The cycle could be one or more in number.
Most of the transactions within the microcontroller are carried out through the ‘A’
register, also known as the Accumulator. In addition all arithmetic functions are
carried out generally in the ‘A’ register. There is another register known as the ‘B’
register, which is used exclusively for multiplication and division. Thus an 8-bit
notation would indicate that the maximum value that can be input into these registers
is ‘11111111’.The value is not decimal 111, 11,111. It represents a binary number,
having an equivalent value of ‘FF’ in Hexadecimal and a value of 255 in decimal.
Once you have written out the instructions for the microcontroller, where do you put
these instructions. Obviously you would like these instructions to be safe, and not get
deleted or changed during execution. Hence you would load it into the ‘ROM’
The size of the program you write is bound to vary depending on the application, and
the number of lines. The 8051 microcontroller gives you space to load up to 4K of
program size into the internal ROM. 4K, that’s all? Well just wait. You would be
16
surprised at the amount of stuff you can load in this 4K of space. Of course you could
always extend the space by connecting to 64K of external ROM if required.
This is the space provided for executing the program in terms of moving data, storing
data etc.
(iv) 32 I/O lines. (Four- 8 bit ports, labeled P0, P1, P2, P3)
Port one would have 8 bits. There are a total of four ports named p0, p1, p2, p3,
giving a total of 32 lines. These lines can be used both as input or output.
The 8051 microcontroller is capable of communicating with external devices like the
PC etc. Here data is sent in the form of bytes, at predefined speeds, also known as
baud rates. The transmission is serial, in the sense, one bit at a time. .
(vii) Interrupt sources with two priority levels (Two external and three internal)
During the discussion on the timers, we had indicated that the timers can trigger a
branch in the main program. However, what would we do in case we would like the
microcontroller to take the branch, and then return back to the main program, without
having to constantly check whether the required time / count has been reached?
This is where the interrupts come into play. These can be set to either the timers, or to
some external events. Whenever the background program has reached the required
17
criteria in terms of time or count or an external event, the branch is taken, and on
completion of the branch, the control returns to the main program.
Priority levels indicate which interrupt is more important, and needs to be executed
first in case two interrupts occur at the same time..
This represents the oscillator circuits within the microcontroller. Thus the hardware is
reduced to just simply connecting an external crystal, to achieve the required pulsing
rate.
XTAL: is connected to the pin no 18 and pin no 19 of this IC. The quartz
crystal oscillator connected to XTAL1 and XTAL2 PIN. These pins also need
two capacitors of 30 pf value. One side of each capacitor is connected to
18
crystal and other pins are connected to the ground point. Normally we connect
a 12 MHz or 11.0592 MHz crystal with this IC. But we use crystal up to 20
MHz to these pins.
RESET PIN: Pin no 9 is the reset pin of this IC. It is an active high pin. On
applying a high pulse to this pin, the micro controller will reset and terminate
all activities. This is often referred to as a power on reset. The high pulse must
be high for a minimum of 2 machine cycles before it is allowed to go low.
PORT1: ALL the ports in microcontroller are 8 bit wide pin no 1 to pin no 8
because it is a 8 bit controller. All the main register and sfr all is mainly 8 bit
wide. Port 1 is also occupies a 8 pins. But there is no need of pull up resistor in
this port. Upon reset port 1 act as a input port. Upon reset all the ports act as a
input port
PORT2: Port 2 also has 8 pins. It can be used as a input or output. There is no
need of any pull up resistor to this pin.
PORT 3: Port3 occupies a total 8 pins from pin no 10 to pin no 17. It can be
used as input or output. Port 3 does not require any pull up resistor. The same
as port 1 and port2. Port 3 is configured as an output port on reset. Port 3 has
the additional function of providing some important signals such as interrupts.
Port 3 also use for serial communication.
ALE: ALE is an output pin and is active high. When connecting an 8031 to
external memory, port 0 provides both address and data. In other words, the
8031 multiplexes address and data through port 0 to save pins. The ALE pin is
19
used for de multiplexing the address and data by connecting to the IC 74ls373
chip.
PSEN: PSEN stands for program store enable. In an 8031 based system in
which an external ROM holds the program code, this pin is connected to the
OE pin of the rom.
EA. In 89c51 8751 or any other family member of the Atmel 89c51 series all
come with on-chip ROM to store programs, in such cases the EA pin is
connected to the VCC. For family member 8031 and 8032 is which there is no
on chip ROM, code is stored in external memory and this is fetched by 8031.
In that case EA pin must be connected to GND pin to indicate that the code is
stored externally.
3.1.6 Instructions
MOV instruction simply copy the data from one location to another location
20
MOV R5, #0F9H Load the F9 value in the Register R5
ADD instructions adds the source byte to the accumulator ( A) and place the result in
the accumulator.
MOV A, #25H
ADD A,#42H: By this instructions we add the value 42h in Accumulator
(42H+ 25H)
ADDA, R3: By this instructions we move the data from register r3 to
accumulator and then add the contents of the register into
accumulator .
ACALL is a limit for the 2 K byte program counter, but for up to 64k byte we use
LCALL instructions. Note that LCALL is a 3 byte instruction while ACALL is a two
byte instruction.
21
(ii) RRA
By this instruction we rotate the contents of the accumulator from right to left from
LSB to MSB.
(iii) RRC A
This is same as RR A but difference is that the bit rotated out of register first enter in
to carry and then enter into MSB
(v) RET
This is return from subroutine. This instruction is used to return from a subroutine
previously entered by instructions LCALL and ACALL.
(vi) RET1
This is used at the end of an interrupt service routine. We use this instruction after
interrupt routine.
(vii) PUSH
This copies the indicated byte onto the stack and increments SP. This instruction
supports only direct addressing mode.
This copies the byte pointed to be SP to the location whose direct address is indicated,
and decrements SP by 1. Notice that this instructions supports only direct addressing
mode.
8) DPTR INSTRUCTIONS
This instructions load the 16 bit DPTR register with a 16 bit immediate value
22
(ii) MOVC A,@A+PC
This instructions moves a byte of data located in the program area to A. the address of
the desired byte of data is formed by adding the program counter ( PC) register to the
original value of the accumulator.
INC A
INC R
INC DIRECT
DEC BYTE
This instruction subtracts 1 from the byte operand. Note that CY is unchanged
DEC A
DEC R
DEC DIRECT
3.1.7 Registers:
(i) PCON Register:
There are two ways to increase the baud rate of data transfer in the 8051
To use a higher frequency crystal
To change a bit in the PCON register
PCON register is an 8 bit register . Of the 8 bits, some are unused, and some are used
for the power control capability of the 8051. The bit which is used for the serial
communication is D7, the SMOD bit. When the 8051 is powered up, D7 ( SMOD
23
BIT) OF PCON register is zero. We can set it to high by software and thereby
double the baud rate.
If the bit is 0, the corresponding interrupt has a lower priority and if the bit is 1 the
corresponding interrupt has a higher priority
IP.7 Not implemented reserved for future use
IP.6 Not implemented reserved for future use
PT2 IP.5 Define the timer 2 interrupt priority level.
PS IP.4 Define the serial port interrupt priority level.
PT1 IP.3 Define the timer 1 interrupt priority level.
PX1 IP.2 Define the external interrupt 1 priority level.
24
PT0 IP.1 Define the timer 0 interrupt priority level.
PX0 IP.0 Define the external interrupt 0 priority level.
25
counter 1 On/off
TF0 TCON.5 Timer 0 overflow flag. Set by hardware when the timer/counter
overflows, cleared by hardware as processor.
TR0 TCON.4 Timer 0 run control bit. Set/cleared by software to turn timer
counter 0 on/off.
IE1 TCON.3 External interrupt 1 edge flag
ITI TCON.2 Interrupt 1 type control bit
IE0 TCON.1 External interrupt 0 edge
IT0 TCON.0 Interrupt 0 type control bit.
A total of eight EEPROMs can be connected through a bus. There are three address
pins in AT24C02 for selecting a particular chip. The device can be addressed serially
by the software. It makes use of an internal register of the EEPROM whose 4 MSB
bits are 1010, the next three are the EEPROM address bits and the LSB signifies
whether data is to be read or written. This last bit is 1 for write and 0 for read
operation. For example, if in an EEPROM all address bits are grounded, then for write
operation a hex value 0xA1 (1010 0001) will be sent. Here 000, in last bits, addresses
the EEPROM and 1 in LSB indicates a write operation. Similarly for read operation
the device address to be sent is 0xA0 (1010 0000).
26
Next, the byte or page address is sent followed by the data byte. This data byte is to be
written on or read by the microcontroller.
27
EEPROM stands for electrically erasable programmable read only memory. It is a
secondary storage device that once written (programmed) can hold data even when
the power is removed. The EEPROM is a class of read only memory that can be
electrically erased and reprogrammed.
AT24C02 is a two wire 2Kbits serial EEPROM by Atmel. The memory is organized
in 256 words of single byte each arranged in 32 pages of 8 bytes each. The addressing
of memory locations requires eight bit addresses.
AT24C02 is two-wire serially programmable i.e., for programming, the data and
control signals are provided serially along with clock signals from the other wire. The
read-write operations are accomplished by sending a set of control signals including
the address and/or data bits. The control signals must be accompanied with proper
clock signals.
The AT24C02 has hard wire addressing of 3 bit length. This facilitates interfacing of
a maximum of eight (23) 24C02 devices to a system thereby, incorporating a
maximum 16Kbits memory. Multiple 24C02 devices can be connected to a
microcontroller/microprocessor based system using I2C interface. The project
demonstrates interfacing of a single 24C02 IC with AT89C51 (8051) microcontroller.
The microcontroller is programmed to perform write operation of a single byte and
read the same. The byte written and read is displayed on a LCD display. Of the two
wire serial EEPROMs from ATMEL, 24C02 is one of them and comes in different
packages. No matter what the package type, following are the pins of 24C02 IC
3.2.2 Pins:
(i) A0-A2: Pins 1-3 are the address pins. Since multiple 24C02 and other similar
devices can be connected to a system, they require addressing. These devices are hard
wire addressed i.e. the address pins are permanently grounded and/or connected to
Vcc. It is notable that in other two-wire serial EEPROMs from Atmel, all the address
pins may not be used. In this circuit all address pins are grounded, so the device will
have an address 000.(ii) WP: Pin7 is the Write Protect pin. When it is kept low
(ground), normal read and write operations are allowed. When it is given a high,
24C02 is protected from any write operation. In the circuit WP pin has been grounded
to allow write operation.
28
(iii) VCC: A 5V DC supply is required to power the AT24C02. This is same as the
power supply of the microcontroller. So a separate supply to power 24C02 is not
required.
(v) SDA: Pin5 is serial data pin. The data and control bits are read and write serially
from this bidirectional pin.
(vi) SCL: Pin6 is serial clock pin. A clock signal is required every time a bit is
transferred to or from the SDA pin. A positive edge clock, i.e., a low to high, transfers
data to the EEPROM and a negative edge trigger, i.e., a high to low, carries data
from the EEPROM. In the circuit SDA and SCL are connected to bits 0 and 1 of port
P1, respectively. The data pins of the LCD are connected to port 2 of the
microcontroller. The RS, RW and enable pins of the LCD are interfaced to bit 0, 1
and 6 of port P3, respectively.
As many 24C02 devices can be used in a system using a two wire serial (I2C)
interface. The controller needs to send a device address to select a particular 24C02
device. Also whether a read or write operation is to be done must be specified. This is
done by device addressing.
Since 24C02 devices understand 8 bit words the device addresses are also single byte
long. The first four MSBs are a fixed sequence of high and low (1010). The next three
bits are the device address bits which must match with the hard wire address of the
24C02 device. The LSB specifies whether a write or read operation is to be done. If
this bit is high (1), a read operation is initiated; and if it is low (0), write is initiated.
Any read or write operation in 24C02 requires a sequence of interaction with the
controller. This involves the following steps:
29
Fig 3.6 Device addressing scheme of memory Interface
1) Start condition:
Any read or write operation in EEPROM is initiated by Start condition. This occurs
when there is a high to low transition of SDA while SCL is high. (Refer the following
diagram) This tells the EEPROM that words from the controller are ready for it. SCL
is set low at the end of start condition. This is because any read or write operation first
involves transfer of some words to EEPROM. That requires a low to high transition of
clock corresponding to each bit of the word
30
2) Transfer a bit of a word to/from EEPROM:
First of all, it must be noted that transferring a bit to/from EEPROM is not the same as
write/read operation and so they should not be confused with each other. A read or
write operation is the whole process that takes place only after a start condition and
before stop condition. Transfer of bits to/from an EEPROM is a part of transferring 8
bit word(s) in between the start and stop conditions because every byte is transferred
serially bit by bit.
SDA is normally pulled high by the device it is interfaced with. When SCL is high the
signal changes (H-L or L-H) at SDA are considered as start or stop condition. A low
to high transition at SCL transfers a bit to the EEPROM, i.e., at a low to high
transition of SCL, SDA pin of EEPROM behaves as input for bits of word(s). If the
data changes when the SCL is high, it will be misinterpreted as start or stop condition.
31
acknowledgement bit by sending a high to low transition at SCL. Acknowledgement
bit must be checked every time a word is sent to the EEPROM.
A sequential transfer of words from/to the EEPROM constitutes the read/write. Thus
any read or write operation supported by the EEPROM can be accomplished by
sending and/or receiving a sequence of words to/from the EEPROM. There is a fixed
set of words which need to be sent to and/or received by the EEPROM corresponding
to each read and write operation.
3.2.5 Clocking:
32
can receive its acknowledgement. Clock is just a high transition followed by a low
transition of SCL when the initial clock signal is low.
33
3.3 POWER SUPPLY:
In this project power supplies with +5V & -5V option normally +5V is enough for
total circuit. Another supply is used in case of OP amp circuit .Transformer primary
side has 230/50HZ AC voltage whereas at the secondary winding the voltage is step
downed to 12/50hz and this voltage is rectified using two full wave rectifiers .The
rectified output is given to a filter circuit to filter the unwanted ac in the signal After
that the output is again applied to a regulator LM7805 (to provide +5v) regulator.
WhereasLM7805 is for providing 5V regulation.
A step down transformer is used to convert 230V 50HZ line voltage 12V ac input to
the supply pin of the circuit. The ac voltage is converted to pulsated dc using a center
tapped full wave rectifier.
Any ripples if present are eliminated using a capacitive filter at the output of the full
wave rectifier.
The capacitive filter output is input to LM 7805(voltage regulator), which produces a
dc equivalent of ac 5V. This 5V dc acts as VCC to the micro controller.
34
2) Diode
In this project we use IN 4007 diode as a rectifier. IN 4007 is special diode to convert
the AC into DC.
In this project we use two diode as a rectifier. Here we use full wave rectifier. Output
of rectifier is pulsating DC. To convert the pulsating dc into smooth dc we use
electrolytic capacitor as a main filter. Capacitor converts the pulsating dc into smooth
dc and this DC is connected to the regulator circuit for regulated 5 volt DC.
35
3.3.2 Power Supply Block diagram
3.4 RELAYS
In order to enable a circuit to be isolated from the system only under faulty
conditions, protective relays are used. In normal cases, it is open circuit relay. The
relay is usually provided with 4 terminals, two of which are connected to relay
winding and other two are connected to the circuit to be controlled. It has following
characteristics:
Sensitivity
Speed
Selectivity
37
close a connection to a previously open contact. When electric power is removed from
the relay coil, spring returns the armature to its original position.
Standard voltages for D.C. relay are 6,12,24,48 & 110 volts and for A.C. relays are
6,12,24,48,120 & 240 volts.
38
The earliest of these were for in-band signaling between switching centers, where
long-distance telephone operators used a 16-digit keypad to input 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
operator.
3.5.1 Features
• Full DTMF receiver
• Less than 35mW power consumption
• Industrial temperature range
• Uses quartz crystal or ceramic resonators
• Adjustable acquisition and release times
3.5.2 CM8870IC
Power down mode
Inhibit mode
Buffered OSC3 output (PLCC package only)
CM8870C is fully compatible with CM8870 for 18-pin devices by grounding
pin 5 and pin 6.
3.5.3 Applications
• PABX
• Central office
• Mobile radio
• Remote control
• Remote data entry
• Call limiting
• Telephone answering systems
• Paging systems
39
The CAMD CM8870/70C provides full DTMF receiver capability by integrating both
the band-split filter and digital decoder functions into a single 18-pin DIP, SOIC, or
20-pin PLCC package. The CM8870/70C is manufactured using state-of-the-art
CMOS process technology for low power consumption (35mW, MAX) and precise
data handling. The filter section uses a switched capacitor technique for both high and
low group filters and dial tone rejection. The CM8870/70C decoder uses digital
counting techniques for the detection and decoding of all 16 DTMF tone pairs into a
4-bit code. This DTMF receiver minimizes external component count by providing an
on-chip differential input amplifier, clock generator, and a latched three-state interface
bus. The on-chip clock generator requires only a low cost TV crystal or ceramic
resonator as an external component.
The CAMD CM8870/70C DTMF Integrated Receiver provides the design engineer
with not only low power consumption, but high performance in a small 18-pin DIP,
SOIC, or 20-pin PLCC package configuration. The CM8870/70C’s internal
architecture consists of a band-split filter section which separates the high and low
tones of the received pair, followed by a digital decode (counting) section which
verifies both the frequency and duration of the received tones before passing the
resultant 4-bit code to the output bus.
40
(i) Filter Section
Separation of the low-group and high-group tones is achieved by applying the dual-
tone signal to the inputs of two 9th-order switched capacitor bandpass filters. The
bandwidths of these filters correspond to the bands enclosing the low-group and high-
group tones (See Figure 3). The filter section also incorporates notches at 350Hz and
440Hz which provides excellent dial tone rejection. Each filter output is followed by a
single order switched capacitor section which smoothes the signals prior to limiting.
Signal limiting is performed by high-gain comparators. These comparators are
provided with a hysteresis to prevent detection of unwanted low-level signals and
noise. The outputs of the comparators provide full-rail logic swings at the frequencies
of the incoming tones.
43
Table 3.3 PIN Functions
44
CHAPTER 4
SOFTWARE SPECIFICATIONS
Sprint-Layout offers all needed functions to design your own layouts. Of course, there
is an extensive library with all common components included. For manufacturing
your PCB’s by hand, there is an excellent printout-procedure with many options
available. If you want to produce professional boards, there are many PCB-
manufacturer, which accept Sprint-Layout files. If required, you can export your
layout to the GERBER and EXCELLON format. Sprint-Layout is also able to create
HPGL files for isolation-milling.. Sprint-Layout is equipped with tools to draw pads,
tracks, copper areas, labels and so on. Just select the corresponding mode and place
your elements. All parameter like track-width, pad-size, etc. are always visible at a
glance, and can be edited every time. The active grid-capture lets you easily place
your elements exactly.
You can edit existing layout-elements very easy. For example if you adjust the width
of a track, you will see the result immediately on your layout. Additional functions
like copy, move, rotate, mirror, etc. are self evident.
4.1.1 Features:
(i) Component-library: Components which you have drawn once, can be added to the
component-library. The component-library is already filled with many common used
45
components. So you don’t have to create them again. You can easily drag &drop the
components from the library to your layout. After that you can mirror, rotate or label
them like you want.
(ii) Free rotating: You can rotate all components or elements in any angle. This makes
it possible to place your components in the best manner.
(iii) Automatic Ground-Plane: This function fills unused areas of a layout with copper
automatically. This accelerates the corroding process and saves corroding material.
You may also use this function to create a screen for HF-boards You can also define
thermal-pads on the automatic ground-plane.
(iv) The Photo view: The photo view lets you take a look at your board as if it was
already manufactured, with drillings, silk screen, etc. This helps you to find typically
mistakes like wrong mirrored components or text.
(v) Test-function: This function is very helpful to check your layout. You can click on
any position of your layout, and Sprint-Layout will find all connected layout-
elements, and light them up.
46
4.2 KEIL C CROSS COMPILER
Keil is a German based Software development company. It provides several
development tools like
• IDE (Integrated Development environment)
• Project Manager
• Simulator
• Debugger
• C Cross Compiler , Cross Assembler, Locator/Linker
Keil Software provides you with software development tools for the 8051 family of
microcontrollers. With these tools, you can generate embedded applications for the
multitude of 8051 derivatives. Keil provides following tools for 8051 development
The Keil 8051 tool kit includes three main tools, assembler, compiler and linker.
An assembler is used to assemble your 8051 assembly program.
A compiler is used to compile your C source code into an object file.
A linker is used to create an absolute object module suitable for your in-circuit
emulator.
47
5. Test linked application.
4.3 PROGRAM
#include<reg51.h>
#define dataport P0 //lcd 16x2 data port
#define cont_port P2
// Crystal 11.0592Mhz
sbit rs = cont_port^7; //lcd rd pin @ P2_0
sbit en = cont_port^6; //lcd en pin @ P2_2
sbit input = P3^3; //ir pin connected to Port3_3
bit row4=1;
bit outside=1;
sbit light1=P2^0;
sbit light2=P2^1;
sbit light3=P2^2;
sbit light4=P2^3;
sbit light5=P2^4;
sbit light6=P2^5;
sbit light7=P2^6;
sbit light8=P2^7;
sbit light9=P0^7;
sbit light0=P0^6;
sbit d0=P1^3;
sbit d1=P1^2;
sbit d2=P1^1;
sbit d3=P1^0;
sbit type_pass = P1^4;
sbit corr_pass = P1^5;
sbit incr_pass = P1^6;
sbit device_on = P1^7;
sbit device_of = P3^0;
sbit green = P0^4;
sbit red = P0^5;
48
sbit ack=P3^7;
int i;
int cmd,add,flip,val,val1,nflip;
void delay1() { //delay of 3.024msec
TMOD=1;
TL0=0x1E;
TH0=0xF0;
TR0=1;
TR0=0;
TF0=0;
}
void delay() {//delay of 1.658msec
TMOD=1;
TL0=0x07;
TH0=0xFA;
TR0=1;
while(TF0 == 0);
TR0=0;
TF0=0; }
void mdelay(int msec) {
while(msec != 0) {
TMOD=1;
TL0=0x1D;
TH0=0xF5;
TR0=1;
while(TF0 == 0);
TR0=0;
TF0=0;
msec--;
}}
void tog() {//calculate flip bit
flip=input;
void address() { //calculate the address
49
for(i=0; i<5; i++) {
add=(add<<1) | input;
delay();
}}
val=cmd;
// val=val*10+cmd;
else {
return;
}}
void IR();
void dtmf();
void password();
void main() {
green=0;
red=1;
while(1){
if(input==0)
IR();
if(ack==0)
password();}}
void dtmf(){
char sec1=0;
int rec1;
50
while(sec1<100){
rec1=30000;
while(ack==1){
rec1--;
if(rec1==0 && ack==1)
break;}
sec1++;
if(d0==1&&d1==0&&d2==0&&d3==0&&ack==0){
light1=~light1;
if(light1==0){
device_on=0;
mdelay(100);
device_on=1;
mdelay(300);
}
else{
device_of=0;
mdelay(100);
device_of=1;
mdelay(300);
}
sec1=0;
}
else if(d0==0&&d1==1&&d2==0&&d3==0&&ack==0){
light2=~light2;
if(light2==0){
device_on=0;
mdelay(100);
device_on=1;
mdelay(300);
}
else{
device_of=0;
}
51
sec1=0;
}
else if(d0==1&&d1==1&&d2==0&&d3==0&&ack==0){
light3=~light3;
if(light3==0){
device_on=0;
mdelay(100);
device_on=1;
mdelay(300);
}
else {}
sec1=0;}
else if(d0==0&&d1==0&&d2==1&&d3==0&&ack==0){
light4=~light4;
if(light4==0){
device_on=0;
mdelay(100);
device_on=1;
mdelay(300);}
else {
device_of=0;
mdelay(100);
device_of=1;
mdelay(300);
}
sec1=0;
else if(d0==1&&d1==0&&d2==1&&d3==0&&ack==0)
{
light5=~light5;
if(light5==0)
device_on=0;
mdelay(100);
device_on=1;
mdelay(300);
52
}
else
{
device_of=0;
mdelay(100);
device_of=1;
mdelay(300);
sec1=0;
else if(d0==0&&d1==1&&d2==1&&d3==0&&ack==0)
light6=~light6;
if(light6==0)
{
device_on=0;
mdelay(100);
device_on=1;
mdelay(300);
}
else
{
device_of=0;
mdelay(100);
device_of=1;
mdelay(300);
}
sec1=0;
}
else if(d0==1&&d1==1&&d2==1&&d3==0&&ack==0)
{
light7=~light7;
53
if(light7==0)
{
device_on=0;
mdelay(100);
device_on=1;
mdelay(300);
}
else
{
device_of=0;
mdelay(100);
device_of=1;
mdelay(300);
}
sec1=0;
}
else if(d0==0&&d1==0&&d2==0&&d3==1&&ack==0)
{
light8=~light8;
if(light8==0)
{
device_on=0;
mdelay(100);
device_on=1;
mdelay(300);
}
else
{
device_of=0;
mdelay(100);
device_of=1;
mdelay(300);
}
54
sec1=0;
}
else if(d0==1&&d1==0&&d2==0&&d3==1&&ack==0)
{
light9=~light9;
if(light9==0)
{
device_on=0;
mdelay(100);
device_on=1;
mdelay(300);
}
else {
device_of=0;
mdelay(100);
device_of=1;
mdelay(300);}
sec1=0;}
else if(d0==0&&d1==1&&d2==0&&d3==1&&ack==0){
light0=~light0;
if(light0==0){
device_on=0;
mdelay(100);
device_on=1;
mdelay(300);}
else {
device_of=0;
mdelay(100);
device_of=1;
mdelay(300);}
sec1=0;}
else if(d0==0&&d1==0&&d2==1&&d3==1&&ack==0){
mdelay(300);
green=0;
55
red=1;
return
void password(){
char pass=0;
char sec=0;
int number;
green=1;
red=0;
passkey[0]=2;
passkey[1]=2;
passkey[2]=2;
passkey[3]=2;
type_pass=0;
mdelay(100);
type_pass=1;
mdelay(300);
value();
if(cmd==3)
{
light1=~light1;
mdelay(100);
}
else if(cmd==5)
{
light2=~light2;
mdelay(100);
}
else if(cmd==7)
{
light3=~light3;
mdelay(100);
}
else if(cmd==9)
{
light4=~light4;
mdelay(100);
}
else if(cmd==11)
{
light5=~light5;
mdelay(100);
58
}
else if(cmd==13)
{
light6=~light6;
mdelay(100);
}
else if(cmd==15)
{
light7=~light7;
mdelay(100);
}
else if(cmd==17)
{
light8=~light8;
mdelay(100);
}
else if(cmd==19)
{
light9=~light9;
mdelay(100);
}
else if(cmd==1)
{
light0=~light0;
mdelay(100);
59
4.4 MULTI SIM 12.0
We have used Multi Sim software to simulate the power supply section of our project.
60
CHAPTER- 5
RESULTS
Our main objective in this project was to design a system such that it allows a user to
operate the electrical appliances likes fans and lights of home using his mobile phone
and to know the statuses of appliances with the additional features of password
protection and memory interface that stores the current statuses of various appliances,
in case power failure occurs.
Lighting
Lighting controls also provide convenience, comfort, and efficiency by
controlling when interior/exterior lights are turned on and the brightness level.
Lighting scenes are merely the combination on/off and brightness level
settings for multiple lights in the home to achieve a desired environment for a
given situation or occasion. Once a lighting scene is defined, it can be invoked
by time of day, motion or contact sensing, or the push of a single button at a
convenient place in the home
Controls for your heating and air conditioning (HVAC) systems, in the form
of programmable thermostats, address comfort and efficiency by maintaining a
schedule consist family presence in the home.
61
Fig 5.1 Complete picture of working project
62
CHAPTER-6
FUTURE SCOPE
The Home Automation System can be enhanced with more and more digital systems
and can be used to enhance the usability of the project. As a result ,many systems that
are now developed such as speed control of fans and advanced home security. These
project can further be modified using Advanced Embedded Systems.
Some of its future features that can be added to enhance the functioning of the project
Security
Security and alarm systems normally address most of the safety issues in the
home environment. However, adequate lighting at night can prevent unwanted
accidents such as falling down the stairs or add to the burglary deterrent by
flashing exterior lights when motion is detected. Convenience improves when
security sensors can also be used to trigger climate and lighting scenes when
the alarm system is disarmed.
Entertainment
Automated controls for your entertainment centre address simplicity and
convenience in the delivery of entertainment content. The universal remote
functionality replaces a myriad of individual device remotes and provides the
ability to control the entertainment activity by emitting multiple commands
with the press of a single button. A consistent operational interface is provided
63
when the same universal remote is deployed in multiple entertainment centers.
These systems are enhanced when the universal remote provides connectivity
to your home computing resources to retrieve media (e.g. digital photos and
music) to play on the entertainment display.
Note efficiency translates into dollar savings in energy cost for your home. A
simple example is turning on outside lights to 80% brightness at sunset to save
20% of the electricity usage for this one typical lighting scene. With whole-house
automation systems, described in more detail later, you have the greatest
opportunity to meet all your lifestyle factors by coordinating the operation of each
of the above subsystems into one cohesive system.
Predicting the future of just about anything is very risky business. Home automation
is an industry still selling and installing X10 devices nearly 30 years after the
technology was made commercially available in 1980. Nevertheless, we believe the
future of home automation will very much ride the digital age and develop along with
the computer and networking systems in the years to come. Indeed, as described by
the story on the Windows Media Centre, companies such as Microsoft and
Exceptional Innovation with their Life/ware software are positioning the Windows
Vista Ultimate Media Centre PC as the heart and sole of a complete solution for home
automation that will rely on web services to seamlessly interface with lighting
controls, climate controls, security panels, and IP surveillance cameras to accompany
the digital media management capabilities of Windows Media Centre. Another great
example of how the integration of traditional home automation systems with
Windows Media Centre and the home network has already taken hold is this "Cool
Homes" article published in electronic houses.
Advances in home networking technology using both wired and wireless Ethernet will
enable the addition of more devices to the network at an affordable incremental cost.
Those building new homes today should consider installing Cat6 wiring throughout
the home to position for Gigabit Ethernet future bandwidth which will improve the
performance of digital video streaming among devices in the home. The IEEE
802.11n standard for home Wi-Fi networks will likewise provide similar
64
improvements in wireless bandwidth. Even though the 802.11n specification is still in
draft form, pre-n home wireless routers delivering up to 300 Mbps bandwidth have
been available for the last 2 years and offer significant advances in signal strength
throughout the home. This improvement in bandwidth bodes well for existing
homeowners wanting to retrofit a home automation solution without knocking down
walls or tearing up drywall.
Coupled with the above advances in Ethernet technology is the emergence of radio
frequency (RF) communications protocols such as ZigBee (IEEE 802.15.4 standard)
and Z-Wave developed by Zen Systems. RF communications has speed advantages
over Ethernet for small amounts of information which is typical of the command
sequences required for controlling lights or thermostats. We choose to highlight the
industry leading Control product line specifically because the system architecture is
built on a communications infrastructure that utilizes the strength of Ethernet for
digital audio streaming and Zig Bee for control information between the system
controller and other devices and user interfaces in the system. These new RF
protocols also enable wireless contact and motion sensors to be deployed in security
systems. An example is the ZigBee-based sensors from Card Access which also
improve the attractiveness of security features for existing homes.
65
Analogous to the computer and networking industries, the degree to which smart
home functionality will become mainstream will depend on the systems and software
developed to enable a "plug n' play" environment where a homeowner can purchase
lighting devices or thermostats that can easily be added to a PC-based or proprietary
home automation system without engaging a custom installer/integrator.
More recently we've discussed the potential of home automation from the
cloud which could have the ability to extend smart home technology to a much larger
market if a central server with a thin home controller client architecture was
developed and deployed. While Apple and others are touting the "cloud" as a
repository for all your media, it's not clear any of the top HA companies are looking at
the central server/remote client approach.
66
APPENDIX A
(SOFTWARE METHODOLOGY)
To open keil software click on start menu then program and then select
keil2.Following window will appear on the screen.
You can see three different windows in this screen. 1) project work space window 2)
editing window 3) output window.
67
Project workspace window is for showing all the related files connected with
your project.
Editing window is the place where you will edit the code
Output window will show the output when you compile or build or run your
project.
Now to start with new project follow the steps
Click on project menu and select new project
You will be asked to create new project in specific directory
Move to your desired directory and there create a new folder for your project
named "first". Here new project is created in d:\keil2\myprojects\first as
shown in figure
Now you will be asked to chose your target device for which you want to
write the program.
68
Scroll down the cursor and select generic from list. expand the list and select
8051 (all variants)
When you click OK, you will be asked to add startup code and file to your
project folder. Click yes. Now on your screen expand target1 list fully. You
will see following window.
69
Now click on file menu and select new file. editor window will open. Now
you can start writing your code.
As you start writing program in C, same way here also you have to first
include the header file. Because our target is 8051 our header file will be
"reg51.h"
After including this file, right click on the file and select open document
<reg51.h>.Following window will appear.
If you scroll down cursor you will see that all the SFRs like P0-P3, TCON,
TMOD, ACC, bit registers and byte registers are already defined in this header
file. so one can directly use these register names in coding
Now you can write your program same as c language starting with void main()
After completing the code save the file in project folder with ".c" extension.
70
Now right click on "source group 1" in project workspace window. select "add
files to source group 1"
Select the C file you have created and click add button.
You will see that the c file has been added in source group
Now to compile the program from project menu select "build target". In the
output window you will see the progress
If there is any compilation error then target will not be created. Remove all the
errors and again build the target till you find "0 Error(s)"
Now you are ready to run your program.From debug menu select "start/stop
debug session"
You will see your project workspace window now shows most of the SFRs as
well as GPRs r0-r7. Also one more window is now opened named "watches".
In this window you can see different variable values.
71
To add variable in watch window, go to "watch#1" tab. then type F2 to edit
and type the name of your variable
If you want to see the output on ports, go to peripheral menu and select I/O
ports. Select the desire port. You can give input to port pins by checking or un
checking any check box. Here the check mark means digit 1 and no check
mark means 0. the output on the pin will be shown in same manner
To run the program you can use any of the option provided "go", "step by
step", "step forward" etc.
Now after testing your program you need to download this program on your
target board i.e. 8051. For this you have to create hex file.
To create hex file first stop debug session. Again you will be diverted to
project workspace window.
Right click on "target 1" and select "option for target 1". Following window
will appear.
72
Select output tag and check "create hex file" box
Now when you again build your program you will see the message in output
window "hex file is created".
In your project folder you can see the hex file with same name of your project
as "test.hex".
you can directly load this file in 8051 target board and run the application on
actual environment.
73