Home Automation Using Arduino and Bluetooth is a iot project to control our home appliances like light, fan, cooler etc. from a Smartphone. In this project we use Arduino Uno and HC-05 Bluetooth Module and we give command from our smartphone.

We also develop our Android App using MIT App Inventor to control Home Appliances using smartphone and bluetooth.

»Read More about Arduino Uno

»Read More about Bluetooth Module HC-05

Component List

  • Arduino Board
  • Bluetooth Module Hc-05
  • Relay Module 5v (4-Channel)
  • Connecting Wires

Circuit Diagram of Home Automation

Circuit Diagram of Home Automation Using Arduino and Bluetooth

Pin Connections of Bluetooth HC05 and Relay Module with Arduino

Bluetooth HC-05 Arduino Board
Vcc +5v 5v
GND GND
TXD RXD
RXD TXD
Relay Module
Vcc +5v 5v
GND GND
IN1 D8
IN2 D9
IN3 D10
IN4 D11

Code 1

int Relay1 = 8;
int Relay2 = 9;
int Relay3 = 10;
int Relay4 = 11;

void setup() 
{
  Serial.begin(9600);
  pinMode(Relay1,OUTPUT);
  pinMode(Relay2,OUTPUT);
  pinMode(Relay3,OUTPUT);
  pinMode(Relay4,OUTPUT);
}

void loop() 
{
  if (Serial.available()) 
  {
    String value = Serial.readStringUntil('\n'); //if the receive value is String we use this function
    Serial.println(value);
    
    //For Relay 1
    if(value == "Relay1 on" || value == "1:1")   //Read Multiple Values
    {
      digitalWrite(Relay1,HIGH);
    }
    else if(value == "Relay1 off" || value == "1:0")
    {
      digitalWrite(Relay1,LOW);
    }
    
    //For Relay 2
    if(value == "Relay2 on" || value == "2:1") 
    {
      digitalWrite(Relay2,HIGH);
    }
    else if(value == "Relay2 off" || value == "2:0")
    {
      digitalWrite(Relay2,LOW);
    }

    //For Relay 3
    if(value == "Relay3 on" || value == "3:1") 
    {
      digitalWrite(Relay3,HIGH);
    }
    else if(value == "Relay3 off" || value == "3:0")
    {
      digitalWrite(Relay3,LOW);
    }

    //For Relay 4
    if(value == "Relay4 on" || value == "4:1")
    {
      digitalWrite(Relay4,HIGH);
    }
    else if(value == "Relay4 off" || value == "4:0")
    {
      digitalWrite(Relay4,LOW);
    }
  }   
}