Home Automation Using Arduino Microcontroller

7,130 views

Today we will show you how to make a Home Automation System using Arduino microcontroller. Through this system, you can control your home appliances with your cellphone by downloading a simple Android App on them. The Bluetooth module is used to send commands from cellphones to Arduino, which is connected to the relay.

Hardware Components

Following are the necessary hardware items required for Home Automation circuit:

S.NoComponentValueQty
1.ArduinoUno R31
2.USB Cable A/B1
3.Relay module1
4.Bluetooth Module HC-051
5.Breadboard1
6.Connecting Wires1

Connection

Bluetooth module connections
  1. Connect VCC of the Bluetooth module to the VCC of Arduino.
  2. Connect GND of Bluetooth module to GND of Arduino.
  3. Connect RX of Bluetooth module to TX (D1) of Arduino.
  4. Connect TX of Bluetooth module to RX (D0) of Arduino.
Relay module connections
  1. Connect VCC to VCC of Arduino.
  2. Connect GND to GND of Arduino.
  3. Connect IN Pin to D8 of Arduino.
Lamp connections
  1. Connect outputs (C & NC) of the relay in series with the plug of the lamp.
Upload Code
  1. Download code and upload it to the Arduino board using Arduino IDE software.
  2. Download the app and pair it using password 1234 or 0000.

Working Explanation

Arduino Uno Rev is used in this project to control different components like the relay network and Bluetooth module. The range of the Bluetooth module is approximately 10 meters and it can be used with Bluetooth enabled phones. The operating voltage of this module is 3.3V, so it has an onboard 5V to 3.3V regulator.

When we apply power to the Bluetooth module, the LED on the module starts blinking. We should start the Bluetooth controller app on our cellphone and try connecting it to the module. If the pairing is successful, the LED becomes stable. Now, we can control home appliances connected to the relay with our cellphones.

CAUTION: Relay module can only handle current up to 10 Amp. Which is enough for most devices but not for high power devices live heaters and Air-conditioners.

Application

  • By connecting cellphones to the internet we can control home appliances from a remote location over the internet.
  • By using this system, we can prevent electric shocks by not touching any switches physically.

Circuit Diagram

arduino-home-automation-system
arduino-home-automation-system

Code

   
int state; 
int relay=8;

void setup() {
Serial.begin(9600);
 pinMode(relay, OUTPUT); // put your setup code here, to run once:
 }

void loop() 
{
  // put your main code here, to run repeatedly:
 if(Serial.available()>0)
 {
    state = Serial.read();
    if(state==1)
    {     
     digitalWrite(relay,LOW); //OFF
    }
    if(state==0)
    {
     digitalWrite(relay,HIGH); //ON
    }
    
 }
   delay(50);
}