How to Build a Bluetooth Controlled Home Automation

by Pro Maker_101 in Circuits > Arduino

1381 Views, 0 Favorites, 0 Comments

How to Build a Bluetooth Controlled Home Automation

BT

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.

COMPONENTS REQUIRED

Screenshot (292).png
  • 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

TOOLS NEEDED

  • Soldering Iron
  • Soldering Wire
  • Flux

PCB

Screenshot (276).png
Screenshot (277).png

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

ASSEMBLING COMPONENTS ON PCB

Screenshot (293).png
Screenshot (294).png
Screenshot (295).png
Screenshot (296).png

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.

SCHEMATIC DIAGRAM

Screenshot (320).png

PROGRAMING

Screenshot (297).png
Screenshot (298).png
Screenshot (314).png
Screenshot (315).png
Screenshot (316).png
Screenshot (317).png
Screenshot (318).png

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

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);
}
}

Downloads

Screenshot (299).png
Screenshot (300).png
Screenshot (301).png
Screenshot (302).png
Screenshot (303).png
Logopit_1621908781124.jpg

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...

SAMPLE CONNECTION

1621868752982.jpg
Logopit_1621868703149.jpg

APP

Screenshot (306).png
Screenshot (307).png
Screenshot (308).png
Screenshot (309).png
Screenshot (310).png
Screenshot (311).png
  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)

WORKING

BT
Screenshot (305).png
Screenshot (312).png
Screenshot (313).png

Watch this video (Click Here)

THANKYOU