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

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.

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.

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.

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.

IoT-ThingWorx

IoT-ThingWorx The ThingWorx is an IoT platform that helps commercial corporations assess and release the value of IoT. It promises the tools and technology necessary to developed. It implements a robust...

2 minutes read.

Internet of Things

The Internet of Things is a network of objects embedded with sensors, software, and other technologies for connecting and exchanging data with other devices and systems over the internet. These devices...

5 minutes read.

Skills required for an IoT Developer

"Internet of Things" is about communication between software and devices. An IoT development team should be essentially large, and developers are divided into different areas according to their respective work. Some of these...

1 minute read.

IoT Software

The IoT software addresses significant areas of networking and action through platforms, integrated systems, associated systems, and middleware. These applications are responsible for data collection, device integration, real-time analysis, and process extension in 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.

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.

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 Hardware

IoT hardware includes a wide range of devices, such as routing devices, bridges, sensors, etc. These IoT devices support key tasks and functions such as system activation, security, action specifications, communication, and detection...

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.

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.

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.

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.

Arduino UNO Board with PIR Motion Sensor

Arduino UNO Board with PIR Motion Sensor In this project, we will create a simple circuit with an Arduino UNO and PIR motion sensor detects movement. An LED light up when the movement...

2 minutes read.

Session Layer Protocols

1) MQTT MQTT stands for Message Queue Telemetry Transport. It was introduced by IBM in 1999 and standardized by OASIS in 2013. It is used for remote monitoring in IoT. Its...

2 minutes read.

IoT Ecosystem

The following figure shows the seven-layer model of the IoT Ecosystem. The first layer represents the market or application domain that includes smart grid, connected home, smart health, or smart cities, etc.The second layer consists...

1 minute read.

What is an IoT Device?

A device in which a sensor is connected and able to transfer data from one device to another over the internet is called an IoT device. IoT devices consist of software, wireless sensors, actuators,...

1 minute read.