Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

Home Automation Using Arduino and Bluetooth

Control © Apache-2.0
An advanced home automation project with Arduino Uno and Bluetooth sensor to control it, anytime from
anywhere.

Components and supplies

Arduino UNO & Genuino UNO


× 1

Jumper wires (generic)


× 1

LDR (LIGHT DEPENDENT RESISTER)


× 1

PIR Motion Sensor (generic)


× 1

Relay (generic)
× 1

Temperature Sensor
× 1
HC-05 Bluetooth Module
× 1

LED (generic)
× 1

Apps and online services

Arduino IDE

Microsoft Windows 10

About this project


ABOUT THE PROJECT

In today's era, technology can enhance human life. Technology is evolving decade by decade. Automation was a
science fiction earlier but not today. By combining latest technology with home, we can build an awesome home.
With the Arduino uno and Windows 10, we can build a home automation system that is capable of operating
home devices automatically.
Getting Started

Before starting the project, lets understand basics first. Consider the following image (overall configuration):

Configuration for Room

Now considering room scenario, an Arduino UNO will control devices and reads sensor data. The figure "Room
Architecture" depicts how the Arduino UNO will connects with the devices and sensors. Room have multiple
controllable devices(i.e. Light(s), Fan, Wall Socket(s), etc.), one PassiveIR (to detect human presence in the
room), one temperature sensor (LM35 to collect room temperature) and LDR (to detect light intensity near room
window).

Configuration of Different Sensors

Servo Motors

Servo motors are geared DC motors with the closed-loop circuitry incorporated within them. The basic
configuration of a servo motor composed of a DC motor, gearbox, potentiometer and control circuit.

DC motor is used to move a gearbox with a large reduction ratio. The final shaft imposes a force on the external
load and simultaneously acts on the axis of the feedback potentiometer. So, the potentiometer senses the position
of the axis and sends a corresponding voltage to an operational amplifier. This voltage compared to the input
voltage, that determines the desired position of the shaft, producing a voltage in the output of the comparator.
This voltage powers the motor such that the shaft moves in the necessary direction to align with the angle that
corresponds to the voltage applied to the input.

LM35

A precision IC temperature sensor with its output proportional to the temperature (in oC). The sensor circuitry is
sealed and therefore it is not subjected to oxidation and other processes.

PIR

The pin configuration of the PIR sensor is shown in the figure. PIR sensor consists of three pins, ground, signal,
and power at the side or bottom. Generally, the PIR sensor power is up to 5V, but, the large size PIR modules
operate a relay instead of direct output.

HC-05 (Bluetooth)

To make a link between your Arduino and bluetooth, do the following: 1) Go to the bluetooth icon, right click
and select Add a Device 2) Search for new device, Our bluetooth module will appear as HC-05, and add it 3) The
pairing code will be 1234. 4)after make a pairing, we can now program the arduino and upload a sketch to send
or receive data from Computer.
Code
CODE FOR HOME AUTOMATIONC/C++

TYPED ON ARDUINO IDE


float x,y; //TEMP
#define trigPin 12 //ULTRA
#define echoPin 10
int ledPin= 13;
int duration, distance; //ULTRA

#include<Servo.h> //servo
Servo my; //servo

char val; //bluetooth

void setup() {
Serial.begin(9600);
pinMode(2,INPUT); //IR GATE FIRST
pinMode(3,INPUT);
my.attach(11); //servo

pinMode(4, OUTPUT); //IR GATE FIRST

pinMode(7,OUTPUT); //TEM
pinMode(8,INPUT); //pir 1
pinMode(9,OUTPUT); //LED 1
// pinMode(10,INPUT); //pir 2
//pinMode(11,OUTPUT); //LED2
pinMode(trigPin, OUTPUT); //12 PIN ULTRA
pinMode(echoPin, INPUT); //10 PIN ULTRA
pinMode(ledPin, OUTPUT); //13 PIN ULTRA

pinMode(3,OUTPUT); //bluetooth
}

void loop() {
x=analogRead(0); //TEMP
y=((x/1024)*5)*100;
Serial.println(y);
delay(500);

if(y>44)
{
digitalWrite(7,1);
}
else
{
digitalWrite(7,0);
delay(500);
}
//TEMP

if(digitalRead(8)==HIGH) //pir
{
digitalWrite(9,HIGH);
}
else
{ digitalWrite(9,LOW);}

digitalWrite(trigPin, HIGH); //ULTRA


delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;

if (distance >= 10 || distance <= 0)


{
// Serial.println("no object detected");

digitalWrite(ledPin,LOW);
}
else
{
Serial.println("object detected \n");
Serial.print("distance= ");

Serial.print(distance);
digitalWrite(ledPin,HIGH);
} //ULTRA
if(digitalRead(2)==HIGH) //gate first
{
my.write(0); //servo

}
else
{
my.write(90); //servo
}

analogRead(5); //ldr
float a = analogRead(5);
Serial.println(a);

if (a <=200) {

digitalWrite(4,1);
Serial.println("LDR is DARK, LED is ON");

}
else {

digitalWrite(4,0);
Serial.println("-----");

} //ldr

if (Serial.available()) //bluetooth
{
val = Serial.read();
Serial.println(val);
if(val == 'TV')
digitalWrite(3,HIGH);

else if(val == 'tv')


digitalWrite(3,LOW);

} //bluetooth

Schematics
BLUEPRINT FOR PROJECT
Comments
Please log in or sign up to comment.

bricomario

a year ago

Hi Shubhamkumar97, it is a cool project. Thanks for sharing. But I see a AT89C51 and a ULN2003A in the
shematic, not an Arduino board... I would appreciate more details if possible. Thanks.

Shubhamkumar97

a year ago

I will change it, it's from a another project


Thanks for comment!
Keep supporting.

mo7amad_ma

a year ago

Hi Shubhamkumar97, it is a really intelligent project. Thanks for sharing


but I didn't get the idea of how we can apply this project in real life

Shubhamkumar97

a year ago

Thanks for complement first.


mo7amad_ma, I know some part of the project is hard to apply on real life(ldr and pir).
But, rest of the part is easy to apply. And i think if we plan home accordingly we can plant these sensors also..

skatimba

4 months ago

Hi. I would like to know where the bluetooth itself was used? Why is the bluetooth module needed in this
automation project?

Akash22

9 months ago

Can you plz send the circuit daigram for this project at my email. akash.gajbhiye18@vit.edu

rajumaddipati

7 months ago

hi bro can we control the above project with wifi instead of bluetooth.

bro can you send me the above project circuit diagram and code to my mail id rajukumar6113@gmail.com

skatimba

4 months ago

Hi. I would like to know where the bluetooth itself was used? Why is the bluetooth module needed in this
automation project?
skatimba

2 months ago

Hi. Are you using the computer to control the LED'S or are they turning off and on automatically? Please reply

TheCrazyCrush

a month ago

This is start of something future

You might also like