Arduino UNO Home Automation

Build a Bluetooth controlled Home Automation Setup Using Arduino UNO board and Relay module

  1. Do you want to automate your home?
  2. Have you ever wanted to control your home appliances by swipe the screen of your phone?
  3. Do you want to learn how to build an automation device for yourself?

In this project, we will see how to control a light bulb, fan, or other electrical devices in your home with an Arduino board. At the end of the project, you can control the connected load from your Smartphone.

Requirements of hardware in this Project:

  1. Arduino UNO board
  2. Relay module (5V)
  3. Bluetooth Module HC-05
  4. Jumper wires male to female
  5. Light bulb
  6. A USB cable for connecter Arduino UNO board
  7. Android Phone
Arduino UNO Home Automation

Requirements of software in this Project:

  1. Arduino IDE software (To program the Arduino board, we need to download the Arduino software)
  2. Android (Arduino Bluetooth controller App)

The Working principle of this Project:

There are four main components used:

  1. Android Smartphone
  2. Bluetooth module 
  3. Arduino UNO board
  4. Relay module

The Android application sends the data in series to the connected Bluetooth module HC-05 by clicking “ON” button. The Bluetooth module receives the application data and sends it through the TX pin of the Bluetooth module to the Arduino RX pin. The Arduino board reads the input data, processes it according to the program loaded inside and generates the output to the Relay Module.

Write a program in the Arduino IDE. 

Arduino UNO Home Automation 1

Full code show in below:

 String inputs;
 #define relay1 2 //connect relay1 to pin 9
 #define relay2 3 //connect relay2 to pin 8
 #define relay3 4 //connect relay3 to pin 7
 #define relay4 5 //connect relay4 to pin 6
 #define relay5 6 //connect relay5 to pin 5 
 #define relay6 7 //connect relay6 to pin 4
 #define relay7 8 //connect relay7 to pin 3
 #define relay8 9 //connect relay8 to pin 2
 void setup(){ 
Serial.begin(9600); //set rate for communicating with phone
pinMode(relay1, OUTPUT); //set relay1 as an output
pinMode(relay2, OUTPUT); //set relay2 as an output
pinMode(relay3, OUTPUT); //set relay1 as an output
pinMode(relay4, OUTPUT); //set relay2 as an output
pinMode(relay5, OUTPUT); //set relay1 as an output
pinMode(relay6, OUTPUT); //set relay2 as an output
pinMode(relay7, OUTPUT); //set relay1 as an output
pinMode(relay8, OUTPUT); //set relay2 as an output
digitalWrite(relay1, LOW); //switch relay1 off
digitalWrite(relay2, LOW); //switch relay2 off
digitalWrite(relay3, LOW); //switch relay1 off
digitalWrite(relay4, LOW); //switch relay2 off
digitalWrite(relay5, LOW); //switch relay1 off
digitalWrite(relay6, LOW); //switch relay2 off
digitalWrite(relay7, LOW); //switch relay1 off
digitalWrite(relay8, LOW); //switch 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
}
inputs += c; //means inputs = inputs + c
}
if (inputs.length() >0){
Serial.println(inputs);
if(inputs == "A"){
digitalWrite(relay1, LOW);
}
else if(inputs == "a"){
digitalWrite(relay1, HIGH);
}
else if(inputs == "B"){
digitalWrite(relay2, LOW);
}
else if(inputs == "b"){
digitalWrite(relay2, HIGH);
}
else if(inputs == "C"){
digitalWrite(relay3, LOW);
}
else if(inputs == "c"){
digitalWrite(relay3, HIGH);
}
else if(inputs == "D"){ 
digitalWrite(relay4, LOW);
}
else if(inputs == "d"){
digitalWrite(relay4, HIGH);
}
else if(inputs == "E"){
digitalWrite(relay5, LOW);
}
else if(inputs == "e"){
digitalWrite(relay5, HIGH);
}
else if(inputs == "F"){
digitalWrite(relay6, LOW);
}
else if(inputs == "f"){
digitalWrite(relay6, HIGH);
}
else if(inputs == "G"){
digitalWrite(relay7, LOW);
}
else if(inputs == "g"){
digitalWrite(relay7, HIGH);
}
else if(inputs == "H"){
digitalWrite(relay8, LOW);
}
else if(inputs == "h"){
digitalWrite(relay8, HIGH);
}
inputs="";
}
} 

Save your program and compile, as shown in the following figure

Arduino UNO Home Automation 2
Arduino UNO Home Automation 3

Connect your Arduino UNO board to your laptop or desktop computer through the Arduino UNO USB cable. Remove all other connections with the Arduino UNO board, such as the Bluetooth module and Relay module, and then “Upload the program to the Arduino UNO board”. The following figure shows the Arduino UNO board and the cables connected with that.

Arduino UNO Home Automation 4
Arduino UNO Home Automation 5
Arduino UNO Home Automation 6

Before uploading the code to the Arduino UNO board, make sure your Arduino serial port is selected. Otherwise, an error message "Serial port not selected" is shows on the screen.

To select your serial port in your laptop or desktop:

Open Device Manager -> Ports (COM & LPT) ->Arduino Uno, and then upload your program.

Arduino UNO Home Automation 7

After uploading the program in the Arduino UNO board. Connect all modules with the Arduino UNO board, such as the Bluetooth module and Relay module. The following image shows the "Digital circuit diagram."

Arduino UNO Home Automation 8

Connection between Relay Module, Bulb, and input power:

  1. Connect common-point (com) of Relay Module with home light.
  2. Connect normally-close (nc) of Relay Module with power.
  3. Connect remaining one home light wire with the power source.

Circuit Diagram Relay module with Light Bulb

Arduino UNO Home Automation 10

Connect all the modules with the Arduino UNO board, and light bulb with Relay.

Now, Connect Bluetooth modules HC-05 with the Android Smartphone. Consider the screenshots below:

Arduino UNO Home Automation 11

Note: Channel Relay module works only with PIN 6, PIN 7, PIN 8, and PIN 9.

When we click on the “ON” button of PIN 6, PIN 7, PIN 8, and PIN, the android application sends 1 to the Bluetooth module. The data is transmitted from the Bluetooth module to the Arduino board. As soon as the Arduino board gives permission to the Relay module for the power supply, the home appliance turns ON.

Arduino UNO Home Automation 12
Arduino UNO Home Automation 13
Arduino UNO Home Automation 14
Arduino UNO Home Automation 15

When we click on the OFF button of the PIN 6, PIN 7, PIN 8, and PIN 9, the Android application sends 0 to the Bluetooth module. The data is transmitted from the Bluetooth module to the Arduino device, and the home appliances turns OFF.

Arduino UNO Home Automation 16
Arduino UNO Home Automation 17

Related Topics

Download and Install Arduino in Windows

Download and Install Arduino in Windows Step 1. Download  IDE from https://www.arduino.cc/en/Main/Software. Step 2. Scroll down the page and click on Windows app link, as shown in the following figure. Step 3. Click on the...

1 minute read.

Salesforce IoT Cloud

Salesforce IoT Cloud IoT Cloud is a platform from Salesforce. Salesforce is designed to store and process IoT data. It is powered by Thunder. Thunder is an event processing engine designed to capture, filter, and...

2 minutes read.

Arduino UNO Home Automation

Build a Bluetooth controlled Home Automation Setup Using Arduino UNO board and Relay module Do you want to automate your home? Have you ever wanted to control your home appliances by swipe the screen...

4 minutes read.

Eclipse IoT

Eclipse IoT The two technologies IoT and M2M (Machine to Machine) are becoming trendy in the IT industry. The ability to connect sensors, actuators, and a wide range of devices open up a...

2 minutes read.

Advantages and Disadvantages of IoT

Advantages of IoT Applications Security: You can control your home through the mobile phones. It provides personal protection. Stay connected: You can connect virtually to your family. Efficient usage of electricity:  You can use...

2 minutes read.

Components of IoT

There are the following components used in IoT: Devices and sensorsCloud ComputingUser interfaceNetworking connectionGateway Devices and sensors Devices and sensors are the components of the connectivity layer. These smart sensors continuously collect data from the...

2 minutes read.

Network layer Protocols

Network layer Encapsulation ProtocolsNetwork Layer Routing Protocols 1. Network layer Encapsulation Protocols a) 6LoWPAN 6LoWPAN stands for IPv6 Over Low-Power Wireless Personal Area Network. It is mostly used standard in this category. It...

2 minutes read.

IoT Architecture

Our approach to the IoT architecture is reflected in the IoT architecture diagram that presents the diagram of an IoT system and explains how it is connected to store, collect,...

2 minutes read.

IoT - Platform

IoT Platform: As in IoT, all IoT devices are connected to other IoT devices and applications to transmit and receive information through protocols. There is a difference between the IoT...

2 minutes read.

Challenges of IoT

Challenges of IoT There are two categories of challenges to overcome for the IoT organization to grow. It is accepted by all the technologies not only for IoT. Two significant challenges in IoT: Technological...

3 minutes read.

IoT Protocols

IoT Protocols A protocol is a set of basic rules that allow electronic devices to communicate with each other. These instructions include the types of data that can be sent, the...

1 minute read.

Arduino UNO Bluetooth LED Controls

How to Build a Bluetooth controlled LED light Setup Using Arduino UNO board: Let's build an IoT project using Arduino UNO and the Bluetooth module HC-05 to control an LED. In this project,...

2 minutes read.

IoT Technologies

The IoT is based on three main technologies: Hardware (includes chips and sensors)Communication (includes wireless network)  Software (includes data storage, analytics, front-end applications) The reason the Internet of Things is emerging so rapidly today...

1 minute read.

3D Printing

3D printing is making 3D solid objects from a digital file, achieved using additive processes. In this process, an object is created by laying down successive layers of the material...

4 minutes read.

5G

The next generation of mobile networks is a new global wireless standard after 1G, 2G, 3G, and 4G networks. It enables a new network to connect virtually everyone, including machines,...

5 minutes read.

IoT GE Predix

The GE Predix stands for the General Electric Predix. GE Predix is a software platform that collects data from industrial instruments. It provides a cloud-based PaaS (platform as a service)...

1 minute read.

Arduino UNO Radar Project

Arduino Radar Project In this project, we will explain how to create a simple radar system using Arduino and Processing IDE. The Arduino radar project is implemented using Processing Applications. Radar is a long-range object detection...

9 minutes read.

Applications of IoT

Smart Home: A smart home encapsulates the connectivity inside our homes. It includes home appliances, smoke detectors, windows, light bulbs, door locks, etc. Smart City: A Smart City is a technically advanced...

2 minutes read.

Arduino UNO Distance Project

Ultrasonic Sensor HC-SR04 and Arduino to distance calculation using Processing App: Let's build an IoT project using Ultrasonic HC-SR04 Sensor and Arduino UNO to calculate the distance between the Ultra Sonic HC-SR04 device and...

2 minutes read.

Contiki OS

Contiki OS Contiki is an open-source operating system (OS) that works on small, low-power microcontrollers. It allows the development of applications. The application allows efficient use of hardware while providing standardized low-power wireless communication...

2 minutes read.