Arduino and Bluetooth Based Home Automation

Published: 10 April 2023 | Last Updated: 29 August 20235212
Hello everyone, welcome to the new post today.

Introduction

Home Automation has become increasingly popular these days, providing comfort in private homes while allowing for centralized control of heating, ventilation, air-conditioning, and lighting. The system also promotes overall cost reduction and energy conservation, which is a significant concern at present.

Wired communication has been the foundation of well-established home automation systems, which do not encounter problems as long as they are planned before building physical structures. However, when extending a complete building, the wiring system requires significant effort and cost.

Wireless or automation systems have emerged as an alternative to wired systems in recent years, and they are widely used in various applications such as security cameras, alarms, and home appliances.

This project involves building a Bluetooth Home Automation System using Arduino and HC-05 module, which can operate up to four home appliances through a smartphone. This feature can be customized according to your needs, and the system is designed to function without the need for an internet connection, making it an ideal solution for rural areas. By following the steps carefully, you can create your own Bluetooth Home Automation System easily.


Components Required

· Arduino Nano

· HC-05 Bluetooth Module

· 4 Channel Relay Module

· 5 Volt DC Power Supply

· 4 Loads

· 4-Channel AC Socket

· Connection Wires

As the official partner of Arduino, Utmel provides you with official original Arduino products. Welcome to shop at the Arduino product page.

Arduino:

I decided to opt for the Arduino Nano over the Arduino UNO due to its smaller size. The Arduino Nano is a microcontroller board that utilizes the atmega 328p chip and can serve as a replacement for the UNO. Both boards have identical functionalities, but the Nano's PCB measures 18x45 mm. The clock speed of the Nano is also 16 MHz, and its input voltage ranges from 5-12V. Additionally, the board contains 30 pins, including power, data, analog, and serial pins.

 

HC-05 Bluetooth Module

 

The HC-05 Bluetooth Module is responsible for facilitating Bluetooth communication between an Arduino and an Android phone. It comes pre-configured with a baud rate of 9600 bps, and all we need to do is connect the RX and TX pins to an Arduino serial converter.

The HC-05 Bluetooth module has two modes: master mode and slave mode, which can be set using specific AT commands. In fact, we can configure the module's settings using AT commands as well. To enter the AT mode, we can either press the Enable button on the Bluetooth module or set the Enable pin to a HIGH level, which will initiate the mode with a baud rate of 38400 bps.


Software Required:

· Arduino IDE 


Hardware:

Figure. 1.png

Figure. 1

Circuit Diagram of Arduino and Bluetooth-Based Home Automation


Working

The process of connecting the circuit is simple and straightforward. By following the steps carefully, you can easily complete your home automation project. While the circuit diagram above shows all the connections in detail, a brief explanation is also provided below.

To begin, connect the HC-05 module and Arduino Nano by connecting the RX, TX, GND, and VCC pins of the HC-05 module to the TX, RX, GND, and VIN pins of the Arduino Nano, respectively.

Next, grab the 4-channel relay module and connect its VCC pin to the 5V supply on the Arduino board. Then connect the IN1, IN2, IN3, and IN4 pins to the D6, D5, D4, and D3 pins on the Arduino board. The four output channels of the relay module correspond to four loads that can be controlled. Finally, connect a 5V power supply to the VIN pin on the Arduino board.

The way it works is that when the HC-05 module sends a signal to the Arduino, it triggers a specific relay, which then conducts voltage and allows the corresponding load to operate. The HC-05 module is connected to our mobile phone through Bluetooth communication.

 

Connect Application With Bluetooth Home Automation System

 

To begin, you should download the "BT Home Automation" application from the Google Playstore. Then, navigate to the Bluetooth settings on your smartphone and search for the HC-05 device, pairing it once it is found. Once that is complete, open the previously downloaded application and select the "Bluetooth" icon to connect to the already-paired HC-05 device.

 Figure. 2.png

Figure. 2

Figure. 3.png

Figrue. 3

Once the Bluetooth connection has been established, all you need to do is click on the eight ON/OFF buttons below, giving you the ability to control the load appliances in accordance with your specific requirements.

Figure. 4.png

Figure. 4

Figure. 5.png

Figure. 5

Code

char data = 0;

void setup()

{

Serial.begin(9600);        

pinMode(3, OUTPUT);   // Define output pin no 3

pinMode(4, OUTPUT);   // Define output pin no 4

pinMode(5, OUTPUT);   // Define output pin no 5

pinMode(6, OUTPUT);   // Define output pin no 6

pinMode(7, OUTPUT);   // Define output pin no 7

pinMode(8, OUTPUT);   // Define output pin no 8

pinMode(9, OUTPUT);   // Define output pin no 9

pinMode(10, OUTPUT);   // Define output pin no 10

}

void loop()

{

if(Serial.available() > 0)  

{

data = Serial.read();      

Serial.print(data);        

Serial.print("\n");        

if(data == 'A')            

digitalWrite(3, LOW);   // Turn relay 1 ON

else if(data == 'a')    

digitalWrite(3, HIGH);    // Turn relay 1 OFF

  if(data == 'B')            

digitalWrite(4, LOW);   // Turn relay 2 ON

else if(data == 'b')    

digitalWrite(4, HIGH);    // Turn relay 2 OFF

if(data == 'C')            

digitalWrite(5, LOW);   // Turn relay 3 ON

else if(data == 'c')    

digitalWrite(5, HIGH);    // Turn relay 3 OFF

if(data == 'D')            

digitalWrite(6, LOW);   // Turn relay 4 ON

else if(data == 'd')    

digitalWrite(6, HIGH);    // Turn relay 4 OFF

if(data == 'E')            

digitalWrite(7, LOW);   // Turn relay 5 ON

else if(data == 'e')    

digitalWrite(7, HIGH);    // Turn relay 5 OFF

if(data == 'F')            

digitalWrite(8, LOW);   // Turn relay 6 ON

else if(data == 'f')    

digitalWrite(8, HIGH);    // Turn relay 6 OFF

if(data == 'G')            

digitalWrite(9, LOW);   // Turn relay 7 ON

else if(data == 'g')    

digitalWrite(9, HIGH);    // Turn relay 7 OFF

if(data == 'H')            

digitalWrite(10, LOW);   // Turn relay 8 ON

else if(data == 'h')    

digitalWrite(10, HIGH);    // Turn relay 8 OFF

}  

                          

}

 

Conclusion

Home automation is becoming more popular nowadays because it releases us from the tension of manually operating devices and it will become the future of electronics

 

Future Work

 

· Voice Control to control devices

· Using Wi-Fi to Control Devices and Operate them remotely

UTMEL

We are the professional distributor of electronic components, providing a large variety of products to save you a lot of time, effort, and cost with our efficient self-customized service. careful order preparation fast delivery service

Related Articles