Sie sind auf Seite 1von 19

(/)

Bluetooth Controlled Home Automation System using 8051


(/microcontroller-projects/bluetooth-controlled-homeautomation-using-8051)
By Saddam

7 Comments (/microcontroller-projects/bluetooth-controlled-home-

automation-using-8051/#comments)

BuyGroceryOnline
GetUpto15%Off&Extra10%CashBack.UseCouponFR15.OrderNow!

Bluetooth Controlled Home Automation System Using 8051 Microcontroller

Imagine that you can control the electronic appliances of your home from anywhere inside the
house, just using your Smart phone.In this project, wewill use wireless Bluetooth technology to
control the Home Electronic Appliances through a Android Phone. Bluetooth has a range of 1015 meters, so that you can switch ON and OFF any electronic appliance within the range. We have
also developed a Toy car controlled by Android Phone (http://circuitdigest.com/microcontrollerprojects/bluetooth-controlled-robot-car-using-arduino), using Bluetooth module and Arduino.

Here we have used 8051 microcontroller with a Bluetooth module, for wirelessly receive the data,
sent from the Android Phone. So that microcontroller can Turn ON and OFF the home appliances
accordingly. [Check here more 8051 microcontroller based projects (http://circuitdigest.com/8051microcontroller-projects)]

Main Components
8051 microcontroller
Bluetooth Module HC05
Relay
ULN2003
Bulb
Holder
Wire
IC 7805
Android phone
Bluetooth controller app Android app
10uf capacitor
1000uf capacitor
10K resistor
1k resistor
Power Supply
Bluetooth Module:
HC-05 Bluetooth module consists two things one is Bluetooth serial interface module and a
Bluetooth adaptor. Bluetooth serial module is used for converting serial port to Bluetooth.

How to operate Bluetooth module?


You can directly use the Bluetooth module after purchasing from market, because there is no need
to change any setting of Bluetooth module. Default baud rate of new Bluetooth module is 9600
bps. You just need to connect rx and tx to controller or serial converter and give 5 volt dc regulated
power supply to module.

Bluetooth module has two modes one is master mode and second one is slave mode. User can set
either mode by using some AT commands. Even user can set modules setting by using AT
command. Here is some commands uses are given:

WindowsVistaDrivers
windowsvista.driverupdate.net

DriverUpdateforWindowsVistaMicrosoftCertifiedPartner!

StartDownload
panStamplowpowerradio
ColgateToothbrush
AegonLifeTermPlan
ClubMahindraHolidays
VirtualNumberforOffice
Recover/RepairDataFiles
SensorLibrary
HomeAutomation
First of all user need to enter AT mode with 38400 bps baud rate by pressing EN button at
Bluetooth module or by giving HIGH level at EN pin. Note: all commands should ends with \r\n
(0x0d and 0x0a) or ENTER KEY from keyboard.

After it if you send AT to module then module will respond with OK


AT Test Command
AT+ROLE=0 Slave Mode select
AT+ROLE=1 Master Mode select
AT+NAME=xyz Set Bluetooth Name
AT+PSWD=xyz Set Password
AT+UART=<value1>,<value2>,<value3> set Baud rate
Eg. AT+UART=9600,0,0

Pin Description of accelerometer:


1. STATE Open
2. Rx Serial receiving pin
3. Tx Serial transmitting pin
4. GND ground
5. Vcc+5volt dc
6. EN to enter in AT mode
7.

Working Explanation:
In this project we have used 8051 microcontroller for controlling the whole process of this project.
And a Bluetooth module is used for controlling the home appliances wirelessly. Home appliances
will turned ON and OFF when user will touch button in the Bluetooth mobile app in Android mobile
phone. To run this project, first we need to download Bluetooth app form Google play store. We
can use any Bluetooth app that can send data using Bluetooth. Here are some apps name that can
be used:
1. Bluetooth Spp pro
2. Bluetooth controller

After installing the App, you need to open it and then search Bluetooth device and select HC-05
Bluetooth device. And then configure keys.
Here in this project we have used Bluetooth controller app.
1. Download and install Bluetooth Controller.
2. Turned ON mobile Bluetooth.
3. Now open Bluetooth controller app
4. Press scan
5. Select desired Bluetooth device (Bluetooth Module HC-05).
6. Now set keys by pressing set buttons on screen
To set keys we need to press set button and set key according to picture given below:

After setting keys press ok.


You can see in the above picture that there are 9 buttons in which first row is for fan controlling,
second one is for light controlling and last one is for TV controlling. Means First rows ON and OFF
buttons are used to ON and OFF the fan, second rows buttons are for Light and third ones are for
TV. We have used three bulbs of different colors instead of TV and fan, for demonstration purpose.

Now, when we touch any button in Bluetooth controller app then Android phone sends a value to
Bluetooth module, after receiving this value, Bluetooth module sends the received value to the
microcontroller and then microcontroller reads it and compare it with predefined value. If any
match is occurred then microcontroller performs relative operation. Same operation will performed
each time when button pressed.

Now, when user touch Fan On button in Bluetooth controller app then microcontroller receives 1
via Bluetooth module and then controller Switch On the Fan by using relay driver and relay. And
when user touch Fan Off button in Bluetooth controller app then microcontroller receives 2 via
Bluetooth module and then controller Switch Off the Fan by using relay driver and relay.
Likewise 3,4,5,6 numbers are sent by Android Phone, when Light On, Light Off, TV On, TV Off button
has been touched respectively:
Button

Data

Operation

Fan On

Fan Turned On

Fan Off

Fan Turned Off

Light On

Light Turned On

Light Off

Light Turned Off

TV On

TV Turned On

TV Off

TV Turned Off

Circuit Diagram and Explanation


Circuit connections of this project are very simple. Bluetooth modules Rx and Tx pins are directly
connected to the Tx and Rx pins of Microcontroller. Three 5 volt relays are used as a switch for
turning On and Off the home appliances running on AC mains. And a relay driver ULN2003 is used
for driving relays. Fan, Light and TV are connected at P2.1, P2.2 and P2.3 via relays and relay driver.
An 11.0592 MHz Crystal oscillator is used in this circuit for generating clock signal for
microcontroller. And a 5 volt voltage regulator LM7805 is used for provide 5 volt for the whole
circuit.

65
Shares

19

(/fullimage?i=circuitdiagram_mic/Bluetooth-Controlled-Home-Automation-Circuit-diagram.gif)
Adsby Google BluetoothArduinoGPSArduinoOneArduinoRF

Program Explanation:
In this program, first of all we have included header file and defines input, output pins and
variables.
#include<reg51.h>

sbitFan=P2^0;
sbitLight=P2^1;
sbitTV=P2^2;

charstr;
charCharin=0;

After this we have created a function for delay.


voiddelay(inttime)
{
unsignedinti,j;
for(i=0;i<time;i++)
for(j=0;j<1275;j++);
}

Here we have some functions that we have used in our program. In this we have configured
9600bps baud rate at 11.0592MHz Crystal Frequency.

voidSerialwrite(charbyte)
{
SBUF=byte;
while(!TI);
TI=0;
}
voidSerialprintln(char*p)
{
while(*p)
{
Serialwrite(*p);
p++;
}
Serialwrite(0x0d);
}

voidSerialbegin()
{
TMOD=0x20;
SCON=0x50;
TH1=0xfd;
TR1=1;
}

After this, in main program we have initialized UART and monitored the SBUF register for receiving
the data. Then data is matched and compared with predefined values and relative operation has
been performed.

voidmain()
{
P2=0x00;
Serialbegin();
Serialprintln("SystemReady...");
delay(50);
while(1)
{
while(!RI);
Charin=SBUF;
str=Charin;
RI=0;
if(str=='1')
{
Fan=1;
Serialprintln("FanON");
delay(50);
}
elseif(str=='2')
{
Fan=0;
Serialprintln("FanOFF");
delay(50);
}

So thats how we can create a whole system for the house and can connect all the AC appliances
to the 8051 microcontroller using Relays. And this bluetooth controlled home automation
systemcan be operated from a Smart phone.
Adsby Google ArduinoGPSArduinoOneArduinoRFArduinoCan

Code:
#include<reg51.h>
sbit Fan=P2^0;
sbit Light=P2^1;
sbit TV=P2^2;
char str;
char Charin=0;
void delay(int time)
{
unsigned int i,j;
for(i=0;i<time;i++)
for(j=0;j<1275;j++);
}
void Serialwrite(char byte)
{
SBUF=byte;

while(!TI);
TI=0;
}
void Serialprintln(char *p)
{
while(*p)
{
Serialwrite(*p);
p++;
}
Serialwrite(0x0d);
}
void Serialbegin()
{
TMOD=0x20;
SCON=0x50;
TH1=0xfd;
TR1=1;
}
void main()
{
P2=0x00;
Serialbegin();
Serialprintln("System Ready...");
delay(50);
while(1)
{
while(!RI);
Charin=SBUF;
str=Charin;
RI=0;
if(str=='1')
{
Fan=1;
Serialprintln(" Fan ON");
delay(50);
}
else if(str=='2')
{
Fan=0;
Serialprintln(" Fan OFF");
delay(50);
}
else if(str=='3')
{
Light=1;

Serialprintln(" Light ON");


delay(50);
}
else if(str=='4')
{
Light=0;
Serialprintln(" Light OFF");
delay(50);
}
else if(str=='5')
{
TV=1;
Serialprintln(" TV ON");
delay(50);
}
else if(str=='6')
{
TV=0;
Serialprintln(" TV OFF");
delay(50);
}
str=0;
}
}

Video:
Bluetooth Controlled Home Automation Using 8051

Levelswitch
Robust,simplesolutions
forreliableleveldetection.

Add new comment (/microcontroller-projects/bluetooth-controlled-home-automation-using8051#comment-form)

Comments (7)

Pearl

reply (/comment/reply/246/1081)

Please I can't really interpret the circuit diagram and what software did you use for
the simulation (was it proteus)
Feb 05, 2016

saddam khan

reply (/comment/reply/246/1115)

this circuit diagram is draw by using dip trace software.


and i think it easy to understand. you need to give some of your concentration on
the circuit to understand.
try it again.
Feb 07, 2016

Shah Hussain

reply (/comment/reply/246/1208)

how to use AT commands in program


Feb 13, 2016

ronnie

reply (/comment/reply/246/1305)

Sir what IDE you use for code?


Feb 24, 2016

reply (/comment/reply/246/1325)

Abhishek
Use Keil IDE.

Feb 24, 2016

reply (/comment/reply/246/1321)

ronnie

sir i'm using egbt-045ms as my bluetooth module. what will be the adjustment?
Feb 24, 2016

reply (/comment/reply/246/1347)

ronnie

Can i usethe same android app. even i'm using egbt-045ms as my bluetooth
module?
Feb 25, 2016

Leave a comment
Your name *
E-mail *
The content of this field is kept private and will not be shown publicly.

Subject
Comment *

No HTML tags allowed.


Web page addresses and e-mail addresses
turn into links automatically.
Lines and paragraphs break automatically.

Save

Preview

RELATED CONTENT

More information about text formats (/filter/tips)

Interfacing ADC0808 with 8051 Microcontroller (/microcontroller-projects/interfacing-adc0808-with-8051microcontroller)


Digital Code Lock using 8051 Microcontroller (/microcontroller-projects/electronic-code-lock-using-8051microcontroller)
PIR Sensor and GSM Based Security System (/microcontroller-projects/pir-sensor-and-gsm-based-securitysystem)
RFID and Keypad Based Security System using 8051 Microcontroller (/microcontroller-projects/rfid-basedsecurity-system)
Cell Phone Controlled Robot using 8051 Microcontroller (/microcontroller-projects/cell-phone-controlledrobot-using-8051)

LATEST POSTS

(/microcontroller-projects/arduino-gps-clock)

Arduino GPS Clock (/microcontroller-projects/arduino-gps-clock)

(/microcontroller-projects/reading-gps-data-using-computer-and-arduino)

How to Use GPS with Arduino (/microcontroller-projects/reading-gps-data-usingcomputer-and-arduino)

(/microcontroller-projects/vehicle-tracking-system-using-arduino-gps-and-gsm)

Arduino based Vehicle Tracker using GPS and GSM (/microcontroller-projects/vehicletracking-system-using-arduino-gps-and-gsm)

Adsby Google

BluetoothDownload
InstallBluetooth
BluetoothDriver

(/electronic-circuits/simple-led-music-light)

Music Operated Dancing LEDs (/electronic-circuits/simple-led-music-light)

(/microcontroller-projects/arduino-snake-game-using-8x8-led-matrix)

Snake Game on 8x8 Matrix using Arduino (/microcontroller-projects/arduino-snakegame-using-8x8-led-matrix)

Add Project
(/node/add/community-projects)

USER LOGIN
E-mail or username *
Password *
Log in

Create new account (/user/register) Request new password (/user/password)

FEATURED PROJECTS AND CIRCUITS

(/microcontroller-projects/vehicle-

(/electronic-circuits/vu-meter-

(/electronic-circuits/simple-aud

tracking-system-using-arduino-

using-lm3914)

amplifier-circuit)

gps-and-gsm)

LED VU Meter using LM3914


and LM358 (/electronic-

Simple Audio Amplifier us


555 Timer IC (/electronic-

Arduino based Vehicle

View all Featured Projects (/featured-electronics-projects-and-circuits)

SIGN UP FOR LATEST NEWS


Subscribe

Popular Topics: Robotics Projects (/robotics-projects) | Arduino Uno Projects (/arduino-uno-projects) | Electronics
Projects (/electronics-projects) |555 Timer Circuits (/555-timer-circuits) | ATmega32 Projects (/atmega32-projects) |
ATmega8 Projects (/atmega8-projects) | Audio Circuits (/audio-circuits) | 4017 Circuits (/4017-circuits)

Copyright 2016Circuit Digest (http://circuitdigest.com/). All rights reserved


Privacy policy (http://circuitdigest.com/privacy-policy) | Disclaimer (http://circuitdigest.com/disclaimer)
|Contact Us (http://circuitdigest.com/contact) | AddProject
(http://circuitdigest.com/node/add/community-projects)| Advertise (http://circuitdigest.com/advertise)

Das könnte Ihnen auch gefallen