Home Automation System Using Android Application
Home Automation System Using Android Application
ABSTRACT
Today we are living in 21st century where automation is playing important role in human life.
Home automation allows us to control household appliances like light, door, fan, AC etc. Home
automation not only refers to reduce human efforts but also energy efficiency and time saving.
The main objective of home automation is to help handicapped and old aged people which will
enable them to control home appliances.
This project presents the overall design of Home Automation with low cost and wireless remote
control. This system is designed to assist and provide support in order to fulfil the needs of
elderly and disabled in home. Also, the smart home concept in the system improves the standard
living at home. The main control system implements wireless Bluetooth technology to provide
remote access from smart phone. The design remains the existing electrical switches and
provides more safety control on the switches with low voltage activating method. The switches
status is synchronized in all the control system whereby every user interface indicates the real
time existing switches status. The system intended to control electrical appliances and devices in
house with relatively low cost design, user-friendly interface and ease of installation.
Page 1
Chapter 1
Introduction
Page 2
Automation is todays fact, where more things are beingCompletedevery day automatically,
usually the basictasks of turning on or off certain devices and beyond, eitherremotely or in close
proximity. The control of the deviceswhen completely taken over by the machines, the processof
monitoring and reporting becomes more important.Depending on the location of its usage,
automation differsin its name as industrial automation, home automation etc.With the
development of low cost electronic componentshome automation migrated from being an
industrialapplication to home automation. The home automation, ourpoint of concern deals with
the control of home appliancesfrom a central location. Market researches claim that mostof the
homes will be equipped with home automationsystems in the very near future. The whole
process ofsupervising, controlling and monitoring electrical devicesand equipments from electric
power stations and thedistribution grids is based on automation, protection,dataacquisition and
equipment control. A popularapplication in this field, which is in highly demand,involves
controlling the power equipment in the building,such as the motor, heater, lamp and air
conditioner. Theproblem of power management is the remote controladjustment, which is a result
from consumers carelessness.Microcontrollers are suitable in low-cost control application.
Due to the advancement of wireless technology, there are several different of connections are
introduced such as GSM, WIFI, ZIGBEE, and Bluetooth. Each of the connection has their own
unique specifications and applications. Among the four popular wireless connections that often
implemented in HAS project, Bluetooth is being chosen with its suitable capability. Bluetooth
with globally available frequencies of 2400Hz is able to provide connectivity up to 100 meters at
speed of up to 3Mbps depending on the Bluetooth device class . In addition, a Bluetooth master
device is able to connect up to 7 devices in a Piconet.
The capabilities of Bluetooth are more than enough to be implemented in the design. Also, most
of the current laptop/notebook or cell phones are come with built-in Bluetooth adapter. It will
indirectly reduce the cost of this system.
Page 3
Chapter 2
Project Description
Page 4
Page 5
33 feet
Class 1 radios used primarily in industrial use cases have a range of 100 meters or
300 feet
Page 6
Power
The most commonly used radio is Class 2 and uses 2.5 mW of power. Bluetooth technology is
designed to have very low power consumption. This is reinforced in the specification by
allowing radios to be powered down when inactive.
The Generic Alternate MAC/PHY in Version 3.0 HS enables the discovery of remote AMPs for
high speed devices and turns on the radio only when needed for data transfer giving a power
optimization benefit as well as aiding in the security of the radios.
Bluetooth low energy technology, optimized for devices requiring maximum battery life instead
of a high data transfer rate, consumes between 1/2 and 1/100 the power of classic Bluetooth
technology.
2.1.2ANDROID
Android is a mobile operating system (OS) based on the Linux kernel and currently developed
by Google. With a user interface based on direct manipulation, Android is designed primarily for
touchscreen mobile devices such as smartphones and tablet computers, with specialized user
interfaces for televisions (Android TV), cars (Android Auto), and wrist watches (Android Wear).
The OS uses touch inputs that loosely correspond to real-world actions, like swiping, tapping,
pinching, and reverse pinching to manipulate on-screen objects, and a virtual keyboard. Despite
being primarily designed for touchscreen input, it also has been used in game consoles, digital
cameras, regular PCs (e.g. the HP Slate 21) and other electronics.
Page 7
Page 8
Page 9
Page 10
Chapter 3
PCB Designing
PCB
The success of any creation is often dependent on the foundations it is built upon, be it the
strength of a character, depth of a buildings foundations or the extent of a trees roots. Much in
the same way, the success of any electronic device depends on what it is built on. The
motherboard of any electronics device serves as a playground and a host to every form of
electrical signal that performs some function for the equipment. Be it the communication signal
between the North Bridge and processor on a computer, or a simple on-off signal in a routine
school project, the effectiveness of the design is a function of the capabilities offered by the base
board itself.
A Printed Circuit Board doesnt just connect electrical components using etched copper
pathways, but also provides mechanical strength to it. Printed Circuit Boards, or more
appropriately, Printed Wiring Boards are found in almost all of the commercial products as a
packaging medium as building blocks.
PCBs are a composite of organic and/or inorganic dielectric materials with many layers with
wiring interconnects and also house components like inductors and capacitors. There isnt any
standard printing board as such and each board is unique, often a function of the product itself.
There are industry standards for almost every aspect of PCB design, controlled by IPC, for
example the IPC-2221, Generic Standard on Printed Board Design.
A printed circuit board has pre-designed copper tracks on a conducting sheet. The pre-defined
tracks reduce the wiring thereby reducing the faults arising due to lose connections. One needs to
simply place the components on the PCB and solder them.
Materials required in PCB Designing:
Over Head Projector sheet (known as OHP sheets) or a wax paper.
Laser Printer.
Electric Iron.
Steel wool.
Two plastic trays.
Copper board/ PCB (eg: paper phenolic, glass epoxy, FR4, FR10, etc.)
Black permanent marker.
Etching solution (Ferric chloride).
Drill machine.
Page 12
Steps :
Step1:
Prepare a layout of the circuit on any commonly used PCB designing software. A
layout is a design which interconnects the components according to the schematic
diagram (circuit diagram). Take a mirror image print of the layout on the OHP
sheet using a laser printer. Make sure that the design is correct with proper
PC.
Step3:Rub the copper side of PCB using steel wool. This removes the top oxide
of PCB.
Step5:Put a white paper on the OHP sheet and start ironing. The heat applied by
the electric iron causes the ink of the traces on the OHP sheet to stick on the
copper plate exactly in the same way it is printed on the OHP sheet. This means
that the copper sheet will now have the layout of the PCB printed on it. Allow the
PCB plate to cool down and slowly remove the OHP sheet. Since it is manual
process it may happen that the layout doesnt comes properly on PCB or some of
the tracks are broken in between. Use the permanent marker and complete the
tracks properly.
Step6:Now the layout is printed on PCB. The area covered by ink is known as the
masked area and the unwanted copper, not covered by the ink is known as
unmasked area. Now make a solution of ferric chloride. Take a plastic box and fill
Page 13
it up with some water. Dissolve 2-3 tea spoon of ferric chloride power in the
water. Dip the PCB into the Etching solution (Ferric chloride solution, Fecl3) for
approximately 30 mins. The Fecl3 reacts with the unmasked copper and removes
the unwanted copper from the PCB. This process is called as Etching. Use pliers
to take out the PCB and check if the entire unmasked area has been etched or not.
In case it is not etched leave it for some more time in the solution.
Step7:Take out the PCB wash it in cold water and remove the ink by rubbing it
with steel wool. The remaining area which has not been etched is the conductive
copper tracks which connect the components as per the circuit diagram.
Step8:Now carefully drill the PCB using a drilling machine on the pads.
Step9: Put the components in the correct holes and solder them.This completes
your PCB fabrication now put the components on mounting side and solder them.
Make sure that you properly dispose of the FeCl3 solution, clean your tools and
wash your hands after this exercise. You can also store the solution in a plastic
box for future use but not for too long.
Page 14
Chapter 4
Hardware Description
4.1.Microcontroller:The AtmelAVR ATmega8 is a low-power CMOS 8-bit microcontroller based on the AVR
RISC architecture. By executing powerful instructions in a single clock cycle, the
Page 15
Page 16
Page 17
Pin Description:
VCC:
Supply voltage.
GND:
Ground.
Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The
Port B output buffers have symmetrical drive characteristics with both high sink and source
capability. As inputs, Port B pins that are externally pulled low will source current if the pull-up
resistors are activated. The Port B pins are tri-stated when a reset condition becomes active, even
if the clock is not running.Depending on the clock selection fuse settings, PB6 can be used as
input to the inverting Oscillatoramplifier and input to the internal clock operating
circuit.Depending on the clock selection fuse settings, PB7 can be used as output from the
Page 18
inverting Oscillator amplifier. If the Internal Calibrated RC Oscillator is used as chip clock
source, PB7..6 is used as TOSC2..1input for the Asynchronous Timer/Counter2 if the AS2 bit in
ASSR is set.
Port C (PC5..PC0)
Port C is an 7-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The
Port C output buffers have symmetrical drive characteristics with both high sink and source
capability. As inputs, Port C pins that are externally pulled low will source current if the pull-up
resistors are activated. The Port C pins are tri-stated when a reset condition becomes active,even
if the clock is not running.
PC6/RESET:
If the RSTDISBL Fuse is programmed, PC6 is used as an I/O pin. Note that the electrical
characteristics of PC6 differ from those of the other pins of Port C. If the RSTDISBL Fuse is
unprogrammed, PC6 is used as a Reset input. A low level on this pin for longer than the
minimum pulse length will generate a Reset, even if the clock is not running.
Port D (PD7..PD0)
Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The
Port D output buffers have symmetrical drive characteristics with both high sink and source
capability. As inputs, Port D pins that are externally pulled low will source current if the pull-up
resistors are activated. The Port D pins are tri-stated when a reset condition becomes active, even
if the clock is not running.
RESET:
Reset input. A low level on this pin for longer than the minimum pulse length will generate a
reset, even if the clock is not running.
XTAL1:
Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
Page 19
XTAL2:
Output from the inverting oscillator amplifier.
Oscillator Characteristics:
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier which can be
configured for use as an on-chip oscillator, as shown in Figure 1. Either a quartz crystal or
ceramic resonator may be used. To drive the device from an external clock source, XTAL2
should be left unconnected while XTAL1 is driven as shown in Figure 6.2. There are no
requirements on the duty cycle of the external clock signal, since the input to the internal
clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage
high and low time specifications must be observed.
Page 20
Idle Mode:
In idle mode, the CPU puts itself to sleep while all the on chip peripherals remain active. The
mode is invoked by software. The content of the on-chip RAM and all the special functions
registers remain unchanged during this mode. The idle mode can be terminated by any enabled
interrupt or by a hardware reset.
Power down Mode:
In the power down mode the oscillator is stopped, and the instruction that invokes power down is
the last instruction executed. The on-chip RAM and Special Function Registers retain their
values until the power down mode is terminated. The only exit from power down is a hardware
reset. Reset redefines the SFRs but does not change the on-chip RAM. The reset should not be
activated before VCC is restored to its normal operating level and must be held active long
enough to allow the oscillator to restart and stabilize.
3.2 Relay:
A relay is an electrically operated switch. Many relays use an electromagnet to operate a
switching mechanism mechanically, but other operating principles are also used. Relays are used
where it is necessary to control a circuit by a low-power signal (with complete electrical isolation
between control and controlled circuits), or where several circuits must be controlled by one
signal.
Page 21
Relays allow one circuit to switch a second circuit which can be completely separate from the
first. For example a low voltage battery circuit can use a relay to switch a 230V AC mains
circuit. There is no electrical connection inside the relay between the two circuits; the link is
magnetic and mechanical.
The coil of a relay passes a relatively large current, typically 30mA for a 12V relay, but it can be
as much as 100mA for relays designed to operate from lower voltages. Most ICs (chips) cannot
provide this current and a transistor is usually used to amplify the small IC current to the larger
value required for the relay coil. The maximum output current for the popular 555 timer IC is
200mA so these devices can supply relay coils directly without amplification.
Page 22
Relays are usually SPDT or DPDT but they can have many more sets of switch contacts, for
example relays with 4 sets of changeover contacts are readily available. For further information
about switch contacts and the terms used to describe them please see the page on switches
Most relays are designed for PCB mounting but you can solder wires directly to the pins
providing you take care to avoid melting the plastic case of the relay.
The suppliers catalogue should show you the relays connections. The coil will be obvious and it
may be connected either way round. Relay coils produce brief high voltage spikes when they
are switched off and this can destroy transistors and Ics in the circuit. To prevent damage you
must connect a protection diodeacross the relay coil.
The figure shows a relay with its coil and switch contacts. You can see a lever on the left being
attracted by magnetism when the coil is switched on. This lever moves the switch contacts.
There is one set of contacts (SPDT) in the foreground and another behind them, making the relay
DPDT.
The relay's switch connections are usually labelled COM, NC and NO:
COM = Common, always connect to this; it is the moving part of the switch.
NC = Normally Closed, COM is connected to this when the relay coil is off.
NO = Normally Open, COM is connected to this when the relay coil is on.
Page 23
Applications of relays:
Relays are used for:
Detect and isolate faults on transmission and distribution lines by opening and
closing circuit breakers.
Time delay functions. Relays can be modified to delay opening or delay closing a
set of contacts. A very short (a fraction of a second) delay would use a copper disk
between the armature and moving blade assembly. Current flowing in the disk
maintains magnetic field for a short time, lengthening release time. For a slightly
longer (up to a minute) delay, a dashpot is used. A dashpot is a piston filled with
fluid that is allowed to escape slowly. The time period can be varied by increasing
or decreasing the flow rate. For longer time periods, a mechanical clockwork timer
is installed.
Page 24
Features:
Page 25
FEATURES
500-mA-Rated Collector Current (Single Output)
High-Voltage Outputs: 50 V
Output Clamp Diodes
Page 26
4.5 Resistor:
Fig4.11: resistors
Electronic Symbol
(Europe)
(US)
A resistor is a two-terminalelectronic component that produces a voltage across its terminals
thatis proportional to the electric current through it in accordance with Ohm's law:
V = IR
Resistors are elements of electrical networks and electronic circuits and are ubiquitous in most
electronic equipment. Practical resistors can be made of various compounds and films, as well as
resistance wire (wire made of a high-resistivity alloy, such as nickel/chrome).The primary
characteristics of a resistor are the resistance, the tolerance, maximum working voltage and the
power rating. Other characteristics include temperature coefficient,noise, and inductance. Less
well-known is critical resistance, the value below which power dissipation limits the maximum
permitted current flow, and above which the limit is applied voltage. Criticalresistance depends
Page 27
upon the materials constituting the resistor as well as its physical dimensions; it's determined by
design.Resistors can be integrated into hybrid and printed circuits, as well as integrated circuits.
Size and position of leads (or terminals) are relevant to equipment designers; resistors must be
physically large enough not to overheat when dissipating their power.
4.6 Capacitor:
Page 28
Ceramic capacitor
In electronics ceramic capacitor is a capacitor constructed of alternating layers of metal and
ceramic, with the ceramic material acting as the dielectric. The temperature coefficient depends
on whether the dielectric is Class 1 or Class 2. A ceramic capacitor (especially the class 2) often
has high dissipation factor, high frequency coefficient of dissipation.
bare leadless disc, sits in a slot in the PCB and is soldered in place, used for UHF
applications
Page 29
Electrolytic capacitor
Figure 4.14: Axial lead (top) and radial lead (bottom) electrolytic capacitors
An electrolytic capacitor is a type of capacitor that uses an ionic conducting liquid as one of its
plates with a larger capacitance per unit volume than other types. They are valuable in relatively
high-current and low-frequency electrical circuits. This is especially the case in power-supply
filters, where they store charge needed to moderate output voltage and current fluctuations in
rectifier output. They are also widely used as coupling capacitors in circuits where AC should be
conducted but DC should not.
Electrolytic capacitors can have a very high capacitance, allowing filters made with them to have
very low corner frequencies.
Page 30
is called electroluminescence and the color of the light is determined by the energy gap of the
semiconductor. The LED is usually small in area (less than 1 mm2) with integrated optical
components to shape its radiation pattern and assist in reflection.
Page 31
Page 32
material to
create
an
electrical
signal
with
very
precise frequency. This frequency is commonly used to keep track of time (as in quartz
wristwatches), to provide a stable clock signal for digital integrated circuits, and to stabilize
frequencies for radio transmitters and receivers. The most common type of piezoelectric
resonator used is the quartz crystal, so oscillator circuits incorporating them became known as
crystal oscillators, but other piezoelectric materials including polycrystalline ceramics are used in
similar circuits.
Quartz crystals are manufactured for frequencies from a few tens of kilohertz to hundreds of
megahertz. More than two billion crystals are manufactured annually. Most are used for
consumer devices such as wristwatches, clocks, radios, computers, and cell phones. Quartz
crystals are also found inside test and measurement equipment, such as counters, signal
generators, and oscilloscopes.
4.10 TRIAC:
TRIACs are a subset of thyristors and are closely related to silicon-controlled rectifiers (SCR).
However, unlike SCRs, which are unidirectional devices (that is, they can conduct current only
in one direction), TRIACs are bidirectional and so allow current in either direction. Another
difference from SCRs is that TRIAC current can be enabled by either a positive or negative
current applied to its gate electrode, whereas SCRs can be triggered only by positive current into
Page 33
the gate. To create a triggering current, a positive or negative voltage has to be applied to the gate
with respect to the MT1 terminal (otherwise known as A1).
4.11 Optocoupler:
Optocoupler, also called an opto-isolator, photocoupler, or optical isolator, is a component that
transfers electrical signals between two isolated circuits by using light. Opto-isolators prevent
high voltages from affecting the system receiving the signal. Commercially available optoisolators withstand input-to-output voltages up to 10 and voltage transients with speeds up to 10
kV/s.
A common type of opto-isolator consists of an LED and a phototransistor in the same opaque
package. Other types of source-sensor combinations include LED-photodiode, LED-LASCR,
and lamp-photoresistor pairs. Usually opto-isolators transfer digital (on-off) signals, but some
techniques allow them to be used with analog signals.
Page 34
4.12 Diode:
Diodeis a two-terminal electronic component with asymmetric conductance; it has low (ideally
zero) resistance to current in one direction, and high (ideally infinite) resistance in the other. A
semiconductor diode, the most common type today, is a crystalline piece of semiconductor
material with a pn junction connected to two electrical terminals.[5] A vacuum tube diode has
two electrodes, a plate (anode) and a heated cathode. Semiconductor diodes were the first
semiconductor electronic devices. The discovery of crystals' rectifying abilities was made by
German physicist Ferdinand Braun in 1874.
Page 35
Chapter 5
Page 36
5.1 CONCLUSION
This is a proto type project. Our prime objective is to assist handicapped/old aged people. This
gives us basic idea of how to control various home appliances and provide a security using
Android phone/tab. This project is based on Android and Arduino platform both of which are
FOSS (Free Open Source Software). So the overall implementation cost is very cheap and it is
affordable by a common person. Looking at the current scenario we have chosen Android
platform so that most of the people can get benefit.
The design consists of Android phone with home automation application, Arduino Mega ADK.
User can interact with the android phone and send control signal to the Arduino ADK which in
turn will control other embedded devices/sensors. We have discussed a simple prototype but in
future it can be expanded to many other areas.
Page 37
APPENDIX 1
COMPONENT LIST:
Microcontroller ATMEGA8
Relay driver IC ULN2003
Relay 12v
Diode 1N4007
Resistor 1k ohm
Ceramic capacitor(104 P F)
Electrolyte capacitor (220micro F)
TRIAC (BT136)
Optocoupler (MOC3021M)
Bluetooth module (hc05)
Voltage regulator (7805)
Oscillator (16.0)
Page 38
APPENDIX 2
CODE:
#include<reg51.h>
sbit relay1=P2^3;
sbit relay2=P2^4;
sbit relay3=P2^5;
sbit relay4=P2^6;
unsigned char f=0x00;
voidini()
// Initialize Timer 1 for serial communication
{
TMOD=0x20; //Timer1, mode 2, baud rate 9600 bps
TH1=0XFD;
SCON=0x50;
TR1=1;
TI=0;
}
voidrecieve()//Function to receive serial data
{
while(RI==0);
f=SBUF;
RI=0;
}
void main()
{
ini();
relay1=0;
relay2=0;
relay3=0;
relay4=0;
Page 39
while(1)
{
recieve();
if(f==0X41) ////A
{
relay1=1;
}
else if(f==0X61)
{
relay1=0;
////a
}
else if(f==0X42) ////B
{
relay2=1;
}
else if(f==0X62) ////b
{
relay2=0;
}
else if(f==0X43) ////C
{
relay3=1;
}
else if(f==0X63) ////c
{
relay3=0;
}
else if(f==0X44) ////D
{
relay4=1;
}
else if(f==0X64) ////d
{
relay4=0;
Page 40
}
else if(f==0X65) ////e
{
relay1=0;
relay2=0;
relay3=0;
relay4=0;
}
else
{
relay1=0;
relay2=0;
relay3=0;
relay4=0;
}
}
}
REFERENCES
Page 41
Android
Application.
www.theijes.com
International Journal of Scientific & Engineering Research, Volume 5, Issue 5, May-2014
,ISSN 2229-5518, http://www.ijser.org
Page 42