Bluetooth Robot Control FULL Report
Bluetooth Robot Control FULL Report
Bluetooth Robot Control FULL Report
PROJECT REPORT
Submitted on
BACHELOR OF TECHNOLOGY
IN
Electronics’ & Communication Engineering.
Abstract
The past decade has seen significant advancement in the field of consumer electronics.
Various ‘intelligent’ appliances such as cellular phones, air-conditioners, home
security devices, home theatres, 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.
Busy families and individuals with physical limitation represent an attractive market
for ROBOT CONTROL and networking. A wireless home network that does not
incur additional costs of wiring would be desirable. Bluetooth technology, which has
emerged in late 1990s, is an ideal solution for this purpose.
Page 2
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Table of Content
Chapter
Particulars Page No.
No.
i Declaration i
ii Certificate ii
iii Acknowledgment iii
iv Abstract iv
vi Table of Contents v-vii
vi List of figures viii
viii Abbreviations ix
Page 3
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Conclusion 50
References 51
Page 5
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
List of Figures
Figure
Figure Name Page No.
No
Page 6
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
General Abbreviation
PLC: Programmable logic controllers.
Page 7
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
I/P: Input
O/P: Output.
T-On: On timer.
M: Memory Bits.
Q: Output in program.
Chapter 1
OVERVIEW OF PROJECT
Page 8
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Chapter 1
OVERVIEW OF PROJECT
1.1. INTRODUCTION:
Page 9
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Although automation today is not a new thing but most advanced ROBOT
CONTROL 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.
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
atmel89s52 and the HC-05 Bluetooth module is used. It supports wireless
Page 10
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
serial communication over Bluetooth. This board has 32 digital input and
output ports.
Page 11
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Page 12
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Chapter 2
Hardware Description
Page 13
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Chapter 2
Hardware Description
Page 14
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
until the next interrupt or hardware reset. The block diagram is shown
below.
2.1.3. Features
i. Compatible with MCS®-51 Products
ii. 8K Bytes of In-System Programmable (ISP) Flash Memory
– Endurance: 10 k Write/Erase Cycles
iii. 4.0V to 5.5V Operating Range
iv. Fully Static Operation: 0 Hz to 33 MHz
v. Three-level Program Memory Lock
vi. 256 x 8-bit Internal RAM
vii. 32 Programmable I/O Lines
viii. Three 16-bit Timer/Counters
ix. Eight Interrupt Sources
x. Full Duplex UART Serial Channel
xi. Low-power Idle and Power-down Modes
Page 15
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Page 16
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
GND:
Pin 20 is the ground.
RST:
Pin 9 is the RESET pin. It is an input and is active high. Upon applying a
high pulse to this pin the microcontroller well reset and terminate all
activities. This is often referred to as a power on reset .Activating a power
on reset will cause all values the registers to be lost. It will set program
counter to all 0s.
In order for the RESET input to be effective it must have a minimum
duration of two machine cycles. In other words the high pulse must be
high for a minimum of two machine cycles before it is allowed to go low.
EA:
The 8051 family members such as the 8751/52, 89C51/52 or DS89C4*0 all
Page 17
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
come with on chip ROM to store programs. In such cases the EA pin is
connected to Vcc. For family members such as the 8031 and 8032 in which
there is no on chip ROM, code is stored on an external ROM and is fetched
by 8031/32. Therefore for the 8031 the EA pin must be connected to GND
to indicate that the code is stored externally. EA which stands for “external
access” is pin number 31 in the DIP packages. It is an input pin and must
be connected to either Vcc or GND. In other words it cannot be
unconnected.
PSEN:
This is an output pin. PSEN stands for “program store enable”. In an 8031
based system in which an external ROM holds the program code, this pin is
connected to the OE pin of the ROM.
ALE:
ALE stands for “address latch enable. It is an output pin and is active high.
When connecting an 8031 to external memory, port 0 provides both
address and data. In other words the 8031 multiplexes address and data
through port 0 to save pins. The ALE pin is used for de-multiplexing the
address and data by connecting to G pin of the 74LS373 chip.
PORTS 0,1,2,3:
All the ports upon RESET are configured as input, since P0-P3 have value
FFH on them. The following is a summary of features of P0-P3.
PORT 0:
Port 0 is also designated as AD0-AD7 allowing it to be used for both
address and data. When connecting an 8051/31 to an external memory,
port 0 provides both address and data. The 8051 multiplexes address and
data through port 0 to save pins. ALE indicates if p0 has address A0-A7.in
the 8051 based systems where there is no external memory connection
Page 18
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Port 1:
Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 1
output buffers can sink/source four TTL inputs. When 1s are written to Port
1 pins, they are pulled high by the internal pull-ups and can be used as
inputs. As inputs, Port 1 pins that are externally being pulled low will
source current (IIL) because of the internal pull-ups. In addition, P1.0 and
P1.1 can be configured to be the timer/counter 2 external count input
(P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively,
as shown in the following table. Port 1 also receives the low-order address
bytes during Flash programming and verification.
Page 19
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Port 2
Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2
output buffers can sink/source four TTL inputs. When 1s are written to Port
2 pins, they are pulled high by the internal pull-ups and can be used as
inputs. As inputs, Port 2 pins that are externally being pulled low will
source current (IIL) because of the internal pull-ups. Port 2 emits the high-
order address byte during fetches from external program memory and
during accesses to external data memory that uses 16-bit addresses
(MOVX @ DPTR). In this application, Port 2 uses strong internal pull-ups
when emitting 1s. During accesses to external data memory that uses 8-
bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special
Function Register. Port 2 also receives the high-order address bits and
some control signals during Flash programming and verification.
Port 3
Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3
output buffers can sink/source four TTL inputs. When 1s are written to Port
3 pins, they are pulled high by the internal pull-ups and can be used as
inputs. As inputs, Port 3 pins that are externally being pulled low will
source current (IIL) because of the pull-ups. Port 3 receives some control
signals for Flash programming and verification. Port 3 also serves the
functions of various special features of the AT89S52, as shown in the
following table.
Page 20
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Timer 2 Registers: Control and status bits are contained in registers T2CON
(shown in Table 5- 2) and T2MOD (shown in Table 10-2) for Timer 2. The
register pair (RCAP2H, RCAP2L) is the Capture/Reload registers for Timer 2
in 16-bit capture mode or 16-bit auto-reload mode.
Dual Data Pointer Registers: To facilitate accessing both internal and external
data memory, two banks of 16-bit Data Pointer Registers are provided:
DP0 at SFR address locations 82H-83H and DP1 at 84H-85H. Bit DPS = 0 in
SFR AUXR1 selects DP0 and DPS = 1 selects DP1. The user should ALWAYS
initialize the DPS bit to the appropriate value before accessing the
respective Data Pointer Register.
Page 21
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
MCS-51 devices have a separate address space for Program and Data
Memory. Up to 64K bytes each of external Program and Data Memory can
be addressed.
The AT89S52 implements 256 bytes of on-chip RAM. The upper 128 bytes
occupy a parallel address space to the Special Function Registers. This
means that the upper 128 bytes have the same addresses as the SFR
space but are physically separate from SFR space.
For example, the following direct addressing instruction accesses the SFR
at location 0A0H (which is P2).
MOV 0A0H, #data
Instructions that use indirect addressing access the upper 128 bytes of
RAM. For example, the following indirect addressing instruction, where R0
contains 0A0H, accesses the data byte at address 0A0H, rather than P2
(whose address is 0A0H).
Page 22
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Page 23
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
2.2.1. Specifications
Hardware features
Typical -80dBm sensitivity.
Page 24
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
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.
Page 25
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
2.2.4. Pairing:
Page 26
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
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.
Page 27
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Page 29
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Page 30
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
When the COM pin is tied to the coil supply voltage, ULN2803A is able to
drive inductive loads and suppress the Kick-back voltage via the internal
freewheeling diodes.
2.3.6 Resistive Load Drive
When driving a resistive load, a pull-up resistor is needed in order for
ULN2803A to sink current and for there to be a logic high level. The COM
pin can be left floating for these applications
2.4 Switches:-
Switches are used for connecting or disconnecting electrical circuit. Many
types of switches are there. Some are operate mechanically or electrically.
Some types are SPST, SPDT, DPST and DPDT in case of switch. SPST
stands for single pole single through, SPDT stands for single pole double
through, DPST stands for double pole single through and DPDT stands for
double pole double through,
In relays points are defines by NO, NC.
NO stand for normally on and NC stands for normally off.
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 using 6volt relay. Many relay use an electromagnet to
mechanically operate a switch.
Page 31
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Fig.10. .Relays
2.5 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.
Page 32
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
matched”. This vp812 burner comes with support cd which has software.
This cd includes usb to serial software.
Page 33
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Page 34
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Chapter 3
Software
Page 35
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Chapter 3
Software
3.1 PROTEUS:-
Proteus is software in which we can design the circuit with using hard ware
component. In this software input and output relation is shows in this
software.
Page 36
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
can be made in this circuit can be analogies or digital. Hear many testing
device are presented in this like ammeter, voltmeter, oscilloscope etc.
3.2KEIL:-
Keil software is used to convert c language program to hex file format
which can easily bun in micro controller.
Page 37
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Chapter4
Serial communication in 89s52
Page 38
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Chapter4
Serial communication in 89s52
Page 39
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
For a byte data to be transferred via the Txd line, it must be placed in the
SBUF register. The moment a byte is written into SBUF, it is framed with
the start and stop bits and transferred serially via the Txd line
SBUF holds the byte of data when it is received by 8051 RxD line .When
the bits are received serially via RxD, the 8051 de frames it by eliminating
the stop and start bits, making a byte out of the data received, and then
placing it in SBUF.
Page 40
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
By checking the TI flag bit, we know whether or not the 8051 is ready to
transfer another byte .It must be noted that TI flag bit is raised by 8051
itself when it finishes data transfer ¾It must be cleared by the
programmer with instruction CLR TI ¾If we write a byte into SBUF before
the TI flag bit is raised, we risk the loss of a portion of the byte being
transferred .The TI bit can be checked by ¾The instruction JNB TI, xx
.Using an interrupt.
Page 42
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Page 43
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
3. The SCON register is loaded with the value 50H, indicating serial
mode 1, where an 8- bit data is framed with start and stop bits
4. TR1 is set to 1 to start timer 1
5. RI is cleared by CLR Reinstruction
6. The RI flag bit is monitored with the use of instruction JNB RI, xxto
see if an entire character has been received yet
7. When RI is raised, SBUF has the byte, its contents are moved into a
safe place
8. To receive the next character, go to step 5
Chapter 5
Program
Page 44
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Chapter 5
Program
#define OUT_PORT1 P2
#define HIGH 1
sbit IN = P2^0;
Page 45
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
void com3();
void com2();
void com1();
unsigned char z;
void main()
SCON=0x50;
Page 46
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
old = SBUF;
RI=0;
delay(30);
rx = SBUF;
RI=0;
if (old = rx)
mybyte = old;
else
mybyte = rx;
if(mybyte==0x01)
CFL1=CFL1^HIGH;//toggle bit
mybyte=0xff;
old =0xff;
if(IN2==0)
{ //check switch on
Page 47
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
else
com1();
else if(mybyte==0x02)
CFL2=CFL2^HIGH;
mybyte=0xff;
if(IN==0) {
com2();
else
com1();
else if(mybyte==0x03)
Page 48
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
CFL3=CFL3^HIGH;
mybyte=0xff;
if(CFL3==0) {
com1();
else
com2();
SBUF=P2;
TI=0;
value
Page 49
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
if(IN==0)
{ //check switch on
else
com1();
1 value
if(IN2==0)
{ //check switch on
else
Page 50
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
com1();
else
com3();
void com3()
for (z=0;z<15;z++) {
TI=0;
void com2()
Page 51
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
for (z=0;z<8;z++) {
TI=0;
void com1()
for (z=0;z<8;z++) {
TI=0;
unsigned int x, y;
for(x = 0; x<=ms;x++)
Page 52
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
for(y=0;y<=1275;y++);
Page 53
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Chapter 6
Circuit diagram
&
Component List
Page 54
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Chapter 6
Circuit diagram & Component List
3 ULN2003 IC 3
4 5V relay 2
6 1K Resistor 1
10 7805 IC 2
11 9V battery 2
13 1N4007 diode 3
Page 56
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Page 57
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Chapter 7
Problem description
Page 58
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Chapter 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.
Page 59
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Page 60
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
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.
Chapter 8
Advantages
&
Disadvantages
Page 61
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Chapter 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.
5. Manual control:-
Manual control is given so an unskilled user can be change the
current status.
Page 62
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
8.2. Disadvantages:-
1. Bluetooth range:-
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.
Page 63
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Chapter 9
FUTURE SCOPE
Page 64
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Chapter 9
FUTURE SCOPE
monitor your home while sitting in a remote area. By doing this, one can
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.
Page 65
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
CONCLUSION
&
REFERENCES
Page 66
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
CONCLUSION
For future work, the Window GUI will be implemented with speech
recognition voice control. The android GUI will be implemented as a
remote Bluetooth 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.
Page 67
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
REFERENCES
3. www.vp812.com
Page 68
HOME AUTOMATION USING ANDROID PHONE OVER BLUETOOTH
Page 69