Project tutorial

Bluetooth Based Home Automation © CC BY-NC-SA

The communication between the cell phone and the Arduino BT board is wireless. Additional devices can be connected into the system.

  • 3,687 views
  • 4 comments
  • 20 respects

Components and supplies

A000066 iso both
Arduino UNO & Genuino UNO
×1
Relay Module (Generic)
×1
Bluetooth Low Energy (BLE) Module (Generic)
×1
blub
×1

Necessary tools and machines

09507 01
Soldering iron (generic)

Apps and online services

About this project

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

The app can be downloaded from the link below:

https://drive.google.com/open?id=1nG3IVv4Sfq7oxc6i7c2kwBkIuNLsXeZx

Code

codeArduino
#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

Schematics

Block diagram
Bt blk diag biysrevkno

Comments

Similar projects you might like

High Precision Scale with Arduino

Project showcase by mPelectronic

  • 1,745 views
  • 11 comments
  • 16 respects

WIZnet S2E Deadbolts

Project tutorial by S2E Lock

  • 931 views
  • 2 comments
  • 5 respects

Super-Go: An Industrial IoT bot

Project tutorial by KS

  • 321 views
  • 2 comments
  • 2 respects

GPS Tracking System for Vehicles

Project showcase by Sustainable Living Lab

  • 3,289 views
  • 1 comment
  • 10 respects

Automatic Watering System

Project tutorial by Manson Hau

  • 5,235 views
  • 11 comments
  • 27 respects

DIY Photogrammetry Turntable

Project showcase by alfiosky4

  • 3,473 views
  • 5 comments
  • 10 respects
Add projectSign up / Login