How to Build a Bluetooth Controlled Home Automation

Introduction: How to Build a Bluetooth Controlled Home Automation

About: DIY,IoT, Electronics

Do you want to automate your home? Ever wished to control your appliances with a swipe on your phone? Or do you want to learn how to build automation device for yourself?

In this project, let’s see how to build a Bluetooth based home automation project.

Step 1: COMPONENTS REQUIRED

  • PCB
  • HC-05 Blutooth Module
  • Hi-Link (5V)
  • 5V Relay - 4 Nos
  • ATMEGA328P IC
  • 28 Pin IC Base
  • 16 Mhz Crystal Oscillator
  • BC547 Transistor - 4 Nos
  • 22pF Capacitor - 2 Nos
  • LED 5mm - 5 Nos
  • IN4007 Diode - 5 Nos
  • 1K Resistor - 9 Nos
  • 2 Pin Screw Connector
  • 3 Pin Screw Connector - 4 Nos

Step 2: TOOLS NEEDED

  • Soldering Iron
  • Soldering Wire
  • Flux

Step 3: PCB

Therefore, case you want your own PCB, you can obtain through this link on PCBWay.com. You can also order good quality PCBS from PCBWay.com at low cost. In addition to the standard pcbs, we could also support advanced Pcbs, FPC/rigid -flex Pcbs, rapid-rpototyping and other related services that could meet your needs to the most extent.

PCB order steps on PCBWay:

  • Visit the website: www.pcbway.com
  • Click PCB Instant Quote
  • Clickquick-order PCB Upload the gerber file by clicking "+Add Gerber File" and wait until the gerber file is finished
  • uploading Set the PCB specifications as you wish, starting from the number of PCBs, the number of layers, thickness, color and others
  • After that, look at the left, it will display the estimated cost,processing time and delivery service selected
  • Click Save to cart

Step 4: ASSEMBLING COMPONENTS ON PCB

Connect all components to the PCB

Now you need to program the IC atmega328 and set it to the 28 pin IC base of the PCB .Let's see how.

Step 5: SCHEMATIC DIAGRAM

Step 6: PROGRAMING

I am programming atmega328p using Arduino Uno here

  • Connect Arduino Uno on PC
  • Open Arduino IDE (Software)
  • Then Go To Tools>Board>Select Arduino Uno
  • Select Correct Port
  • Upload Code Below

Step 7: CODE

/*
Relay IN1 connected to PinOut 2 Arduino
Relay IN2 connected to PinOut 3 Arduino
Relay IN3 connected to PinOut 4 Arduino
Relay IN4 connected to PinOut 5 Arduino
--->you can connected to relay modul 4 channel
Serial data sending from Arduino Bluetooth Relay 4CH.apk
data '1'-'4' to on is Ralay CH 1-4
data 'A'-'D' to off is Ralay CH 1-4
data '9' to on ALL CH 1-4
data 'I' to off ALL CH 1-4
*/

#define relay1 2
#define relay2 3
#define relay3 4
#define relay4 5
char val;
void setup() {
 pinMode(relay1,OUTPUT);
 pinMode(relay2,OUTPUT);
 pinMode(relay3,OUTPUT);
 pinMode(relay4,OUTPUT);
 digitalWrite(relay1,LOW);
 digitalWrite(relay2,LOW);
 digitalWrite(relay3,LOW);
 digitalWrite(relay4,LOW);
 Serial.begin(9600);
 Serial.begin(9600);
}
void loop() {
//cek data serial from bluetooth android App
if( Serial.available() >0 ) {
 val = Serial.read();
 Serial.println(val); 
}
//Relay is on
 if( val == '1' ) {
 digitalWrite(relay1,HIGH); }
 else if( val == '2' ) {
 digitalWrite(relay2,HIGH); }
 else if( val == '3' ) {
 digitalWrite(relay3,HIGH); }
 else if( val == '4' ) {
 digitalWrite(relay4,HIGH); }
 //relay all on
 else if( val == '9' ) {
 digitalWrite(relay1,HIGH);
 digitalWrite(relay2,HIGH);
 digitalWrite(relay3,HIGH);
 digitalWrite(relay4,HIGH);
}
//relay is off
 else if( val == 'A' ) {
 digitalWrite(relay1,LOW); }
 else if( val == 'B' ) {
 digitalWrite(relay2,LOW); }
 else if( val == 'C' ) {
 digitalWrite(relay3,LOW); }
 else if( val == 'D' ) {
 digitalWrite(relay4,LOW); }
 //relay all off 
 else if( val == 'I' ) {
 digitalWrite(relay1,LOW);
 digitalWrite(relay2,LOW);
 digitalWrite(relay3,LOW);
 digitalWrite(relay4,LOW);
}
}

Step 8:

After programming, unplug the ATMEGA328P from the arduino and set it to the 28 pin IC socket on the PCB. With this, all work is completed...

Step 9: SAMPLE CONNECTION

Step 10: APP

  1. Download and install "Bluetooth Control for Arduino"
  2. When you turn on Bluetooth you will see "HC-05"
  3. When you click on it, you will be asked for the password and then type the password is 1234
  4. Open the app
  5. At the top you will see some Bluetooth device names, select HC-05
  6. Click on the "Connection" button

Now our Bluetooth module is connected to the phone.....

If you have any doubts, watch this video (Click Here)

Step 11: WORKING

Watch this video (Click Here)

THANKYOU

Be the First to Share

    Recommendations

    • Organization Contest

      Organization Contest
    • Space Contest

      Space Contest
    • Lamps and Lighting Contest

      Lamps and Lighting Contest

    Comments