How to make a Bluetooth Control Home Automation
In this tutorial we will build a home automation device that will help you to control your home device like light,fan,TV etc using an arduino and a Bluetooth module.this one is very easy and you can build it within a hour.I can control up to 4 home appliance using this divice and a smart phone.So let's a look at the list of material and tools you'll need.
Material List:
The Circuit:
Arduino Code:
void setup( )
{
Serial.begin(9600);
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
}
void loop( )
{
if(Serial.available( ))
{ char x=Serial.read();
if(x=='1')
{
digitalWrite(2,LOW);
}
else if(x=='2')
{
digitalWrite(3,LOW);
}
else if(x=='3')
{
digitalWrite(4,LOW);
}
else if(x=='4')
{
digitalWrite(5,LOW);
}
else if(x=='5')
{
digitalWrite(2,HIGH);
}
else if(x=='6')
{
digitalWrite(3,HIGH);
}
else if(x=='7')
{
digitalWrite(4,HIGH);
}
else if(x=='8')
{
digitalWrite(5,HIGH);
}
else
{ Serial.write("send data ");
}
}
}
Material List:
- Arduino uno
- 4-chhanel Relay module
- Bluetooth Module (HC-5)
- Jumper wire
- Bulb holder
- 5v power supply
- Soldering kits
- glue gun
- Android smart phone
- Arduino Software(you can download it from here.)
- A android app (you can download it from here)
Arduino Code:
void setup( )
{
Serial.begin(9600);
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
}
void loop( )
{
if(Serial.available( ))
{ char x=Serial.read();
if(x=='1')
{
digitalWrite(2,LOW);
}
else if(x=='2')
{
digitalWrite(3,LOW);
}
else if(x=='3')
{
digitalWrite(4,LOW);
}
else if(x=='4')
{
digitalWrite(5,LOW);
}
else if(x=='5')
{
digitalWrite(2,HIGH);
}
else if(x=='6')
{
digitalWrite(3,HIGH);
}
else if(x=='7')
{
digitalWrite(4,HIGH);
}
else if(x=='8')
{
digitalWrite(5,HIGH);
}
else
{ Serial.write("send data ");
}
}
}
Now install the android app on your smart phone.Then you have to pair the bluetooth module to your android device before you could use it in the app.
- Open your device's bluetooth settings and search for new devices, make sure the led on HC05 module is blinking continuously (Pairing Mode).
- Select HC 05 ( or you'll see an address ending with "C" as shown in the picture.)
- Enter the PIN "1234" and press OK.
- Open the "Bluetooth Controller" Select "HC 05" from the list.
- Use the respective switches to turn ON/OFF the relays 1,2,3,4.
Some YOUTUBE video About This Project:
No comments