DIY home automation using Arduino, Relay and Bluetooth Module(HC-05)

Advancement in technology has brought lot's of change in today's world. So, in this tutorial we are going to learn about home automation using Arduino, Relay and Bluetooth Module. Here, we have automated our four room appliances namely AC, Bulb, Heater, Fan.

Let's get started with the today's tutorial.

Components Required:

  1. Arduino UNO X 1
  2. 5 Volt Relay Module X 4
  3. HC-05 Bluetooth Module X 1
  4. Any four home appliances according to your desire
Circuit Diagram:
(NOTE: First upload the code to the Arduino board and then only do the given below circuit in order to avoid the short circuit from the previously uploaded code.)
About HC-05 Bluetooth Module:



It is a small portable device that is used to be connected in the Arduino board so that it can communicate with mobile or smartphone.
It has 6 pins, among which we are concerned with only 4 pins;
  • PIN 2  (RXD for receiving information from smartphone through Bluetooth medium)
  • PIN 3  (TXD for transmitting information from smartphone through Bluetooth medium)
  • PIN 4  (GND for grounding or zero potential point)
  • PIN 5  (VCC for supply of 5 Volt in order to power up HC-05)
The TXD pin of Arduino is connected to RXD pin HC-05 and the RXD pin of Arduino is connected to TXD pin of HC-05.

Here, TXD = 1 in Arduino  means transmission of information from Arduino to HC-05.
And, RXD=0 in HC-05 means receiving information from from Arduino to HC-05.

Also, TXD = 1 in HC-05 means transmission of information from HC-05 to Arduino.
And, RXD=0 in Arduino means receiving information from from HC05 to Arduino.

(NOTE: About relay and Arduino we have discussed in the previous sections which you can visit in our home page.)

Coding:
Copy and pest the given below code to the Arduino IDE board and compile it.

long int ac=2;
long int bulb=3;
long int heater=4;
long int fan=5;
char x;
void setup()
{
pinMode(ac,OUTPUT);
pinMode(bulb,OUTPUT);
pinMode(heater,OUTPUT);
pinMode(fan,OUTPUT);
digitalWrite(ac,LOW);
digitalWrite(bulb,LOW);
digitalWrite(heater,LOW);
digitalWrite(fan,LOW);
Serial.begin(9600); 
}
void loop()
{
  if(Serial.available()>0)
  {
  x=Serial.read();
  }
  if(x=='a')
  digitalWrite(ac,HIGH);
  if (x=='b')
  digitalWrite(ac,LOW);
  if (x=='c')
  digitalWrite(bulb,HIGH);
  if(x=='d')
  digitalWrite(bulb,LOW);
  if(x=='e')
  digitalWrite(heater,HIGH);
  if(x=='f')
  digitalWrite(heater,LOW);
  if(x=='g')
  digitalWrite(fan,HIGH);
  if(x=='h')
  digitalWrite(fan,LOW);
}

Application Instillation:
From the given below link install the app from google play store to your smartphone and connect it as given below process:

  1. Turn on your smartphone Bluetooth
  2. Install and open the app
  3. Click on connect to bluetooth
  4. Click on HC-05
  5. It will ask code, put code '1234' if it doesn't work then put '0000' if this step doesn't work here then goto step 1 and try connect manually with same codes and then follow from step 2.
  6. Press OK or Connect and now you are done
In this way you can make your own home automated system using Arduino, Relay and Bluetooth Module(HC-05). 

Post a Comment

0 Comments