Advanced home automation using Arduino and Bluetooth that controls from anywhere
In the last project, we developed a project that helped you in controlling all your house’s devices from a single controller that is attached to your house’s system. Now, what if we tell you that we can go 1 step further? That’s right! Understand how Advanced home automation using Arduino and Bluetooth sensor works.
See the previous project: Lets make home automation with Arduino and Raspberry Pi
A project where we no longer need the controller to be attached to your home but is completely transportable. Yes, that’s exactly what we are going to build. Using your phone’s Bluetooth and sensors, we will connect all of your house’s devices to your phone so that you can control your entire house via JUST your phone!
So, let’s get started.
Let’s look at the hardware devices we need to build your home automation with Arduino and Bluetooth sensor
Components and software required
Following is the list of hardware components and supplies you need to assemble before starting the project
- Arduino Uno
- jumper wires (generic)
- LDR (light dependent resister)
- PIR motion sensor (generic)
- relay (generic)
- temperature sensor
- HC-05 Bluetooth module
- led (generic)
Online software
To build a home automation system using Arduino UNO and Bluetooth sensors you need the following platforms to code:
Now that we have assembled all the things that we need to get started on the project, let’s talk about the basics of this automated home system build using Arduino and understand how it works.
Overall Configuration of advanced home automation
To understand the configuration of the circuit, refer to the following image:
The given image tells us that the Arduino UNO will collect all the sensor data and read it along with controlling the devices of the room. The image “Room Configuration” shows how the Arduino will interact with the devices of the room. These devices include Lights, Fans, Wall sockets, Temperature Sensors ie LM35 that detects the room temperature, LDR that detects the light intensity near the window of the room, Passive IR that detects the human presence in the room etc.
Room Configuration for home automation using Arduino and bluetooth sensor
Since we are aware of the basic functioning of the system and how the Arduino receives and transmits data, let’s look at the code we need to bring your home automation system with Arduino UNO and Bluetooth into effect.
To have a better clarification of the devices that we will be using in this project, we should have a deeper look into their configurations:
Sensor Configurations
We will now look into the different sensors that will be used for your automated home system namely LM35, PIR, HC-05 and others
- Servo Motors: These are DC motors that have closed-loop circuitry within them. They are composed of a DC motor, a gearbox, a control circuit and a potentiometer. These are used to move a gearbox using a large reduction ratio.
- LM35: The LM35 is a precision IC temperature sensor that has an output proportional to the temperature in oC. Since its sensor circuitry is completely sealed, it is not affected by the oxidation process or others.
- PIR: PIR consists of 3 pins, ground, signal and power. The sensor power is usually up to 5V.
- HC-05: It uses serial communication to communicate with other electronics. It uses the 2.45GHz frequency band. It can be operated with a power supply within 4-6V.
Arduino Code
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
}
The code allows your Arduino Board to be connected to the HC-05 Bluetooth and read data from your room’s devices and further communicate with your phone.
Concluding the project, the last step is to connect your phone’s Bluetooth to the Arduino Board to finish up your home automation system using Arduino UNO and Bluetooth sensor.
So. let’s move ahead!
Linking your Phone and the Arduino UNO
Now all you need to do is link your Arduino to your phone and you have your FULLY automated home all ready. Let’s see how can we do that
- To link your phone with UNO, go to the Bluetooth icon and scan for newer connections
- As soon as you see HC-05, click and connect to it. Use the pairing code 1234 to connect the 2 devices.
- Now that your phone and HC-05 are connected, you can send and receive data and control your Automated home system easily.
Refer to the schematic diagram to further understand the connection:
And there you have it! Your completely automated home using Arduino UNO and Bluetooth sensors which can be controlled using your phone anytime anywhere.
Let us know what you think about Advanced home automation using Arduino uno and Bluetooth module in the comment section below.
See also: 3 Steps to build your IoT Project with Blynk IoT app [updated]
If you like this post subscribe our YouTube Channel for IoT video Tutorials. You can also find us on Twitter, Facebook, and Instagram for more updates.
Start your IoT journey with IoT Basics from IoTDunia.
Reference and Image Credits:
Leave a Review