Bluetooth Home Automation
Bluetooth Home Automation
ACKNOWLEDGEMENT
We are very grateful to our project guide of Electronics &
Instrumentation Engineering, DVSIET Meerut, Prof. Prashant
Raghav, who laid the time bound program for the successful
completion of this project. He initiated our thoughts and extended
timely suggestions and for his technical support and valuable
suggestions for which we are deeply indebted to him. We are grateful to
him for his comments and insights in the preparation of this project
report without which this report would not have been completed.
Yours Sincerely,
.
2|Page BLUETOOTH BASED HOME AUTOMATION SYSTEM
Table of Content
1. Overview of Project
1.1 Introduction
1.2 Block diagram
1.3 Project Modules
2. Hardware Description
2.1 Microcontroller
2.1.1 ATMEGA 8
2.1.3 Features
2.1.4 Pin diagram
2.1.5 Pin description
2.1.6 Special Function Registers
2.1.7 Memory Organization
2.1.7.1 Program Memory
2.1.7.2 Data Memory
2.1.8 Watchdog Timer
2.3 Driver IC
2.3.1 ULN2003 Darlington Transistor Arrays
2.3.2 Simplified Schematics
2.3.3 Functional Block Diagram
2.3.4 Pin diagram
2.3.5 Inductive Load Drive
2.3.6 Resistive Load Drive
3|Page BLUETOOTH BASED HOME AUTOMATION SYSTEM
2.4 Switches
2.4.1Relay
2.5 Connector
2.6 Aurdino burner
2.7Power supply
3. Software Introduction
3.1 PROTEUS
3.2 KEIL
3.3 VP812
3.4 Android App
4. Serial communication-Introduction
Serial communication in 89s52
4.1 Selection of baud rate
4.2 SBUF register
4.2.1 Configuration of SCON register
4.2.2 SM0, SM1
4.3 REN (receive enable)
4.4 TI (transmit interrupt)
4.5 RI (receive interrupt)
4.6 Steps for transmitting and receiving of character
4.6.1The steps that 8051 goes through in transmitting a character via
TxD
4.6.2Programming the 8051 to transfer character bytes serially
4.6.3Importance of TI Flag
4.6.4Programming the 8051 to receive character bytes serially
5. Program
5.1 PROGRAM CODES
5.2 Program detail
4|Page BLUETOOTH BASED HOME AUTOMATION SYSTEM
7. Problem descriptions
8. Advantages & Disadvantages
8.1 Advantages
8.2 Disadvantages
9. Future scope
10. Conclusion
References
5|Page BLUETOOTH BASED HOME AUTOMATION SYSTEM
Abstract
The main objective of this project is to develop a home automation system using
an Arduino board with Bluetooth being remotely controlled by any Android OS
smart phone. As technology is advancing so houses are also getting smarter.
Modern houses are gradually shifting from conventional switches to centralized
control system, involving remote controlled switches. Presently, conventional wall
switches located in different parts of the house makes it difficult for the user to go
near them to operate. Even more it becomes more difficult for the elderly or
physically handicapped people to do so. Remote controlled home automation
system provides a most modern solution with smart phones……………….
1.1 INTRODUCTION:
Automation involves introducing a degree of computerized or automatic control
to certain electrical and electronic systems in a building. These include lighting,
temperature control, etc. The past decade has seen significant advancement in
the field of consumer electronics. Various intelligent appliances such as cellular
phone, air conditioners, home security devices, home theaters, etc., are set to
realize the concept of a smart home. They have given rise to a Personal Area
Network in home environment, where all these appliances can be interconnected
and monitored using a single controller.
Although automation today is not a new thing but most advanced home
automation systems in existence today require a big and expensive change of
infrastructure. We have proposed an automation system that can control
appliances like TVs, Fan, Tube lights from an android mobile using Bluetooth. In
this a low cost secure cell phone based, flexible automation system is introduced.
Devices are connected to the microcontroller based switching circuit.
6|Page BLUETOOTH BASED HOME AUTOMATION SYSTEM
The communication between the cell phone and the microcontroller board is
wireless. Additional devices can be connected into the system with little
modifications. The phone will be Android OS based phone. The switching circuit
will be having microcontroller coding to control the electronics devices like fans
and lights etc. 8-bit microcontroller board based on the ATMEGA 8 and the HC-05
Bluetooth module is used. It supports wireless serial communication over
Bluetooth. This board has 32 digital input and output ports.
Different home or office appliances are connected to the digital output ports of
the circuit via relays to provide sufficiently high currents and voltage
compatibility. For test purposes, 25W, 240V lamps will be used.
Project Aim
The aim of the project is to design and construct a home automation system that
will remotely switch on or off any household appliances connected to it, using a
microcontroller Bluetooth based android application and operate music song with
the help of Bluetooth app.
Project 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 appliance , using a microcontroller to achieve hardware
simplicity ,low cost short messaging service for feedback and voice dial from any
phone to toggle the switch state and hearing music with the mobile phone app.
Music can be also be listened via Bluetooth through this app.
This project work is complete on its own in remotely and automatically switching
on or off of an electrical appliance not limited to household appliances and sends
a feedback message indicating the new present state of the appliance.
Description of the Project
This project is one of the important Arduino Projects. Arduino based home
automation using Bluetooth project helps the user to control any electronic
device using Device Control app on their Android Smartphone. The android app
sends commands to the controller – Arduino, through wireless communication,
namely, Bluetooth. The Arduino is connected to the main PCB which has five
relays as shown in the block diagram. These relays can be connected to different
electronic devices. As per the block diagram, Device 1 – LIGHT, Device 2- Fan,
Device 3 – Lights, Device 4 – motor
When the user presses on the ‘On’ button displayed on the app for the device 1,
the Buzzer is switched on. This Buzzer can be switched off, by pressing the same
button again.
Similarly, when the user presses on the ‘On’ button displayed on the app for the
device 2, the fan is switched on. The fan can be switched off, by pressing the same
button again.
This project of home automation using Bluetooth and Arduino can be used for
controlling any AC or DC devices. In the demonstration, we have used DC Fan
and DC Bulb. To drive this DC Fan and Light, a 9V battery is connected. We have
used a HD card module to add 4 different songs in this app and any of those
songs can be heard via Bluetooth.
2. Hardware Description
2.1 Microcontroller:-Micro controller is just like a small computer but the basic
difference comes in size and memory. These have CPU, RAM, ROM, I/O and
timers are all on a single chip. It means you don’t need any extra device to make it
functional like with a micro-processor. Generally this microcontroller is used
where a specific task is needed to do. So fixed amount of on-chip ROM, RAM, and
number
The Atmel®AVR® core combines a rich instruction set with 32 general purpose
working registers. All the 32 registers are directly connected to the Arithmetic
Logic Unit (ALU), allowing two independent registers to be accessed in one single
instruction executed in one clock cycle. The resulting architecture is more code
efficient while achieving throughputs up to ten times faster than conventional
CISC microcontrollers.
9|Page BLUETOOTH BASED HOME AUTOMATION SYSTEM
2.1.3. Features
Port B (PB7..PB0)
XTAL1/XTAL2/TOSC1/
TOSC2
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 Oscillator amplifier and input to the internal clock operating
circuit. Depending on the clock selection fuse settings, PB7 can be used as output
from the inverting Oscillator amplifier.
If the Internal Calibrated RC Oscillator is used as chip clock source, PB7..6 is used
as TOSC2..1 input 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.
13 | P a g e BLUETOOTH BASED HOME AUTOMATION SYSTEM
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. The minimum pulse length is given in Table 15 on page
38. Shorter pulses are not guaranteed to generate a Reset. The various special
features of Port C are elaborated on page 61.
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. Port D also serves the functions of various special features of the
ATmega8
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. The minimum pulse length is
given in Table 15. Shorter pulses are not guaranteed to generate a reset.
AVCC
AVCC is the supply voltage pin for the A/D Converter, Port C (3..0), and ADC
(7..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
Port C (5..4) use digital supply voltage, VCC.
14 | P a g e BLUETOOTH BASED HOME AUTOMATION SYSTEM
AREF
AREF is the analog reference pin for the A/D Converter.
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
Blue core 04‐External single chip Bluetooth system with CMOS technology and
15 | P a g e BLUETOOTH BASED HOME AUTOMATION SYSTEM
with AFH (Adaptive Frequency Hopping Feature). It has the Foot print as small as
12.7mmx27mm.
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 Bluetooth
Wireless networks for short range communications have a wide spread usage of
Bluetooth radio transmissions between 2400–2480 MHz Modern mobile devices
embed small, low-powered and cheap integrated chips functioning as short-range
radio transceivers for Bluetooth radio communications. Device pairing,
authentication, encryption and authorization techniques have given recognition
to Bluetooth technology due to its vital security mechanisms.
2.2.1. Specifications
Hardware features
Typical -80dBm sensitivity.
Up to +4dBm RF transmits power.
Low Power 1.8V Operation, 3.3 to 5 V I/O.
PIO control.
UART interface with programmable baud rate.
With integrated antenna.
With edge connector.
Software features
Slave default Baud rate: 9600, Data bits:8, Stop bit:1,Parity:No parity.
PIO9 and PIO8 can be connected to red and blue led separately. When master
and slave are paired, red and blue led blinks 1time/2s in interval, while
disconnected only blue led blinks 2times/s.
Auto connects to the last device on power as default.
Permit pairing device to connect as default.
Auto pairing PINCODE:”1234” as default.
2.2.4. Pairing:
After connect the Bluetooth module, scan for new devices from the Android
phone and you will find the module with the device name “HC-05”, after that,
click to connect, if some message appears asking about “Pairing code” just put
“1234” as default code.
BLUE LED = ACTIVE (Blinking 500ms period inactive connection, change 1seg with
active connection)
2. Supply power to the module. Then the module will enter to communication
mode. It can be used for pairing.
18 | P a g e BLUETOOTH BASED HOME AUTOMATION SYSTEM
The IC is powered using the pin 6 (typically 5 or 9V) and the ground pin 4 is connected
to the ground. The inverting pin (pin 2) is normally grounded and the Non-inverting pin
(pin 3) is provided with the Audio signal. This audio signal can be from a microphone or
even from a 3.5mm jack. The 10k resistor is added in series with the audio signal to act
as a volume control. You can ignore this potentiometer if you want to operate in full
volume.
Applications
AM and FM Radio amplifiers
Portable music players
Low Power Audio amplifiers
Wienbridge oscillator
Power Amplifiers
Audio booste
19 | P a g e BLUETOOTH BASED HOME AUTOMATION SYSTEM
2.4.1 Relay:-
Relays are electromagnetic switch. Which can be turn on and off by Appling
electrical current. Working voltage is printed on the relay. In this project we are 22 |
using 6volt relay. Many relay use an electromagnet to mechanically operate a
switch.
Fig.10. .Relays
2.5 SD CARD MODULE
The module (MicroSD Card Adapter) is a Micro SD card reader module and the
SPI interface via the file system driver, microcontroller system to complete
the Micro SD card read and write files. Users can directly use the Arduino IDE
comes with an SD card to complete the library card initialization and read-
write. . 3.3V voltage regulator circuit: LDO regulator output is 3.3V level
converter chip, Micro SD card supply. Level conversion circuit: Micro SD card
into the direction of the signal is converted to 3.3V, MicroSD card interfaces to
control the direction of the MISO signal is also converted into 3.3V, general
AVR microcontroller system can read the signal , . Micro SD card connector: a
self: bomb deck, easy card insertion. Positioning holes: 4 M2 screws
positioning hole diameter is 2.2mm, the positioning of the module is easy to
install, to achieve inter: module combination ,
2.5.1 Specifications
The level conversion circuit board that can interface level is 5V or 3.3V
Control Interface: A total of six pins (GND, VCC, MISO, MOSI, SCK, CS), GND
to ground, VCC is the power supply, MISO, MOSI, SCK is the SPI bus, CS is the
Level Conversion Circuit: Micro SD card into the direction of signals into
3.3V, microSD card toward the direction of the control interface MISO signal
is also converted to 3.3V, general AVR microcontroller system can read the
signal
Control Interface: A total of six pins (GND, VCC, MISO, MOSI, SCK, CS), GND
to ground, VCC is the power supply, MISO, MOSI, SCK is SPI bus, CS is the
Arduino is common term for a software company, project, and user community,
that designs and manufactures computer open-source hardware, open-source
software, and microcontroller-based kits for building digital devices and
interactive objects that can sense and control physical devices.[1]
The first Arduino was introduced in 2005, aiming to provide a low cost, easy way
for novices and professionals to create devices that interact with their
environment using sensors and actuators. Common examples of such devices
intended for beginner hobbyists include simple robots, thermostats, and motion
detectors.
The first Arduino was introduced in 2005, aiming to provide a low cost, easy way
for novices and professionals to create devices that interact with their
environment using sensors and actuators. Common examples of such devices
intended for beginner hobbyists include simple robots, thermostats, and motion
detectors.
25 | P a g e BLUETOOTH BASED HOME AUTOMATION SYSTEM
TMRpcm tmrpcm;
String song1="audio1";
String song2="audio2";
String song3="audio3";
String song4="audio4";
String inputString="",temp;
boolean stringComplete=false;
void setup() {
tmrpcm.speakerPin = 9;
Serial.begin(9600);
pinMode(op1,OUTPUT);
pinMode(op2,OUTPUT);
pinMode(op3,OUTPUT);
pinMode(op4,OUTPUT);
digitalWrite(op1,HIGH);
digitalWrite(op2,HIGH);
digitalWrite(op3,HIGH);
digitalWrite(op4,HIGH);
if (!SD.begin(SD_ChipSelectPin)) {
Serial.println("SD fail");
return;
}
else{
Serial.println("SD ok");
}
}
inputString="";
stringComplete=false;
inputString.reserve(50);
delay(1000);
void loop()
{
getSerialData();
if(stringComplete)
{
for(int i=0;i<inputString.length();i++)
{
temp="SONG 1";
if(inputString.substring(i,i+temp.length())==temp)
{ tmrpcm.stopPlayBack(); delay(200); tmrpcm.play(song1); }
temp="SONG 2";
if(inputString.substring(i,i+temp.length())==temp)
{ tmrpcm.stopPlayBack(); delay(200); tmrpcm.play(song2); }
temp="SONG 3";
if(inputString.substring(i,i+temp.length())==temp)
{ tmrpcm.stopPlayBack(); delay(200); tmrpcm.play(song3); }
temp="SONG 4";
if(inputString.substring(i,i+temp.length())==temp)
{ tmrpcm.pause(); delay(200); tmrpcm.play(song4); }
temp="STOP";
if(inputString.substring(i,i+temp.length())==temp)
{ tmrpcm.stopPlayBack(); }
temp="PAUSE";
if(inputString.substring(i,i+temp.length())==temp)
{ tmrpcm.stopPlayBack(); }
temp="LIGHT 1 ON";
if(inputString.substring(i,i+temp.length())==temp)
digitalWrite(op1,LOW);
temp="LIGHT 2 ON";
if(inputString.substring(i,i+temp.length())==temp)
digitalWrite(op2,LOW);
temp="BULB ON";
if(inputString.substring(i,i+temp.length())==temp)
digitalWrite(op3,LOW);
temp="FAN ON";
if(inputString.substring(i,i+temp.length())==temp)
digitalWrite(op4,LOW);
temp="LIGHT 1 OFF";
if(inputString.substring(i,i+temp.length())==temp)
digitalWrite(op1,HIGH);
temp="LIGHT 2 OFF";
if(inputString.substring(i,i+temp.length())==temp)
digitalWrite(op2,HIGH);
temp="BULB OFF";
if(inputString.substring(i,i+temp.length())==temp)
digitalWrite(op3,HIGH);
temp="FAN OFF";
if(inputString.substring(i,i+temp.length())==temp)
digitalWrite(op4,HIGH);
void getSerialData()
{
char inChar;
if(Serial.available()>0)
while(Serial.available()>0)
{
inChar= (char)Serial.read();
inputString+=inChar;
if(inChar=='#')
stringComplete=true;
}
}
39 | P a g e BLUETOOTH BASED HOME AUTOMATION SYSTEM
7. Problem description
The various problems & FAQ’s associated with the project are:
In fig a two way connection with relay is shown. The control act as a XOR
operation mines that output is one when both input are same. So output is
available when positions of both switches are same.
44 | P a g e BLUETOOTH BASED HOME AUTOMATION SYSTEM
8.1 Advantages
1. Wireless control:-
By using this project wireless control can be within the hands of user.
2. Monitoring:-
3. Status checking :-
When user doesn’t know appliances is on off then user can only check the
status only.
4. Confirmation of changing switch state:-
When switch is press ten two status will be shown on mobile phone i.e. old
status and new status
5. Manual control:-
8.2. Disadvantages:-
1. Bluetooth range:-
47 | P a g e BLUETOOTH BASED HOME AUTOMATION SYSTEM
2. Connection:-
Application must be connected after disconnection from Bluetooth.
If new user want to connect then first download application software and
then code must be enter and more configuration must be done.
9. FUTURE SCOPE
monitor your home while sitting in a remote area. By doing this, one can keep an
eye on his or her home through an internet connected to the user’s mobile phone
or PC or laptop. This will not only improve the security of your home in this
modern day world but will also assist in conservation of energy like if you left any
home appliance switched on by mistake, then you can check the status of the
appliance on the graphical interface made on your mobile and can switch it off
In conclusion, this low cost system is designed to improve the standard living in
home. The remote control function by smart phone provides help and assistance
allows the system install in more simple way. The control board is directly
controlled by relay.
For future work, the Window GUI will be implemented with speech recognition
voice control. The android GUI will be implemented as a remote Bluetooth
49 | P a g e BLUETOOTH BASED HOME AUTOMATION SYSTEM
microphone to the Window GUI. All the voice signal inputs to the smart phone
will be transmitted to the Window GUI for signal processing. Also, the push
buttons implemented in low voltage activating switches will be replaced by
capacitive sensing switches. All the future work is expected without spend extra
cost, even one cent from the current system.
REFERENCES
2. www.vp812.com