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

Room scenario

                                              Room scenario


Schematics For 5 Relay 

Hardware Assembly

  • Bluetooth TX pin to Arduino RX pin.
  • Bluetooth RX pin to Arduino TX pin
  • VCC pin to 5v GND to GND Arduino
  • Relay IN1 pin to Arduino D2 (Digital Pin 2)
  • Relay IN2pin to Arduino D3 (Digital Pin 3)
  • Relay IN3 pin to Arduino D4 (Digital Pin 4)
  • Relay IN4 pin to Arduino D5 (Digital Pin 5)
  • Relay IN5 pin to Arduino D6 (Digital Pin 6)


 Programming the Arduino


Step 4: Programming the Arduino


Arduino Code For this Project

byte val;

void setup()
  Serial.begin(9600);//Change the baud rate value depending on the default baud rate of your bluetooth module, for Bluesmirf-115200 and for JY-MCU-9600
  pinMode(2, OUTPUT);//Light1 pin
  pinMode(3, OUTPUT);//Light2 pin
  pinMode(4, OUTPUT);//Light3 pin
  pinMode(5, OUTPUT);//AC pin
  pinMode(6, OUTPUT);//Door Lock

void loop()
 int a=0;
    Serial.println(int(val));//Display received value on Serial Monitor

if(int(val)==49)//Turn Light1 ON

 else if (int(val)==50)//Turn Light1 OFF

if(int(val)==51)//Turn Light2 ON
 else if(int(val)==52)//Turn Light2 OFF
if(int(val)==53)//Turn Light3 ON

 else if(int(val)==54)//Turn Light3 OFF
if(int(val)==55)//Turn AC ON
 else if(int(val)==56)//Turn AC OFF
if(int(val)==57)//Lock the DOOR
 else if(int(val)==48)//Unlock the DOOR


Bluetooth Communication Using an Application 

Install the App

  • Connect Arduino to 9v battery or computer
  • Install the App in your Phone
  •  run the appliaction
  •  allow the BT permissions ,
  • Type Your BT Module name (Normally HC-05)
  • Password = 1234
  • pair ok

App link :