Professional Documents
Culture Documents
CHAPTER I
INTRODUCTION
1.1 INTRODUCTION
Usually conventional wall switches are located in different parts of the house and often
require persons for their operations and, thus, manual pressing turn them ON and OFF . It
becomes very difficult for the elderly or physically handicapped people to operate them. This
system is enhanced to control the home applications through an Android application of smart
phones or tablet phones by entering the selected number for corresponding load.
The proposed system uses an Arduino board and a rectified power supply. A Bluetooth
is interfaced to the Arduino board using Rx and Tx pins for communication. The electrical
loads are controlled by the TRIAC device which is connected to the Arduino board through
opto-isolator. Opto-coupler is connected to trigger the back-to-back SCRs (TRIACS) with
isolation from the controlling section.
The main aim of the project is to control the home application remotely using android
OS smart phones with an Arduino board. This is an advanced technology in the home
automation, so houses are getting smarter.
1.4 METHODOLOGIES
In order to achieve the goals of this project the work has been divided as follows :
ARDIUNO
EMBEDDED C LANGUAGE
CHAPTER 2
The Atmel 8-bit RISC-based microcontroller combines 32 kB ISP flash memory with
read-while-write capabilities, 1 kB EEPROM, 2 kB SRAM, 23 general purpose I/O lines, 32
general purpose working registers, three flexible timer/counters with compare modes, internal
and external interrupts, serial programmable USART, a byte-oriented 2-wire serial interface,
SPI serial port, 6-channel 10-bit A/D converter (8-channels in TQFP and QFN/MLF
packages), programmable watchdog timer with internal oscillator, and five software
selectable power saving modes. The device operates between 1.8-5.5 volts.
POWER SUPPLY
All the digital circuits require regulated power supply. Here by using a step down
transformer , rectifier , filter capacitor and regulator we convert the 230V AC supply that we
get from the mains into a regulated DC voltage of 5V which we require to operate all the
components that we are using in our project.
DEPARTMENT OF ECE, CMRCET Page 4
BLUETOOTH BASED HOME AUTOMATION USING ANDROID APPLICATION
HC-05 module is an easy to use Bluetooth SPP (Serial Port Protocol) module, designed
for transparent wireless serial connection setup. Serial port Bluetooth module is fully
qualified Bluetooth V2.0+EDR (Enhanced Data Rate) 3Mbps Modulation with complete
2.4GHz radio transceiver and baseband.
It uses CSR Bluecore 04-External single chip Bluetooth system with CMOS
technology and with AFH(Adaptive Frequency Hopping Feature). It has the footprint as small
as 12.7mmx27mm. It will simplify your overall design/development cycle.
LCD MODULE
RELAY
A type of relay that can handle the high power required to directly control an electric motor
or other loads is called a contractor . Solid-state relays control power circuits with no moving
parts, instead using a semiconductor device to perform switching. Relays with calibrated
operating characteristics and sometimes multiple operating coils are used to protect electrical
circuits from overload or faults; in modern electric power systems these functions are
performed by digital instruments still called protective relays.
CONNECTING WIRES
Cables made to connect to these pin headers are usually one of two types: individual wires
with crimp connectors on them or ribbon cables with insulation displacement connectors.
These can simply be clamped onto the end of a ribbon cable, which creates a connection to
each one of the conductors in the ribbon cable.
While
FALSE
serial.availabl
e
TRUE
If If If a==6;
a==4;5; a==5;5;
STOP
It is an 8 bit microcontroller and it requires supply voltage of 5V DC. Use 7805 power
supply circuit to provide 5V DC to the microcontroller. We can use 9V DC battery or 12V, 1A
adapter to provide the supply to the circuit In the above circuit LCD is used to indicate the
status of electrical loads and also used to display received data from Bluetooth. Here LCD is
interfaced to the microcontroller in 4 bit mode.
Bluetooth module TX and RX pins are connected to the RXD and TXD pins of
controller. Vcc pin is connected to the 5V and GND pin is connected to ground. Controller
communicates with Bluetooth module using serial communication (UART protocol). Use a
baud rate of 9600 to communicate with Bluetooth.
As soon as the application starts it asks to enable the Bluetooth of the phone , if user
presses NO , app ends , if user presses YES , it turns on the Bluetooth and automatically
search for nearby devices to connect with . When the user selects the device the phone
automatically pair with that device . The screen will have options for various devices . When
the desired option has been selected by the user , it is sent to the Bluetooth module which
further transmits it to the arduino board using serial com with a baud rate of 9600 . For
instance, if key1 is selected then the corresponding operation will occur.
CHAPTER 3
hardware components used have developed it .Presence of every module has been reasoned
and placed carefully thus contributing to the best working of the unit. Secondly using highly
advanced ICs and with the help of the growing technology the project has been successfully
implemented.
In the above fig 3.1 we can find the arduino set up to be in a waiting
stage expecting an input from the Bluetooth module. Once the input is
given from the mobile device the appropriate action is performed.
When LIGHTS ON input is given to the arduino kit from the mobile unit when it is in waiting
state, we observe from fig 3.2 that the light on and the arduino again returns to Waiting state.
When LIGHTS OFF input is given to the arduino kit from the mobile unit when it is in
waiting state, we observe from fig 3.3 that the light is turned back off and the arduino again
returns to Waiting state.
When FAN ON input is given to the arduino kit from the mobile unit when it is in waiting
state, we observe from fig 3.4 that the fan tends to TURN ON and the arduino again returns
to Waiting state.
When FAN OFF input is given to the arduino kit from the mobile unit when
it is in waiting state, we observe from fig 3.5 that the fan which was
previously in ON state now gets Turned OFF and the arduino again returns
to Waiting state.
When ALL ON input is given to the arduino kit from the mobile unit when
it is in waiting state, we observe from fig 3.6 that the fan and light which
was previously in OFF state now gets Turned ON and the arduino again
returns to Waiting state.
When ALL OFF input is given to the arduino kit from the mobile unit when
it is in waiting state, we observe from fig 3.6 that the fan and light which
was previously in ON state now gets Turned OFF and the arduino again
returns to Waiting state.
CHAPTER -4
CONCLUSION
4.1 CONCLUSION
In conclusion ,this low cost system is designed to improve the standards in home .
The remote control function by smart phone provides help and assistance especially to
disabled and elderly. In order to provide safety protection to the user, a low voltage activating
Bluetooth connection in control board allows the system install in more simple way. The
control board is directly installed beside the electrical switches where by the switching
system. The connected GUIs are synchronized to the control board. They indicate the real
time switches status. The home automation system has been experimentally proven to work
controlled from a wireless mobile device. The Bluetooth client was tested on different phones
from different manufacturers, thus proving its wide compatibility and portability. This project
will not only provide convenience to the common man but will be a boon for the old and
disabled.
REFERENCES
[3] R. Piyare and M. Tazil, Bluetooth Based Home Automation System using Cell Phone,
in Consumer Electronics, 2011, pp. 192-195.
[4] Kailash Pati Dutta, Pankaj Rai and Vineet Shekher, Microcontroller Based Voice
Activated
[5] Baris Yuksekkaya, A. Alper Kayalar, M. Bilgehan Tosun, M. Kaan Ozcan, and Ali Ziya
Alkar, A GSM, Internet and Speech Controlled Wireless Internet Home Automation
System, IEEE Transactions on Consumer Electronics,Vol. 52, No. 3, AUGUST 2006
[6] N. Sriskanthan and Tan Karande, Bluetooth Based Home Automation Systems, Journal
of Microprocessors and Microsystems, 2002, Vol. 26, pp. 281-289
[7] Kwang Yeol Lee & Jae Weon Choi, Remote-Controlled Home Automation System via
Bluetooth Home Network in SICE Annual Conference in Fukui, 2003, Vol. 3, pp. 2824-2829
[8] Wijetunge S.P., Wijetunge U.S., Peiris G.R.V,Aluthgedara C.S. & Samarasinghe A.T.L.K.,
[9] Sandeep Kumar & Mohammed A Qadeer,Universal Digital Device Automation and
[10] Hiroshi Kanma, Noboru Wakabayashi, Ritsuko Kanazawa & Hirimichi Ito, Home
Appliance Control System over Bluetooth with a Cellular Phone, in IEEE, 2003, pp. 1049-
1053
APPENDIX
Atmels ATMega328P 8-Bit Processor in 28 pin DIP package. Its like the ATmega168, with
double the flash space. It has 32K of program space. 23 I/O lines , 6 of which are channels
for the 10-bit ADC and it runs up to 20MHz with external crystal . Package can be
programmed in circuit with an operating voltage of 1.8V to 5V
GND: ground
Port D (PD7:0) 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. Th
Port D pins are tri-stated when a reset condition becomes active, even if the clock is
not running.
A VCC is the supply voltage pin for the A/D Converter, PC3:0, and ADC7:6.
It should be externally connected to VCC, even if the ADC is not used. If the ADC is
used, it should be connected to VCC through a low-pass filter. Note that PC6..4 use
digital supply voltage, VCC.
ADC7:6 (TQFP and QFN/MLF Package Only) In the TQFP and QFN/MLF package.
ADC7:6 serve as analog inputs to the A/D converter. These pins are powered from the
analog supply and serve as 10-bit ADC channels.
Introduction:
Conversion of one form of electrical power to another desired form and voltage,
typically involving converting AC line voltage to a well-regulated lower-
voltage DC for electronic devices.
Low voltage, low power DC power supply units are commonly integrated with the
devices they supply, such as computers and household electronics.
Batteries.
Fig A.2:
Regulated Power Supply
The basic circuit diagram of a regulated power supply (DC O/P) with led connected as
load is shown in the below figure.
Fig A.2.1: Circuit diagram of Regulated Power Supply with Led connection
230v AC mains
Transformer
Bridge rectifier(diodes)
Capacitor
Resistor
A.2.1 Transformers:
A transformer is a device that transfers electrical energy from one circuit to another
through inductively coupled conductors without changing its frequency. A
varying current in the first or primary winding creates a varying magnetic flux in the
transformer's core, and thus a varying magnetic field through the secondary winding.
A voltage regulator (also called a regulator) with only three terminals appears to be
a simple device, but it is in fact a very complex integrated circuit. It converts a varying input
voltage into a constant regulated output voltage. Voltage Regulators are available in a
variety of outputs like 5V, 6V, 9V, 12V and 15V. The LM78XX series of voltage regulators
are designed for positive input. For applications requiring negative input, the LM79XX series
is used. Using a pair of voltage-divider resistors can increase the output voltage of a
regulator circuit.
It is not possible to obtain a voltage lower than the stated rating. You cannot use a
12V regulator to make a 5V power supply. Voltage regulators are very robust. These can
withstand over-current draw due to short circuits and also over-heating. In both cases, the
regulator will cut off before any damage occurs. The only way to destroy a regulator is to
apply reverse voltage to its input.
(handshaking) for the display is as shown. Whereas D0 to D7th bit is the data lines, RS, RW
and En pins are the control pins and remaining pins are +5V,-5V and GND to provide supply.
Where RS is the register select, RW is the Read Write and EN is the Enable pin.To display
two internal byte wide registers one for commands (RS=0) and the second one for characters
to be displayed (RS=1). It also contains a user-programmed RAM area (the character RAM)
that can be programmed to generate any desired character that can be formed using a dot
matrix. To distinguish between those two data areas, the hex command Byte 80 will be used
to signify that the display RAM address is 00h will be choosen.port1 is used to furnish the
command or data type and ports 3.2 to 3.4 furnish register select at different read/write
levels.The display takes varying amounts of time to accomplish the functions as listed.LCD
bit 7 is monitored for logic high (busy) to ensure the display is overwritten. Liquid Crystal
Display also called as LCD is very helpful for providing user interface as well as for
debugging purpose. The most common type of LCD controller is HITACHI 44780 which
provides a simple interface between the controller & an LCD. These LCDs are very simple
to interface with the controller as well as cost effective.
The most commonly used ALPHA NUMERIC displays are 1x16 (single Line & 16
characters), 2x16 (Double Line & 16 characters per line) & 4x20 (Four lines & twenty
characters per line).
The LCD requires 3 control lines (RS,R/W & EN)& 8 ( 0r 4) data lines. The number on
data lines depends on the mode of operation. If operated in 8-bit mode then 8 data lines +3
control lines i.e. 7 lines are required. How do we decide which mode to use? It simple if you
have sufficient data lines you can go for 8 bit mode & if there is a time constraint.
LCD screen consists of two lines with 16 characters each. Each character consists of
5x7 dot matrix. Contrast on display depends on the power supply voltage and whether
messages are displayed in one or two lines. For that reason, variable voltage 0-Vdd is applied
on pin marked as Vee. Trimmer potentiometer is usually used for that purpose. Some versions
of displays have built in backlight (blue or green diodes). When used during operating, a
resistor for current limitation should be used (like with any LE diode).
Depending on how many lines are used for connection to the microcontroller, there
are 8-bit and 4-bit LCD modes. The appropriate mode is determined at the beginning of the
process in a phase called initialization. In the first case, the data are transferred through
outputs D0-D7 as it has been already explained. In case of 4-bit LED mode, for the sake of
saving valuable I/O pins of the microcontroller, there are only 4 higher bits (D4-D7) used for
Consequently, each data is sent to LCD in two steps: four higher bits are sent first (that
normally would be sent through lines D4-D7), four lower bits are sent afterwards. With the
help of initialization, LCD will correctly connect and interpret each data received. Besides,
with regards to the fact that data are rarely read from LCD (data mainly are transferred from
microcontroller to LCD) one more I/O pin may be saved by simple connecting R/W pin to
the Ground.
A.4 RELAY :
A relay is usually an electromechanical device that is actuated by an electrical current.
The current flowing in one circuit causes the opening or closing of another circuit. Relays are
like remote-control switches and are used in many applications because of their relative
simplicity, long life, and proven high reliability. Relays are used in a wide variety of
applications throughout industry, such as in telephone exchanges, digital computers and
automation systems. Highly sophisticated relays are utilized to protect electric power
systems against trouble and power blackouts as well as to regulate and control the generation
and distribution of power. In the home, relays are used in refrigerators, washing machines
and dishwashers, and heating and air-conditioning controls. Although relays are generally
associated with electrical circuitry, there are many other types, such as pneu-matic and
hydraulic. Input may be electrical and output directly mechanical, or vice versa.
All relays contain a sensing unit, the electric coil, which is powered by AC or DC
current. When the applied current or voltage exceeds a threshold value, the coil activates the
armature, which operates either to close the open contacts or to open the closed contacts.
When a power is supplied to the coil, it generates a magnetic force that actuates the switch
mechanism. The magnetic force is, in effect, relaying the action from one circuit to another.
The first circuit is called the control circuit; the second is called the load circuit.
used for converting serial port to Bluetooth. These modules have two modes: master and
slaver device. The device named after even number is defined to be master or slaver when out
of factory and cant be changed to the other mode. But for the device named after odd
number, users can set the work mode (master or slaver) of the device by AT commands.
HC-04 specifically includes:
Master device: HC-04-M, M=master
Slave device: HC-04-S, S=slaver
The default situation of HC-04 is slave mode. If you need master mode, please state it
clearly or place an order for HC-O4-M directly.The naming rule of HC-06 is same.
When HC-03 and HC-05 are out of factory, one part of parameters are set for activating
the device.
The work mode is not set, since user can set the mode of HC-03, HC-05 as they want.
The main function of Bluetooth serial module is replacing the serial port line, such as:
1. There are two MCUs want to communicate with each other. One connects to
Bluetooth master device while the other one connects to slave device. Their connection can
be built once the pair is made. This Bluetooth connection is equivalently liked to a serial port
signals. And they can use the Bluetooth serial module to communicate with each other.
2. When MCU has Bluetooth salve module, it can communicate with Bluetooth adapter of
computers and smart phones. Then there is a virtual communicable serial port line between
MCU and computer or smart phone.
3. The Bluetooth devices in the market mostly are salve devices, such as Bluetooth printer,
Bluetooth GPS. So, we can use master module to make pair and communicate with them.
Bluetooth Serial modules operation doesnt need drive, and can communicate with the
other Bluetooth device who has the serial. But communication between two Bluetooth
modules requires at least two conditions:
(1) The communication must be between master and slave
(2) The password must be correct
Besides, with regards to the fact that data are rarely read from LCD (data mainly are
transferred from microcontroller to LCD) one more I/O pin may be saved by simple
connecting R/W pin to the Ground HC-05 module is an easy to use Bluetooth SPP (Serial
Port Protocol) module, designed for transparent wireless serial connection setup. Serial port
Bluetooth module is fully qualified Bluetooth V2.0+EDR (Enhanced Data Rate) 3Mbps
Modulation with complete 2.4GHz radio transceiver and baseband. It uses CSR Bluecore 04-
External single chip Bluetooth system with CMOS technology and with AFH(Adaptive
Frequency Hopping Feature). It has the footprint as small as 12.7mmx27mm.
Specifications
Hardware features
PIO control
Software features
Default Baud rate: 38400, Data bits:8, Stop bit:1,Parity:No parity, Data control: has.
PIO10 and PIO11 can be connected to red and blue led separately.
connection.
B .Software Developments
Fig.B.1.2:Arduino Board
Starting clockwise from the top center:
Analog Reference pin (orange)
Digital Pins 0-1/Serial In/Out - TX/RX (dark green) - These pins cannot be used for
digital i/o (Digital Read and Digital Write) if you are also using serial communication
(e.g. Serial.begin).
Toggles External Power and USB Power (place jumper on two pins closest to desired
supply) - SV1 (purple)
USB (used for uploading sketches to the board and for serial communication between
the board and the computer; can be used to power the board) (yellow)
Digital Pins
In addition to the specific functions listed below, the digital pins on an Arduino board
can be used for general purpose input and output via the pin Mode(), Digital Read(), and
Digital Write() commands. Each pin has an internal pull-up resistor which can be turned on
and off using digital Write() (w/ a value of HIGH or LOW, respectively) when the pin is
configured as an input. The maximum current per pin is 40mA.
Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data.
On the Arduino Diecimila, these pins are connected to the corresponding pins of the
FTDI USB-to-TTL Serial chip. On the Arduino BT, they are connected to the
corresponding pins of the WT11 Bluetooth module. On the Arduino Mini and LilyPad
Arduino, they are intended for use with an external TTL serial module (e.g. the Mini-
USB Adapter).
PWM: 3, 5, 6, 9, 10, and 11 Provide 8-bit PWM output with the analog Write()
function. On boards with an ATmega8, PWM output is available only on pins 9, 10,
and 11.
BT Reset: 7. (Arduino BT-only) Connected to the reset line of the bluetooth module.
LED: 13. On the Diecimila and LilyPad, there is a built-in LED connected to digital
pin 13. When the pin is HIGH value, the LED is on, when the pin is LOW, it's off.
Analog Pins
In addition to the specific functions listed below, the analog input pins support 10-bit
analog-to-digital conversion (ADC) using the analog Read() function. Most of the analog
inputs can also be used as digital pins: analog input 0 as digital pin 14 through analog input 5
as digital pin 19. Analog inputs 6 and 7 (present on the Mini and BT) cannot be used as
digital pins.
I2C: 4 (SDA) and 5 (SCL). Support I2C (TWI) communication using the Wire library
(documentation on the Wiring website).
Power Pins
VIN (sometimes labeled "9V"): The input voltage to the Arduino board when it's
using an external power source (as opposed to 5 volts from the USB connection or
other regulated power source). You can supply voltage through this pin, or, if
supplying voltage via the power jack, access it through this pin. Also note that the
Lily Pad has no VIN pin and accepts only a regulated input.
5V: The regulated power supply used to power the microcontroller and other
components on the board. This can come either from VIN via an on-board regulator,
or be supplied by USB or another regulated 5V supply.
3V3 (Diecimila-only) : A 3.3 volt supply generated by the on-board FTDI chip.
GND: Ground pins.
Other Pins
AREF: Reference voltage for the analog inputs. Used with analog Reference().
Reset: (Diecimila-only) Bring this line LOW to reset the microcontroller. Typically
used to add a reset button to shields which block the one on the board.
B.2.Source Code
#include<LiquidCrystal.h>
LiquidCrystal lcd(8,9,10,11,12,13);
int light=2;
int fan=3;
char a;
void setup() {
// put your setup code here, to run once:
pinMode(light,OUTPUT);
pinMode(fan,OUTPUT);
digitalWrite(light,LOW);
digitalWrite(light,LOW);
Serial.begin(9600);
lcd.begin(16,2);
lcd.setCursor(0,0);
lcd.print("Bluetooth Based ");
lcd.setCursor(0,1);
lcd.print("Home Automation ");
delay(5000);
lcd.clear();
}
void loop() {
// put your main code here, to run repeatedly:
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Waiting for cmd:");
while(!Serial.available());
a=Serial.read();
if(a=='1')
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Light ON");
digitalWrite(light,HIGH);
delay(3000);
}
if(a=='2')
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Light OFF");
digitalWrite(light,LOW);
delay(3000);
}
if(a=='3')
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Fan on");
digitalWrite(fan,HIGH);
delay(3000);
}
if(a=='4')
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Fan OFF");
digitalWrite(fan,LOW);
delay(3000);
}
if(a=='5')
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("All on");
digitalWrite(light,HIGH);
digitalWrite(fan,HIGH);
delay(3000);
}
if(a=='6')
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("All OFF");
digitalWrite(light,LOW);
digitalWrite(fan,LOW);
delay(3000); } }