0% found this document useful (0 votes)
106 views

Bluetooth Home Automation

Uploaded by

CH Rajan Gujjar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
106 views

Bluetooth Home Automation

Uploaded by

CH Rajan Gujjar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 46

1|Page BLUETOOTH BASED HOME AUTOMATION SYSTEM

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.

We thank sincerely and profusely to all staff members of our


Department of our Institute for their valuable help and guidance.

We also express our gratitude to the Institute Management to all those


who have indirectly help us in the successful completion of this
project. Last but not the last, we are deeply indebted to our parents for
what we are today, because this project report would not have been a
reality without their love and support.

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.2 BLUETOOTH MODULE (HC-05):Overview


2.2.1 Specifications
2.2.2 Pin out configuration
2.2.3 Typical Application Circuit
2.2.4 Pairing
2.2.5 Hc-05 Bluetooth module working voltage
2.2.6 Serial communication

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

6. Circuit diagram & Component List


6.1 Component list

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……………….

In order to achieve this, a Bluetooth module is interfaced to the Arduino board at


the receiver end while on the transmitter end, a GUI application on the cell phone
sends ON/OFF commands to the receiver where loads are connected. By touching
the specified location on the GUI, the loads can be turned ON/OFF remotely
through this technology. In commercialize the loads are operated by Arduino
board through opto-isolators and thyristors using triacs.
1. OVERVIEW OF PROJECT

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.

This project demonstrates an automation system which contains a remote mobile


host controller and several client modules (eg.Office, home appliances). The client
modules communicate with the host controller through a wireless device such as
a Bluetooth enabled mobile phone, in this case, an android based Smart
phone…….

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.

The atmega 8 can be programmed using the microcontroller’s high-level


interactive embedded C language. The Bluetooth antenna in our module picks up
the packets sent from the cell phone. Subsequently, these packets containing the
device status as commands are pipelined through atmega8 microcontroller and
the designed analogue circuitry according to the definition of each output.

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.

We send commands from an application which is developed in phone to turn


ON/OFF a device. A feedback circuit has been designed and implemented to
indicate the devices actual status after it receives the command (ON/OFF) from
the cell phone. Once the command has been sent to turn ON a device, the
feedback circuit senses the current and gives an output signal by turning ON a
respective led on the switching circuitry indicating that the device is ON.
Otherwise, the device is malfunctioning indicating that the command was not
7|Page BLUETOOTH BASED HOME AUTOMATION SYSTEM

executed successfully. We can also operate the appliances of Home or Office in


Bluetooth range area.

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.

Project scope and limitation

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.

1.2 Block diagram:-


Figure 1: Block diagram of Bluetooth based home automation

In this block diagram communication is in both direction between android mobile


and Bluetooth module. This communication is done one by one only one at a
time. This communication is called half duplex.

Feedback is done by getting 220v.feedback circuitry is so deigned that


microcontroller can easily sense.

1.3 Project Modules :-


The project can be better described by dividing it into two categories, namely,
1. Hardware
2. Software
8|Page BLUETOOTH BASED HOME AUTOMATION SYSTEM

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

2.1.1.ATMEGA 8:- The Atmel AVR 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 ATmega8 achieves throughputs
approaching 1MIPS per MHz, allowing the system designer to optimize power
consumption versus processing speed.

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.2. Block Diagram:-

Figure 2: Block diagram of atmega 8 micro controller


10 | P a g e BLUETOOTH BASED HOME AUTOMATION SYSTEM

2.1.3. Features

I. High-performance, Low-power Atmel®AVR® 8-bit Microcontroller


II. Advanced RISC Architecture
III. 130 Powerful Instructions – Most Single-clock Cycle Execution
IV. 32 × 8 General Purpose Working Registers
V. Fully Static Operation

VI. Up to 16MIPS Throughput at 16MHz


VII. On-chip 2-cycle Multiplier
VIII. High Endurance Non-volatile Memory segments
IX. 8Kbytes of In-System Self-programmable Flash program memory
X. 512Bytes EEPROM
XI. 1Kbyte Internal SRAM
XII. Write/Erase Cycles: 10,000 Flash/100,000 EEPROM
XIII. Data retention: 20 years at 85°C/100 years at 25°C(1)
XIV. Optional Boot Code Section with Independent Lock Bits
XV. In-System Programming by On-chip Boot Program
XVI. True Read-While-Write Operation
– Programming Lock for Software Security
11 | P a g e BLUETOOTH BASED HOME AUTOMATION SYSTEM

2.1.4 Pin diagram:-

Fig. 3: Pin Diagram of ATMEGA 8

2.1.5. Pin description:-


VCC Digital supply voltage.
GND Ground.
2|Page BLUETOOTH BASED HOME AUTOMATION SYSTEM

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.

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.

2.2 BLUETOOTH MODULE (HC-05):


Overview: Communication device:-over project is based on wireless
communication between micro controller and mobile phone. But alone micro
controller is not able to communicate directly to the android mobile phone.
Bluetooth Serial module’s operation doesn’t need drive, and can communicate
with the other Bluetooth device that 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.

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.

Different types of Bluetooth applications can be developed using Android


platform architecture using the Bluetooth profiles. The device manufacturers
provide the services using the support of these profiles in their devices to
maintain compatibility for the Bluetooth technology

Fig. 5.HC-05 Bluetooth


16 | P a g e BLUETOOTH BASED HOME AUTOMATION SYSTEM

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.

 Auto reconnect in 30 min when disconnected as a result of beyond the


range of connection.
2.2.2. Pin out configuration

Figure 6: Pin-out of HC-05


17 | P a g e BLUETOOTH BASED HOME AUTOMATION SYSTEM

2.2.3. Typical Application Circuit:

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)

How to get to the standard communication mode

1. Leave free KEY, don’t connect it to VDD neither GND.

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

2.2.5. HC-05 BLUETOOTH MODULE WORKING VOLTAGE:-


The Bluetooth module HC-05 is used to receive & transmit data between
Bluetooth device and MCU. It requires power supply from 3.3V to 5V.

2.2.6. SERIAL COMMUNICATION:-


To transfer to a device located many meters away, the serial method is used. The
data is sent one bit at a time. Here not 8bit data is send 2 extra bit are send along
with it .this two bit are called start bit and stop bit. These two bit are used so
synchronization can be done between transmitter and receiver.

2.3 Driver IC:


2.3.1 LM 386 AMPLIFIER

The LM386 is a low power audio frequency amplifier which is very


commonly used in small audio amplifiers. The IC consumes very less power
and hence can be operated using a 9V battery easily. It can easily drive an 8-
ohm speaker with a variable gain of 20 to200. Volume control and gain
control is also possible in this. The IC comes in a 8-pin PDIP package and
requires very less components to function hence it is highly easy to use.
So, if you are looking for an audio amplifier IC which can be powered using a
battery for a portable application to drive an 8-ohm speaker then this IC might
be the right choice for you. For driving heavy speakers you have to use the
power amplifier ICs.

LM386 Audio amplifier features and specifications


 Supply Voltage: 4-15V
 Quiescent Power: 24mW @ 6V
 Analog input voltage 0.4V (maximum)
 Voltage Gain: 20 to 200 (26dB to 46dB)
 PSRR: 50dB
 Speaker impedance 4Ω
 Available in 8-Pin PDIP,SOIC and VSSOP packages
How to use LM386 IC
The LM386 only requires a couple of capacitors and resistors to start working. A very
basic commonly used LM386 circuit is shown below.

Fig. 7.Simplified Schematics of LM386 amplifier

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.3.3. 2d model Diagram:

Fig. 8 2d model diagram of LM386 amplifier

2.3.4 Pin diagram:-

Fig. 9.pin diagram of LM386


21 | 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 ,

Fig.11 SD CARD MODULE

2.5.1 Specifications
 The level conversion circuit board that can interface level is 5V or 3.3V

support micro SD card, micro SDHC card (high-speed card)

 Power supply is 4.5V ~ 5.5V, 3.3V voltage regulator circuit board

 Communication interface is a standard SPI interface

 4 M2 screw positioning holes for easy installation

 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

chip select signal pin

 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

chip select signal pin


2.6 Connector:-
Connectors are used for joining two wires temporally by using connector big
circuit can be divided and after completion they can rejoin. Now a day’s every
time inverter circuited can be removed out without using de soldering .

2.7 Aurdino burner:-


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.
23 | P a g e BLUETOOTH BASED HOME AUTOMATION SYSTEM

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 project is based on microcontroller board designs, produced by several


vendors, using various microcontrollers. These systems provide sets of digital and
analog I/O pins that can interface to various expansion boards (termed shields)
and other circuits. The boards feature serial communication interfaces, including
Universal Serial Bus (USB) on some models, for loading programs from personal
computers. For programming the microcontrollers, the Arduino project provides
an integrated development environment(IDE) based on a programming language
named Processing, which also supports the languages C and C++.
24 | P a g e BLUETOOTH BASED HOME AUTOMATION SYSTEM

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.

Arduino boards are available commercially in preassembled form, or as do-it-


yourself kits. The hardware design specifications are openly available, allowing
the Arduino boards to be produced by anyone. Adafruit Industries estimated in
mid-2011 that over 300,000 official Arduinos had been commercially produced,[2]
and in 2013 that 700,000 official boards were in users' hands.

The project is based on microcontroller board designs, produced by several


vendors, using various microcontrollers. These systems provide sets of digital and
analog I/O pins that can interface to various expansion boards (termed shields)
and other circuits. The boards feature serial communication interfaces, including
Universal Serial Bus (USB) on some models, for loading programs from personal
computers. For programming the microcontrollers, the Arduino project provides
an integrated development environment(IDE) based on a programming language
named Processing, which also supports the languages C and C++.

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

Arduino boards are available commercially in preassembled form, or as do-it-


yourself kits. The hardware design specifications are openly available, allowing
the Arduino boards to be produced by anyone. Adafruit Industries estimated in
mid-2011 that over 300,000 official Arduinos had been commercially produced,[2]
and in 2013 that 700,000 official boards were in users' hands.
29 | P a g e BLUETOOTH BASED HOME AUTOMATION SYSTEM

3. 2 Serial communication in atmega8


SERIAL COMMUNICATION-INTRODUCTION: Serial is a device
communication protocol that is standard on almost every PC. Do not confuse it
with universal serial bus (USB). Most computers include two EIA-232 based serial
ports. Serial is also a common communication protocol for instrumentation in
many devices, and numerous GPIB-compatible devices come with an EIA-232
port. Furthermore, you can use serial communication for data acquisition in
conjunction with a remote sampling device
5. Program

5.1 PROGRAM CODES:


#include <SD.h>
#define SD_ChipSelectPin 6
#include <TMRpcm.h>
#include <SPI.h>

TMRpcm tmrpcm;

unsigned int op1=2;


unsigned int op2=3;
unsigned int op3=4;
unsigned int op4=5;

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="ALL DEVICE ON";


if(inputString.substring(i,i+temp.length())==temp)
{
digitalWrite(op1,LOW);
digitalWrite(op2,LOW);
digitalWrite(op3,LOW);
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);

temp="ALL DEVICE OFF";


if(inputString.substring(i,i+temp.length())==temp)
{
digitalWrite(op1,HIGH);
digitalWrite(op2,HIGH);
digitalWrite(op3,HIGH);
digitalWrite(op4,HIGH);
}
}
inputString="";
stringComplete=false;
}
}

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

6. Circuit diagram & Component List

6.1. Component list:-

S.No Component Name Nos. Required


1 HC-05 Bluetooth module 1
2 ATMEGA8 micro controller IC 1
3 ULN2003 IC 3
4 5V relay 2
5 Crystal 12MHz or 11.0592MHz 1
6 1K Resistor 1
7 22µf or 10µf electrolyte capacitor 2
8 30pf or 22pf ceramic capacitor 2
9 10k resistor network 3
10 7805 IC 2
11 12V battery 2
12 220v to 6v-0-6v step down transformer 1
13 1N4007 diode 3
BLUETOOTH BASED HOME AUTOMATION SYSTEM

6.2 Circuit Diagram:

FIG 12. CIRCUIT DIAGRAM


BLUETOOTH BASED HOME AUTOMATION SYSTEM

7. Problem description

The various problems & FAQ’s associated with the project are:

7.1. No manual control to switch on and off or in system when


failed:-
In that case we can use a two way switch so if automation system fails than
control given to manual. As the manual control provided unskilled user can
perform his routine control. As shown below.

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

Fig. 13.Wiring connection to switch

7.2. No confirmation of change of output:-


To overcome this problem programming can be do so that controller can
compare its previous state. So if state of switch not changes than
controller send an error comes or no change.
7.3. No debugging option:-
This can be a very good feature of project i.e. you can check that where
problem comes at hardware or in software. So controller gave all
information about communication.

7.4. Complex user interface:-


User interface must be simple so no need to teach the other every time.
But in similar project interface is complex.
45 | P a g e BLUETOOTH BASED HOME AUTOMATION SYSTEM

7.5. Different key to on and off:-


In survey it is seen that there are two different key to turn n and off
appliances. But if in programming toggle of bit is done then more
automation can be done in this project.

7.6. Restart power at every new pairing of device:-


In HV-05 Bluetooth module if a device is parried then this configuration is
save. So at every new device pairing needs restart of circuit power. This
problem can be removed if we use a feature of HC-05 Bluetooth i.e.
“key” this a pin in Bluetooth that can remove all paired detail when this
pin high pulses. So connection of this pin with micro controller can rest
the pairing.

7.7. Large change in house wiring:-


In similar project the automation done by mobile only so all connection
needs to change in wiring and removal of button connection is needed .So
to avoid this circuit is so design as sown in problem 1 solution.

7.8. Security of hacking control:-


The Bluetooth connection kept open so other con connect and take
control. so the master user must connect to Bluetooth and removal of
pair info must by master controller by software control.
46 | P a g e BLUETOOTH BASED HOME AUTOMATION SYSTEM

8. Advantages & Disadvantages

8.1 Advantages

1. Wireless control:-
By using this project wireless control can be within the hands of user.

2. Monitoring:-

This circuit allow monitoring of all appliance within range of communication


with Bluetooth.

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:-

Manual control is given so an unskilled user can be change the current


status.

8.2. Disadvantages:-

1. Bluetooth range:-
47 | P a g e BLUETOOTH BASED HOME AUTOMATION SYSTEM

It is good to use Bluetooth for automation but automation is kept within a


range 0f 10-30 metres. So control can be achieved from outside range .

2. Connection:-
Application must be connected after disconnection from Bluetooth.

3. configuration of application software:-

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

This project can be further developed by integrating it with the internet to

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

using the internet connectivity.


10. CONCLUSION

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

especially to disabled and elderly. In order to provide safety protection to the

user, a low voltage activating switches is replaced current electrical switches.

Moreover, implementation of wireless Bluetooth connection in control board

allows the system install in more simple way. The control board is directly

installed beside the electrical switches whereby the switching connection is

controlled by relay.

Furthermore, flexible types of connections are designed as backup connections to


the system. The connected GUIs are synchronized to the control board. They
indicate the real-time switches status. The system is designed in user-friendly
interface. The easy to use interface on Window and Android GUI provides simple
control by the elderly and disabled people.

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

1. Electronics for you magine June 2013

Keil µvision IDE, http://www.keil.com/uvision.

2. www.vp812.com

3. Serial Bluetooth Module, Tiny OS Electronics, http://www.tinyosshop.com

4. AT89s52 8 bit Microcontroller, ATMEL Corporations,


http://www.atmel.com3.

5. The official Bluetooth website from Bluetooth SIG:


http://www.bluetooth.com

6. The 8051 microcontroller and embedded systems by Muhammad Ali Mazidi


and Janice Gillispie Mazidi.

You might also like