Home Automation Using Arduino and Bluetooth Control

Home Automation Using Arduino and Bluetooth Control © Apache-2.0

An advanced home automation project with Arduino Uno and Bluetooth sensor to control it, anytime from anywhere.

  • 5,112 views
  • 5 comments
  • 35 respects

Components and supplies

Apps and online services

About this project

ABOUT THE PROJECT

In today's era, technology can enhance human life. Technology is evolving decade by decade. Automation was a science fiction earlier but not today. By combining latest technology with home, we can build an awesome home. With the Arduino uno and Windows 10, we can build a home automation system that is capable of operating home devices automatically.

Getting Started

Before starting the project, lets understand basics first. Consider the following image (overall configuration):

Configuration for Room

Now considering room scenario, an Arduino UNO will control devices and reads sensor data. The figure "Room Architecture" depicts how the Arduino UNO will connects with the devices and sensors. Room have multiple controllable devices(i.e. Light(s), Fan, Wall Socket(s), etc.), one PassiveIR (to detect human presence in the room), one temperature sensor (LM35 to collect room temperature) and LDR (to detect light intensity near room window).

Configuration of Different Sensors

Servo Motors

Servo motors are geared DC motors with the closed-loop circuitry incorporated within them. The basic configuration of a servo motor composed of a DC motor, gearbox, potentiometer and control circuit.

DC motor is used to move a gearbox with a large reduction ratio. The final shaft imposes a force on the external load and simultaneously acts on the axis of the feedback potentiometer. So, the potentiometer senses the position of the axis and sends a corresponding voltage to an operational amplifier. This voltage compared to the input voltage, that determines the desired position of the shaft, producing a voltage in the output of the comparator. This voltage powers the motor such that the shaft moves in the necessary direction to align with the angle that corresponds to the voltage applied to the input.

LM35

A precision IC temperature sensor with its output proportional to the temperature (in oC). The sensor circuitry is sealed and therefore it is not subjected to oxidation and other processes.

PIR

The pin configuration of the PIR sensor is shown in the figure. PIR sensor consists of three pins, ground, signal, and power at the side or bottom. Generally, the PIR sensor power is up to 5V, but, the large size PIR modules operate a relay instead of direct output.

HC-05 (Bluetooth)

To make a link between your Arduino and bluetooth, do the following: 1) Go to the bluetooth icon, right click and select Add a Device 2) Search for new device, Our bluetooth module will appear as HC-05, and add it 3) The pairing code will be 1234. 4)after make a pairing, we can now program the arduino and upload a sketch to send or receive data from Computer.

Video

Code

CODE FOR HOME AUTOMATIONC/C++
TYPED ON ARDUINO IDE
float x,y;             //TEMP
#define trigPin 12     //ULTRA
#define echoPin 10
int ledPin= 13;  
int duration, distance; //ULTRA
 
#include<Servo.h>     //servo   
Servo my;              //servo

char val;                     //bluetooth

void setup() {
 Serial.begin(9600); 
 pinMode(2,INPUT); //IR  GATE FIRST
 pinMode(3,INPUT);
 my.attach(11);     //servo   
 
 pinMode(4, OUTPUT);    //IR GATE FIRST
 
 
 pinMode(7,OUTPUT);              //TEM
 pinMode(8,INPUT);            //pir 1
 pinMode(9,OUTPUT);           //LED 1
 // pinMode(10,INPUT);          //pir 2
  //pinMode(11,OUTPUT);             //LED2
 pinMode(trigPin, OUTPUT); //12  PIN  ULTRA
 pinMode(echoPin, INPUT);  //10 PIN ULTRA
 pinMode(ledPin, OUTPUT);  //13 PIN  ULTRA
                                        


   pinMode(3,OUTPUT);             //bluetooth
}



void loop() {
 x=analogRead(0);                 //TEMP
  y=((x/1024)*5)*100;
  Serial.println(y);
  delay(500);
  
  if(y>44)
  {
  digitalWrite(7,1);
  }
  else
  {
  digitalWrite(7,0);
  delay(500);
  }
                                   //TEMP
  

if(digitalRead(8)==HIGH)                  //pir
 {
  digitalWrite(9,HIGH);
  }
 else
{ digitalWrite(9,LOW);}
 
  
 
 
  digitalWrite(trigPin, HIGH);           //ULTRA
   delayMicroseconds(10);
   digitalWrite(trigPin, LOW);
   duration = pulseIn(echoPin, HIGH);
   distance = (duration/2) / 29.1;

  if (distance >= 10 || distance <= 0) 
  {
  // Serial.println("no object detected");
 
 
   digitalWrite(ledPin,LOW);
   }
  else 
  {
  Serial.println("object detected \n");
 Serial.print("distance= ");
             
  Serial.print(distance);       
   digitalWrite(ledPin,HIGH);
  }                                              //ULTRA
if(digitalRead(2)==HIGH)        //gate first        
 {
  my.write(0);          //servo
  
  
  }
 else
 {
  my.write(90);             //servo
 }

 analogRead(5);             //ldr
  float a = analogRead(5);   
 Serial.println(a);
  

   if (a <=200) {

    digitalWrite(4,1);               
   Serial.println("LDR is DARK, LED is ON");
    
  
   }
  else {

    digitalWrite(4,0);         
    Serial.println("-----");
    
    
  }                                        //ldr

 

if (Serial.available())                                       //bluetooth
{
  val = Serial.read();
  Serial.println(val);

  
  if(val == 'TV')
  digitalWrite(3,HIGH);
  
  else if(val == 'tv')
  digitalWrite(3,LOW);

  }                                                           //bluetooth


}

Schematics

BLUEPRINT FOR PROJECT
Fc7cd5chqbbdjyr e8jjwubenk

Comments

Similar projects you might like

Control the Speed of Brushless DC Motor Using Bluetooth

Project tutorial by mohitmehlawat

  • 3,536 views
  • 0 comments
  • 13 respects

Bluetooth Control Multitap

Project showcase by gledel and 윤원호

  • 1,419 views
  • 0 comments
  • 5 respects

Android App-Based Home Automation System Using IOT

Project tutorial by Team Autoshack

  • 27,565 views
  • 18 comments
  • 87 respects

Bluetooth control led with lcd led status display real time.

Project tutorial by Youssef Sabaa

  • 18,172 views
  • 4 comments
  • 35 respects

Octopod: Smart IoT Home/Industry Automation Project

Project tutorial by Saksham Bhutani

  • 7,019 views
  • 8 comments
  • 30 respects
Add projectSign up / Login