Monday, May 3, 2021

Home automation using Bluetooth

 

Bluetooth based Home Automation:

Components Required:

·        Arduino (UNO, or Nano)

·        Bluetooth Module (HC-06 or HC-05)

·        5V Relay (4 channel)

·        Jumper Wires

·        Breadboard (in case of Nano)

Working:

·        Arduino will be the mainboard. You can use any of Nano, UNO, and mega as well. Both have similar pins for connections and their method of uploading programs are the same. I am using Nano.

·        Bluetooth Module is responsible for receiving instructions from a smartphone. You can use any of HC-05 and HC-06 as they have the same pins.

·        The relay will act as a switch for appliances like a light bulb to on and off. You can use any relay module but you have to make some changes to the code as well. I recommend you to use 2 channel or 4 channel relay. But you can also use a single channel relay with this code as well.

·        Jumper wires will help to make connections.

·        I am using Arduino Nano. So, I also have to use a breadboard.

Connections:

 

Application:
        There are many apps available. If you are facing a problem in finding an application, contact me at: rizwanmahad606@gmail.com.
Code:

char data = 0;

void setup() {

  Serial.begin(9600);

  pinMode(8,OUTPUT);

  pinMode(9,OUTPUT);

  pinMode(10,OUTPUT);

  pinMode(11,OUTPUT);

 

}

 

void loop() {

  if(Serial.available()>0)

{

data=Serial.read();

Serial.print(data);

Serial.print("\n");

if(data=='a')

digitalWrite(8,HIGH);

else if(data=='b')

digitalWrite(8,LOW);

if(data=='c')

digitalWrite(9,HIGH);

else if(data=='d')

digitalWrite(9,LOW);

if(data=='e')

digitalWrite(10,HIGH);

else if(data=='f')

digitalWrite(10,LOW);

if(data=='g')

digitalWrite(11,HIGH);

else if(data=='h')

digitalWrite(11,LOW);

}

}

 

Note:

Disconnect the Bluetooth module while uploading the code.

If you are facing a problem with this project, contact me in the comments. Hope you will enjoy this project.

No comments:

Post a Comment

Scanners: Explained.

 Introduction:           If you need a copy of a document that is sitting on your table. For this, with your PC, you use your flatbed scan...