Bluetooth Based Home Automation

 BLUETOOTH   BASED  HOME   AUTOMATION


INTRODUCTION:     
          Wireless technologies are becoming more popular around the world and the consumers appreciate this wireless lifestyle which gives them relive of the well known “cable chaos” that tends to grow under their desk. Now with the embedded Bluetooth technology, digital devices form a network in which the appliances and devices can communicate with each other. Today, home automation is one of the major applications of Bluetooth technology. Operating over unlicensed, globally available frequency of 2.4GHz, it can link digital devices within a range of 10m to 100m at the speed of up to 3Mbps depending on the Bluetooth device class. With this capability of Bluetooth; we propose a home automation system based on Bluetooth technology

          There are few issues involved when designing a home automation system. The system should be scalable so that new devices can easily be integrated into it. It should provide a user- friendly interface on the host side, so that the devices can be easily setup, monitored and controlled. This interface should also provide some diagnostic services so that if there is any problem with the system, it can be tracked down. Moreover the overall system should be fast enough to realize the true power of wireless technology. Finally the system should be cost effective in order to justify its application in home automation.

          In this paper we present a low cost secure cell phone based, flexible home automation system. Appliances at home are connected to the Arduino BT board. The communication between the cell phone and the Arduino BT board is wireless. Additional devices can be connected into the system with little modifications.
MATERIALS AND METHODS:
MATERIALS:
1.      Arduino UNO R3              -  1
2.     HC-05 BT module             -  1
3.     12V Relay                          -  4
4.     2N2222  Transistor           -  4
5.     1N4007 Diode                    -  4
6.     Voltage regulator(5V)      -  1
7.     1k resistor                       -  4
8.     10k resistor                     -  1
9.     20k resistor                     -  1
COMPONENTS DESCRIPTION:
     1.Arduino UNO R3
·        The Arduino Uno R3 is a microcontroller board based on a removable, dual-inline-package (DIP) ATmega328 AVR microcontroller.
·         It has 20 digital input/output pins (of which 6 can be used as PWM outputs and 6 can be used as analog inputs), a 16 MHz resonator, a USB connection, a power jack, an in-circuit system programming (ICSP) header, and a reset button.
·         It contains everything needed to support the microcontroller; simply connect it to a computer  with a USB cable or power it with a AC-to-DC adaptor or battery to get started. 
·        Programs can be loaded on to it from the easy-to-use Arduino computer program. The Arduino has an extensive support community, which makes it a very easy way to get started working with embedded electronics.
·        It is the latest revised version  of Arduino

     2.Bluetooth module(HC-05)
·        For the communication between mobile phone and microcontroller Bluetooth module(HC-05) is used.
·        HC-05 is low power 1.8V operation and is easy to use with Bluetooth SPP.
·        Serial port Bluetooth module have a Bluetooth 2.0+EDR (enhanced data rate), 3Mbps modulation with complete 2.4GHZ radio transceiver and baseband.
·        Using Bluetooth profile and android platform architecture different type of Bluetooth applications can be developed.

                
3.

   3. 12V  Relay
·  Relay is basically an electromagnetic switch which can be turn on and off by an applying the voltage across its contacts.
·  In this project used a 12V 4-channel relay.

                              


  4. 2N2222 Transistor
          The 2N2222 is a common NPN bipolar junction transistor (BJT) used for general purpose low-power amplifying or switching applications. It is designed for low to medium current, low power, medium voltage, and can operate at moderately high speeds.
   









METHOD:                       
   


   Block diagram:














 Circuit design:
    
            The circuit design of Home Automation based on Arduino and Bluetooth is very simple and is explained below.
          The Bluetooth module has 4 – pins: VCC, TX, RX and GND. VCC and GND are connected to 5V and ground from Arduino UNO. The Bluetooth module works on 3.3V and it has an on board 5V to 3.3V regulator.
          The TX and RX pins of the Bluetooth module must be connected to RX and TX pins of the Arduino. In Arduino UNO, we are defining pins 2 and 4 as RX and TX using software. Hence, TX of Bluetooth is connected to pin 4 of Arduino
          But when connecting RX of Bluetooth to TX of Arduino (or any microcontroller as a matter of fact), we need to be careful as the pin can tolerate only 3.3V. But the voltage from TX or Arduino will be 5V.
          So, a voltage divider network consisting of 10K and 20K resistors are used to reduce the voltage to 3.3V approximately.




    Working:
            When the power is turned on, the connection LED on the Bluetooth module starts blinking. We need to start the “Bluetooth Controller” app in our smartphone and get connected to the Bluetooth module. If the pairing is successful, the LED becomes stable.
Now, in the app, we need to set different keys for different loads and their corresponding value that must be transmitted when that key is pressed. The following image shows a set of keys to control 4 loads and an additional key to turn off all the loads.






Codings:
#include <SoftwareSerial.h>
SoftwareSerial BT(0, 1); //TX, RX  pins of arduino respetively
String command;
void setup()
{
 BT.begin(9600);
 Serial.begin(9600);
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5,OUTPUT);
}

void loop() {
  while (BT.available()){  //Check if there is an available byte to read
  delay(10); //Delay added to make thing stable
  char c = BT.read(); //Conduct a serial read
  command += c; //build the string.
  }
  if (command.length() > 0) {
    Serial.println(command);
  if(command == "light on") //this command will be given as an input to switch on light1
  {
    digitalWrite(2, HIGH);
  }
  else if(command == "light off") //this command will be given as an input to switch off light1 simillarly other commands work
  {
    digitalWrite(2, LOW);
  }
  else if (command == "lamp on")
  {
    digitalWrite (3, HIGH);
  }
  else if ( command == "lamp off")
 {
   digitalWrite (3, LOW);
 }
  else if (command == "fan on")
 {
   digitalWrite (4, HIGH);
 }
  else if (command == "fan off")
 {
   digitalWrite (4, LOW);
            }
    else if (command == "open")
 {
   digitalWrite (4, HIGH);
 }
  else if (command == "lock")
 {
   digitalWrite (4, LOW);
 }
  else if (command == "all on") //using this command you can switch on all devices
 {
   digitalWrite (2, HIGH);
   digitalWrite (3, HIGH);
   digitalWrite (4, HIGH);
 }
  else if (command == "off")//using this command you can switch off all devices
 {
   digitalWrite (2, LOW);
   digitalWrite (3, LOW);
   digitalWrite (4, LOW);      
 }

command="";}} //Reset the variable


Comments

Post a Comment