This document describes a home automation project using an Arduino Uno and Bluetooth module. The circuit diagram shows how the Bluetooth module connects to the Arduino via TX and RX pins. An app is used to control four loads by sending codes to the Bluetooth module and Arduino code switches the loads on or off depending on the received code. The project automatically controls appliances but has limitations around continuous power. It could also be expanded to incorporate sensors for smart home automation and internet connectivity for remote control.
2. INTRODUCTION
We Are Living In 21st
Century Where Automation Of Any Form I.E. Home
Or Industrial Plays An Important Role In Human Life. When It Comes To
Industrial Automation, The Concept Is Applied To Large Machines Or
Robots Which Helps In Increasing The Efficiency In Terms Of Production,
Energy And Time.
Home Automation On The Other Hand Involves
Automating The Household Environment. This Is Possible Because Of The
Smartphones And Internet That We Are Widely Using. Home Automation
Can Be Again Divided In To Just Controlling The Appliances Using A
Smartphone From A Remote Location And Another Type Filled With
Sensors And Actuators Which Controls The Lighting, Temperature, Door
Locks, Electronic Gadgets, Electrical Appliances Etc. Using A Smart
System. In This Project, We Will Design A Simple Home Automation
Project Using Simple Components Using Which Different Electrical
Appliances Can Switched On Or Off. The Project Is Based On Arduino And
We Have Used Arduino UNO For The Project.
2
4. Components
The List Of Components Mentioned Here Are Specifically For Controlling
4 Different Loads,
Arduino UNO
HC 05 Bluetooth Module
10 K立 Resistor
20 K立 Resistor
1 K立 Resistor X 4
2N2222 NPN Transistor X 4
1N4007 Diode X 4
12 V Relay X 4
Prototyping Board (Bread Board)
Connecting Wires
12 V Power Supply
Smartphone Or Tablet (Bluetooth Enabled)
4
5. Component Description
ARDUINO UNO: The 8 bit ATmega 328P microcontroller based Arduino UNO is
used in the project to control different components like Bluetooth module and relay
network.
BLUETOOTH MODULE: The Bluetooth Module used in this project is HC- 05. As
seen in the image below, this Bluetooth module has 4 pins for VCC (5V), ground, TX
and RX. This Bluetooth can be used with Bluetooth enabled phone (or tablet or laptop)
and the range of this module is approximately 10 meters.
BLUETOOTH MODULE
5
6. CHANNEL RELAY BOARD: A 4 Channel Relay Board Is Used In This Project
To Control Four Different Loads. It Has All The Necessary Components And
Connections Like Base Current Limiting Resistor, Flyback Diode, LED Indicators And
Header For Connecting It To Other Devices.
CHANNEL RELAY BOARD
6
7. Circuit Design
The Circuit Design Of Home Automation Based On Arduino And Bluetooth Is Very
Simple And Is Explained Below.
The Bluetooth Module Has 4 Pins: VCC, TX, RX And GND. VCC And GND Are
Connected To 5V And Ground From Arduino UNO. The Bluetooth Module Works On
3.3V And It Has An On Board 5V To 3.3V Regulator. The TX And RX Pins Of The
Bluetooth Module Must Be Connected To RX And TX Pins Of The Arduino. In Arduino
UNO, We Are Defining Pins 2 And 4 As RX And TX Using Software. Hence, TX Of
Bluetooth Is Connected To Pin 4 Of Arduino. But When Connecting RX Of Bluetooth To
TX Of Arduino (Or Any Microcontroller As A Matter Of Fact), We Need To Be Careful
As The Pin Can Tolerate Only 3.3V. But The Voltage From TX Or Arduino Will Be
5V.So, A Voltage Divider Network Consisting Of 10K And 20K Resistors Are Used To
Reduce The Voltage To 3.3V Approximately.
Working Process:
A Simple Home Automation Project Using Arduino UNO, Bluetooth Module And A
Smartphone. The Aim Of This Project Is To Control Different Home Appliances Using A
Smartphone. The Working Of The Project Is Explained Here.When The Power Is Turned
On, The Connection LED On The Bluetooth Module Starts Blinking. We Need To Start
The Bluetooth Controller App In Our Smartphone And Get Connected To The
Bluetooth Module. If The Pairing Is Successful, The LED Becomes Stable.Now, In The
App, We Need To Set Different Keys For Different Loads And Their Corresponding
Value That Must Be Transmitted When That Key Is Pressed. The Following Image
Shows A Set Of Keys To Control 4 Loads And An Additional Key To Turn Off All The
Loads.
7
9. Then we are ready to control the loads. When a key is pressed in the smartphone, the
Bluetooth module receives the corresponding data and intern transmits that data to
Arduino.
9
10. This data i.e. 2 is transmitted to Arduino. Arduino then compares the received data
with the data written in the sketch and accordingly turns on the load 2. The similar action
can be applicable to other keys and loads.Using this type of connection, we can control
i.e. turn on or off different home electrical appliances using our smartphones.
Code
Use Software Of Arduino-1.8.5 Application In USB Cable Use.
#include <SoftwareSerial.h>
const int rxPin = 4;
const int txPin = 2;
SoftwareSerial mySerial(rxPin, txPin);
const int Loads[] = {9, 10, 11, 12};
int state = 0;
int flag = 0;
void setup()
{
for (int i=0;i<4;i++)
{
pinMode(Loads[i], OUTPUT);
}
mySerial.begin(9600);
for (int i=0;i<4;i++)
{
digitalWrite(Loads[i], LOW);
}
}
void loop()
{
if(mySerial.available() > 0)
{
state = mySerial.read();
flag=0;
}
switch(state)
{
case '0':digitalWrite(Loads[0], HIGH);
flag=1;
break;
case '1':digitalWrite(Loads[0], LOW);
flag=1;
break;
10
11. case '2':digitalWrite(Loads[1], HIGH);
flag=1;
break;
case '3':digitalWrite(Loads[1], LOW);
flag=1;
break;
case '4':digitalWrite(Loads[2], HIGH);
flag=1;
break;
case '5':digitalWrite(Loads[2], LOW);
flag=1;
break;
case '6':digitalWrite(Loads[3], HIGH);
flag=1;
break;
case '7':digitalWrite(Loads[3], LOW);
flag=1;
break;
case '8':digitalWrite(Loads[0], LOW);
digitalWrite(Loads[1], LOW);
digitalWrite(Loads[2], LOW);
digitalWrite(Loads[3], LOW);
flag=1;
break;
}
}
Limitations
The system needs a continuous power supply to be practical or else we might not be able
to control the appliances.Hence, best way to design the system efficiently would be to
implement both the automated control and manual control through switches at a time.
14. Applications
Using This Project, We Can Turn On Or Off Appliances Remotely I.E. Using A
Phone Or Tablet.
The Project Can Be Further Expanded To A Smart Home Automation System By
Including Some Sensors Like Light Sensors, Temperature Sensors, Safety
Sensors Etc. And Automatically Adjust Different Parameters Like Room
Lighting, Air Conditioning (Room Temperature), Door Locks Etc. And Transmit
The Information To Our Phone.
Additionally, We Can Connect To Internet And Control The Home From Remote
Location Over Internet And Also Monitor The Safety.
14