Hello friends! Welcome back to ElectroDuino. This blog is based on Home Automation using Arduino and Bluetooth HC-05 Module. Here we will discuss Introduction to Bluetooth Controlled Home Automation System, Project Concept, Block Diagram, components required, circuit diagram, working principle, and Arduino code.
Table of Contents
In the modern day’s everyone uses smartphones and the internet. Therefore, Every smartphone has Bluetooth System. In this project, we will design a simple Arduino Bluetooth Control Home Automation using the HC-05 Bluetooth module, which is used to switch ON or OFF different electrical appliances remotely. Home Automation systems can make our life easy and secure. Here we will control 4 different home appliances using Smartphone App through Bluetooth communication.
The key components of the project are Arduino, HC-05 Bluetooth module, 4 Channel Relay Module, 16×2 LCD display, and “Bluetooth Controller” app. Where Arduino is the main microcontroller of the project that’s controlled all other components. The HC-05 Bluetooth module is used to receive data from a smartphone. The relay module is used to control AC devices. The 16×2 LCD module is used to display the status (turn ON or turn OFF) of the home appliances. Also, we need to download and install the Bluetooth Controller App on our Smartphone, Which is sending data to the HC-05 Bluetooth Module.
Here we will send data from the smartphone using the Bluetooth controller App, then the Bluetooth module receives this data and pass this data to the Arduino. Now, Arduino is decoding this data, and sending commands to the relay module to control the devices. At the same time, we can see the status (turn ON or turn OFF) of the home appliances on the display.
Block Diagram
Components Name | Quantity |
Arduino UNO | 1 |
HC-05 Bluetooth Module | 1 |
4 Channel Relay Module | 1 |
AC Bulb with Holder and Wire | 4 |
PCB Prototyping board | 1 |
9V 1 Amp Adapter | External DC Power supply for operating Arduino. |
220V AC Power supply | |
Connecting wires | As required in the circuit diagram |
Smart Phone (Bluetooth supported) | 1 |
Bluetooth Controller App |
The HC-05 Bluetooth module can communicate two-way wireless. so, it is used to communicate with any device like a Phone or Laptop with Bluetooth functionality. The module communicates with the help of UART at 9600 baud rate and it has a range up to
This is a 6 pin module, but in this project, we will use only 4 pins, these are VCC, GND, TX, and RX. Where the VCC pin is connected to the 5V of the microcontroller, the GND pin is connected to the ground of the microcontroller, the RX pin is connected to the TX of the microcontroller and the TX pin is connected to the RX of the microcontroller.
HC-05 Bluetooth module Vcc, Relay module Vcc, LCD Display (Vdd, LED +) Pins
HC-05 Bluetooth module GND, Relay module GND, LCD Display (Vss, Rw, and LED -) Pins
First of all, open the Play Store of your Android Smartphone and search for “Bluetooth Control for Arduino”. Then you will get this App. Now install this app.
After completing the installation process, open the app and make sure the circuit is connected to the power supply and the Bluetooth module is on. Also, make sure the Bluetooth module pair with your smartphone. You can pair your phone with the HC-05 Bluetooth Module like we normally pair the phone with Bluetooth earphones or speakers. If your smartphone pair with the HC-05 Bluetooth module, then you can see the “HC-05 Bluetooth” name on the top side of the App and select it.
Now click on the “Connection” Button. When the App successfully connects to the Bluetooth Module, Then you can see the blue light on the “Connection button“. At the same time, you can also see the LED on the Bluetooth Module is blinking with some delay. It means your Bluetooth is successfully connected.
After complete the App setup/configuration, now we need to identify the load values of the App button. The app transmits Different load values when different buttons are pressed. When we will press a button on the app, the app sends a particular Load value to the Arduino through the Bluetooth module. These Lode Values are used in Arduino code to control a particular device by a particular app button. The Load values of the App buttons and their use is described in the below list.
App Buttons | Load Values | Device status | Control Relay (Relay Pin) |
Button 1 | 1 | Device1 On | Relay-1 (IN1) |
A | Device1 Off | ||
Button 2 | 2 | Device2 On | Relay-2 (IN2) |
B | Device2 Off | ||
Button 3 | 3 | Device3 On | Relay-3 (IN3) |
C | Device3 Off | ||
Button 4 | 4 | Device4 On | Relay-4 (IN4) |
D | Device4 Off | ||
on All | 9 | All Devices (1, 2, 3 & 4) On | Relay-1, Relay-2 Relay-3, Relay-4 (IN1, IN2, IN3, IN4) |
off All | I | All Devices (1, 2, 3 & 4) Off |
When we pressed any button of the App, the App sends a unique load value according to the button. The HC-05 Bluetooth Module received this unique load value and send it to the Arduino. Then, the Arduino compares the value with the predefined value of the button. If this value is matching then Arduino sends operating voltage to the relay module. also, we can see the Device status (on or off) on the 16×2 LCD Display.
For example, when we Press the App “Button 1“, then the app sends Load value “1” to the Bluetooth module. Then the Arduino gets this value through the Bluetooth module. Then the Arduino sends Low(0) input voltage to the Input-1 (IN1) pin of the relay module. Now the relay is in On mode. So the Device1 will also turn on, which is connected to the relay-1 of the relay module. At the same time, the “D1 (Device 1) is ON” status print on the 16×2 LCD Display Module.
when we again Press the App “Button 1“, but this time the app sends Load value “A” to the Bluetooth module. Again the Arduino gets this value through the Bluetooth module. But this time the Arduino sends a High(5v) input voltage to the Input-1 (IN1) pin of the relay module. Now the relay is in Off mode. So the Device1 will also turn off, which is connected to the relay-1 of the relay module. At the same time, the “D1 (Device 1) is Off” status print on the 16×2 LCD Display Module.
In this way, we can control all relays of the 4 channel Relay module through the voice command
/* Arduino Bluetooth Control Home Automation http://www.electroduino.com */ //libraries for LCD Display #include // Define LCD display pins LiquidCrystal lcd(12,11,10,9,8,7); const int Device1 = 6; // Relay pin 1 (IN1) const int Device2 = 5; // Relay pin 2 (IN2) const int Device3 = 4; // Relay pin 3 (IN3) const int Device4 = 3; // Relay pin 4 (IN4) void setup() < Serial.begin(9600); //Sets the baud for serial data transmission // Set Relay pins as OUTPUT pinMode(Device1, OUTPUT); pinMode(Device2, OUTPUT); pinMode(Device3, OUTPUT); pinMode(Device4, OUTPUT); // Print massage on LCD Display lcd.begin(16, 2); lcd.setCursor(0,0); lcd.print(" Bluetooth "); lcd.setCursor(0,1); lcd.print("Home Automation"); delay(2000); // Print massage All devics are Off when system is on lcd.clear(); lcd.setCursor(0,0); lcd.print(" D1 D2 D3 D4 "); lcd.setCursor(0,1); lcd.print("OFF OFF OFF OFF"); >void loop() < lcd.setCursor(0,0); lcd.print(" D1 D2 D3 D4 "); // Read data from Bluetooth Module if (Serial.available() >0) < char Val = Serial.read(); // Print Bluetooth Module data on serial monitor Serial.print("VAL: "); Serial.println(Val); // When Bluetooth Module data "1" then Relay1 ON if (Val == '1') < digitalWrite(Device1,LOW); lcd.setCursor(0,1); lcd.print("ON "); delay(200); >// When Bluetooth Module data "A" then Relay1 OFF else if (Val=='A') < digitalWrite(Device1,HIGH); lcd.setCursor(0,1); lcd.print("OFF"); delay(200); >// When Bluetooth Module data "2" then Relay2 ON else if (Val=='2') < digitalWrite(Device2,LOW); lcd.setCursor(4,1); lcd.print("ON "); delay(200); >// When Bluetooth Module data "B" then Relay2 OFF else if (Val=='B') < digitalWrite(Device2,HIGH); lcd.setCursor(4,1); lcd.print("OFF"); delay(200); >// When Bluetooth Module data "3" then Relay3 ON else if (Val=='3') < digitalWrite(Device3,LOW); lcd.setCursor(9,1); lcd.print("ON"); delay(200); >// When Bluetooth Module data "C" then Relay3 OFF else if (Val=='C') < digitalWrite(Device3,HIGH); lcd.setCursor(9,1); lcd.print("OFF"); delay(200); >// When Bluetooth Module data "4" then Relay4 ON else if (Val=='4') < digitalWrite(Device4,LOW); lcd.setCursor(13,1); lcd.print("ON "); delay(200); >// When Bluetooth Module data "D" then Relay4 OFF else if (Val=='D') < digitalWrite(Device4,HIGH); lcd.setCursor(13,1); lcd.print("OFF"); delay(200); >// When Bluetooth Module data "9" then All Relay ON else if (Val=='9') < digitalWrite(Device1, LOW); digitalWrite(Device2, LOW); digitalWrite(Device3, LOW); digitalWrite(Device4, LOW); digitalWrite(Device1, HIGH); digitalWrite(Device2, HIGH); digitalWrite(Device3, HIGH); digitalWrite(Device4, HIGH); lcd.setCursor(0,1); lcd.print("ON ON ON ON "); delay(200); >// When Bluetooth Module data "9" then All Relay ON else if (Val=='I') < digitalWrite(Device1, HIGH); digitalWrite(Device2, HIGH); digitalWrite(Device3, HIGH); digitalWrite(Device4, HIGH); lcd.setCursor(0,1); lcd.print("OFF OFF OFF OFF"); delay(200); >> >