Control Smartphone devices | Automate smart homes using Arduino and Bluetooth.

Controlling smartphones and home automation using Arduino and Bluetooth is an effective way to connect and control devices in your home remotely. Below is a detailed guide to implementing a smart home automation system with Arduino and Bluetooth, allowing you to control your smartphone devices through a Bluetooth app on your phone.
When it comes to getting up and turning on or off the lights in your room, it feels very lazy. In this tutorial, we will discuss home automation using Arduino and Bluetooth . We will control the devices in our home using Bluetooth on our phone. To achieve complete home automation using Arduino and Bluetooth on our mobile device, we will use Arduino and HC-05 Bluetooth module.
We need something that can help us to create wireless communication between our mobile phone Bluetooth and our Arduino. So we are using HC-05 Bluetooth module here. Let us briefly discuss about making home automation using Arduino and Bluetooth with detailed circuit, Arduino code and video.
So, let’s get started with today’s tutorial on home automation via Bluetooth.

1. Components to prepare

  1. Arduino Uno or Nano: Main microcontroller.
  2. Bluetooth module HC-05 or HC-06: To connect with a smartphone via Bluetooth.
  3. Relay Module: To control electronic devices (such as lights, fans).
  4. Smartphone with Bluetooth application: To send control commands.
  5. Connecting wires and breadboard: To connect the components.

What is Bluetooth Module HC-05?

HC05 is a Bluetooth module that communicates over a serial port. The HC-05 Bluetooth module is a UART serial converter module that can help wirelessly transmit data between two microcontrollers or between a microcontroller and a device such as a mobile phone or laptop through the use of wireless Bluetooth.

HC-05 Bluetooth module Pinouts

  • EN – This is the Enable pin. When this pin is HIGH(1), the module is in AT command mode, otherwise it will be in default DATA mode.
  • RxD – This is the Rx (Receiver) pin, which is used to receive data from a microcontroller or any other hardware device, such as a sensor.
  • TxD – Data transmission pin, used to transmit received data over Bluetooth to a Bluetooth enabled connected device.
  • GND – Ground (-ve).
  • VCC – Power supply pin +4V – +6V DC.
  • State – Used to test or notify the target device that the Bluetooth device has wirelessly connected to another device and is functioning properly.

HC-05 Bluetooth Module Basic features and parameters:

  • Operating voltage 4V-6V
  • Operating current: 30mA
  • Maximum distance: <100 (Usually 50-60m)
  • Baud rate: 9600, 19200, 38400, 57600, 115200, 230400, 460800.
  • Serial data BT module for microcontrollers like Arduino, AVR etc.
  • Easy communication/pairing with computer and phone via Bluetooth.

Materials and components

  • Arduino UNO
  • Bluetooth Module HC-05
  • Relay Module
  • LED Light (Optional)
  • Wire

Required software:

Arduino IDE – To program Arduino Pro-Mini.
Arduino Smart Home Control App – To control devices via smartphone.

Circuit diagram for controlling home appliances using Bluetooth.

Configure Arduino Smart Home Control application.

Dieu khien thiet bi dien thoai Smartphone Tu dong hoa nha thong minh su dung Arduino va Bluetooth. 2

Dieu khien thiet bi dien thoai Smartphone Tu dong hoa nha thong minh su dung Arduino va Bluetooth. 1

Repeat the steps shown and then pair and connect the Hc-05 to the smartphone (default pairing code – 1234).
ON_State = ‘A’, OFF_State = ‘a’ the application will send these values ​​when we click On/off via Bluetooth to Arduino, and Arduino will change its output state – D2.
Following code is generated using these ON_State and OFF_State values.
first
2
3
4
5
6
7
8
9
ten
11
twelfth
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
thirty first
//arduino code for bluetooth home automation
//code by electroinvention and electrovilla
#define OUT 2 //setting pin2 as "OUT" variabe
char val; //declaring additional variable to read data received via bluetooth
//declaring PIN2 as pinmode output
//PIN2 is connected to "OUT" variable
void setup() {
  pinMode(OUT, OUTPUT);
  Serial.begin(9600);
}
//begin the main loop here
void loop() {
  if (Serial.available() == 1) {  //using boolean operator to check if data is being received 1(true)
    val = Serial.read(); // store the received bits to "val"
  }
//reading the data from "val"
  if (val == 'A') {        //if received val=='A', then 'OUT=HIGH'
    Serial.println("LED_ON");
    digitalWrite(OUT, HIGH);
  } else if (val == 'a') {  //if val ='a', then 'OUT=LOW'
    Serial.println("LED_OFF");
    digitalWrite(OUT, LOW);
  }
}

Explain the connection and operation of the circuit

RX of Arduino UNO is connected to TX of HC-05 Bluetooth module so that Arduino can receive serial data from HC-05.
The TX of the Arduino is connected to the RX of the HC-05 Bluetooth module so that the HC-05 can receive serial data from the Arduino UNO and broadcast it over Bluetooth devices.
In this configuration, HC-05 and Arduino UNO can communicate with each other using the serial USART communication protocol. And Arduino will be able to read the data received from Bluetooth which we will send through the smartphone to control the devices connected at the output of the relay module.
The VCC of the HC-05 will be connected to the 5V pin of the Arduino UNO, and GND to GND (Ground). To provide power to the HC-05 Bluetooth module.
There is no use of EN (Enable) and STATE pins of the HC-05 Bluetooth module in this circuit so these two pins are not connected anywhere.
The VCC pin and GND pin of the relay module are connected to the 5V and GND pin of Arduino UNO to supply power to the relay module.
The input signal pin of the relay module is connected to pin 2 (D2) of Arduino UNO.
On the switching side, the Phase/voltage input wire (P or L) is connected to the COM (common) pin of the relay and the Phase input wire or one wire of the bulb is connected to the NO (Normally Open) pin, the Neutral (N) wire is connected directly from the main power supply to the load/bulb.
When Arduino gets Val == ‘A’, then Arduino prints string “LED_ON” every time in next line and D2 pin status becomes HIGH, Hence relay is turned on and COM (Common) pin connects to NO (Normally Open) pin and hence current starts flowing into our device and Device – Bulb connected to NO (Normally Open) turns on.
And when Arduino gets val == ‘a’, then Arduino prints string “LED_OFF” every time in next line and D2 pin state becomes LOW, relay turns off and Device – Bulb connected to it also turns off.
This process repeats every time the Arduino receives val == ‘A’ or ‘a’ over Bluetooth from the pre-configured application.
To see the project in action and learn more, please watch the video below.
Working for Bluetooth Home Automation
We hope our content is useful to you. If our content is helpful to you in any way, please share it with your friends. Please leave a comment below if you have any other requests or questions.
For more articles and similar Circuits, please subscribe to our newsletter. It’s free! 🙂

Conclusion

With the instructions above, you can set up a simple home automation system using Arduino and Bluetooth. This system allows you to remotely control electronic devices through your smartphone, providing convenience and better control for your home.

Leave a Reply