Arduino Based Home Automation Using Bluetooth
Arduino Based Home Automation Using Bluetooth
CHANDRAPUR
SESSION 2019-2020
A
PROJECT REPORT ON
ELECtRONICS &
tELECOMMUNICAtION ENGINEERING
Maharashtra state board of Technical education, Mumbai
Under the Guidance of
Certificate
This is to certify that the project report titled
To the best of our knowledge and belief, this Project Report bears no
resemblance with any report submitted to SDE (1449) or any other
University for the award of any degree or diploma.
Date:
Place: Chandrapur
ABSTRACT
1 INTRODUCTION 01
2 WORKING PRINCIPLE 03
3 DISCRIPTION 09
4 BLOCK DIAGRAM 13
5 CODE 16
6 HARDWARE 19
7 SOFTWARE 27
9 APPLICATIONS 33
10 CONCLUSION 36
11 REFERENCE 38
1
INTRODUCTION
Nowadays, we have remote controls for our television sets and other
electronic systems, which have made our lives really easy. Have you ever
wondered about home automation which would give the facility of
controlling tube lights, fans and other electrical appliances at home using
a remote control? Off-course, Yes! But, are the available options cost-
effective? If the answer is No, we have found a solution to it. We have
come up with a new system called Arduino based home automation using
Bluetooth. This system is super-cost effective and can give the user, the
ability to control any electronic device without even spending for a remote
control. This project helps the user to control all the electronic devices
using his/her smartphone. Time is a very valuable thing. Everybody wants
to save time as much as they can. New technologies are being introduced
to save our time. To save people's time we are introducing Home
Automation system using Bluetooth. With the help of this system you can
control your home appliances from your mobile phone. You can turn on/off
your home appliances within the range of Bluetooth.
2
3
WORKING PRINCIPLE
4
Android studio isn't really required here, since I will provide you
with the Android application that I made. You can install the given
.apk file to use the application.
Arduino Bluetooth controller App
5
6
This is just a basic on interfacing a Bluetooth module with
Arduino. This project can be taken to a higher level, like home
automation using a smartphone, smartphone-controlled robots,
and much more.
7
In the below wiring diagram, the phase line is connected
parallel to the light switch and the plug socket switch. Here, one
pole of the both SPST (single pole single throw) switches s1 & s2
are connected to the phase line of the supply. The other pole of
switch s1 is connected to the lamp and the other pole of switch s2
is connected to the phase pole of the three-pin socket.
The earth line is connected to the earth pole of the socket and
the neutral line is commonly distributed to the lamp and neutral
pole of the socket.
Here only one lamp is connected from the switch box. The
number of loads can be extended by adding more loads in parallel
to the lamp. But, the wiring capacity and rating of components
should be considered while adding more loads in parallel. For the
independent control of additional loads, connect the loads directly
from the phase through another switch.
8
9
Features of The Arduino Uno Board Used in Circuit:
10
Arduino Technology:
A typical example of the Arduino board is Arduino Uno. It includes an
ATmega328 microcontroller and it has 28-pins the pin configuration of the
Arduino Uno board is shown in the above. It consists of 14-digital i/o pins.
Wherein 6 pins are used as pulse width modulation o/ps and 6 analog i/ps,
a USB connection, a power jack, a 16MHz crystal oscillator, a reset button,
and an ICSP header. Arduino board can be powered either from the
personal computer through a USB or external source like a battery or an
adaptor. This board can operate with an external supply of 7-12V by giving
voltage reference through the IORef pin or through the pin Vin.
11
Arduino Architecture:
Basically, the processor of the Arduino board uses the Harvard architecture
where the program code and program data have separate memory. It
consists of two memories such as program memory and data memory.
Wherein the data is stored in data memory and the code is stored in the
flash program memory. The Atmega328 microcontroller has 32kb of flash
memory, 2kb of SRAM 1kb of EPROM and operates with a 16MHz clock
speed.
12
13
BLOCK DIAGRAM
14
15
16
CODE
String voice;
#define relay1 2 //Connect relay1 to pin 2
#define relay2 3 //Connect relay2 to pin 3
#define relay3 7 //Connect relay1 to pin 2
#define relay4 8 //Connect relay2 to pin 3
void setup()
{
Serial.begin(9600); //Set rate for communicating with phone
pinMode(relay1, OUTPUT); //Set relay1 as an output
pinMode(relay2, OUTPUT);
pinMode(relay3, OUTPUT); //Set relay2 as an output
pinMode(relay4, OUTPUT);
digitalWrite(relay1, LOW); //Switch relay1 off
digitalWrite(relay2, LOW); //Swtich relay2 off
digitalWrite(relay3, LOW); //Switch relay1 off
digitalWrite(relay4, LOW); //Swtich relay2 off
}
void loop()
{
while(Serial.available()) //Check if there are available bytes to read
{
delay(10); //Delay to make it stable
char c = Serial.read(); //Conduct a serial read
if (c == '#'){
break; //Stop the loop once # is detected after a word
}
voice += c; //Means voice = voice + c
}
if (voice.length() >0)
{
Serial.println(voice);
if(voice == "*switch on"){
switchon();
}
else if(voice == "*switch off"){
switchoff();
}
else if(voice == "*bulb1 on"){
digitalWrite(relay1, LOW);
}
17
else if(voice == "*bulb1 off"){
digitalWrite(relay1, HIGH);
}
else if(voice == "*bulb2 on"){
digitalWrite(relay2, LOW);
}
else if(voice == "*bulb2 off"){
digitalWrite(relay2, HIGH);
}
else if(voice == "*fan1 on"){
digitalWrite(relay3, LOW);
}
else if(voice == "*fan1 off"){
digitalWrite(relay3, HIGH);
}
else if(voice == "*fan2 on"){
digitalWrite(relay4, LOW);
}
else if(voice == "*fan2 off"){
digitalWrite(relay4, HIGH);
}
voice="";
}
}
void switchon() //Function for turning on relays
{
digitalWrite(relay1, LOW);
digitalWrite(relay2, LOW);
digitalWrite(relay3, LOW);
digitalWrite(relay4, LOW);
}
void switchoff() //Function for turning on relays
{
digitalWrite(relay1, HIGH);
digitalWrite(relay2, HIGH);
digitalWrite(relay3, HIGH);
digitalWrite(relay4, HIGH);
}
18
19
HARDWARE
Relay 12 V
Power Supply 9V
20
Table no.2 Arduino Uno Technical Specifications
PARAMETER SPECIFICATION
microcontroller
Operating Voltage 5V
SRAM 2KB
EEPROM 1KB
21
Table no. 3 Pin Description
Power Vin, 3.3V, 5V, Vin: Input voltage to Arduino when using an
GND external power source.
5V: Regulated power supply used to power
microcontroller and other components on the
board.
3.3V: 3.3V supply generated by on-board
voltage regulator. Maximum current draw is
50mA.
GND: ground pins.
Serial 0(Rx), 1(Tx) Used to receive and transmit TTL serial data.
22
Bluetooth Module (HC-05):
Relay:
23
Relay Driver (ULN2003):
24
25
Android:
26
27
SOFTWARE USED
Arduino IDE
The open-source Arduino Software (IDE) makes it easy to write code and upload
it to the board. It runs on Windows, Mac OS X, and Linux. The environment is written
in Java and based on Processing and other open-source software. This software can be
used with any Arduino board.
Arduino is an open-source prototyping platform used for building electronics
projects. It consists of both a physical programmable circuit board and a software, or
IDE (Integrated Development Environment) that runs on your computer, where you can
write and upload the computer code to the physical board.
The Arduino language is merely a set of C/C++ functions that can be called from
your code. Your sketch undergoes minor changes (e.g. automatic generation of function
prototypes) and then is passed directly to a C/C++ compiler (avr-g++).
Over the years Arduino has been the brain of thousands of projects, from everyday
objects to complex scientific instruments. A worldwide community of makers -
students, hobbyists, artists, programmers, and professionals - has gathered around this
open-source platform, their contributions have added up to an incredible amount
of accessible knowledge that can be of great help to novices and experts alike.
Arduino was born at the Ivrea Interaction Design Institute as an easy tool for fast
prototyping, aimed at students without a background in electronics and programming.
As soon as it reached a wider community, the Arduino board started changing to adapt
to new needs and challenges, differentiating its offer from simple 8-bit boards to
products for IoT applications, wearable, 3D printing, and embedded environments. All
Arduino boards are completely open-source, empowering users to build them
independently and eventually adapt them to their particular needs. The software, too, is
open-source, and it is growing through the contributions of users worldwide. There are
many other microcontrollers and microcontroller platforms available for physical
computing. Parallax Basic Stamp, Netmedia's BX-24, Phidgets, MIT's Handyboard, and
many others offer similar functionality. All of these tools take the messy details of
microcontroller programming and wrap it up in an easy-to-use package. Arduino also
simplifies the process of working with microcontrollers, but it offers some advantage
for teachers, students, and interested amateurs over other systems:
28
ADVANTAGES OF ARDUINO SOFTWARE: -
29
30
ADVANTAGES
31
DISADVANTAGES
32
33
APPLICATIONS
34
Some applications of Arduino Technology:
35
36
CONCLUSION
37
38
REFERENCE
www.beyondlogic.org
www.wikipedia.org
https://www.slideshare.net/mobile/Aakashkumar276/project-
report-on-home-automation-using-by-bluetooth
https://images.app.goo.gl/mhnutoyMXzBFLJQQ8
39