IoT Voice Activated Home Automation Project by using Arduino For Smart Home

In recent years there has been an increase in smart home technology. Home automation has become the new trend. It allows us to control all our home appliances (lights, fans, thermostat, TV, security cameras) by connecting them to a common remotely controllable network making it much more accessible and convenient. And, while it brings home management to a whole new level, it also helps to maximize home security.

Types of Home Automation:

There are many types of Home Automation Systems. Power Line Home Automation Systems (using existing power lines in home automation), Wired Home Automation Systems (installing a wired system that connects into a control center), and Wireless Home Automation Systems (the most popular choice, home automation using wireless technology like Wi-Fi, Bluetooth, and internet).

Here we will discuss a Voice Activated Home Automation System, how to design a voice activated home automation system that uses voice command to control your appliances. This project is designed by incorporating Arduino UNO, Bluetooth, and a smartphone device, along with other components.

Components Required

  • Arduino UNO x 1
  • HC – 05 Bluetooth Module x 1
  • Smart Phone or Tablet x 1
  • 2N2222 NPN Transistor x 4
  • 12V Relay x 4
  • 1 KΩ Resistor x 4
  • 1N4007 PN Junction Diode x 4
  • Power Supply
  • Connecting Wires
  • Breadboard (Prototyping Board)
  • App for transmitting voice to Bluetooth

Components Description

1: Bluetooth HC-05:

For this wireless home automation, we will use Bluetooth module HC-05. HC-05 is an easy to use Bluetooth SPP module (Serial Port Protocol) for wireless connection setup. It can be used as either Master or Slave configuration. The default settings are SLAVE. The slave module can only accept connections from another device but cannot connect to another Bluetooth device. On the other hand, a MASTER module can connect to other devices. The module uses UART interface to communicate and uses a baud rate of 9600 bps when at default mode. In the Bluetooth HC-05 module, there are pins for VCC (5V), GND, TX, and RX.

2: Bluetooth Voice Control for Arduino:

This app uses voice recognition in android mobiles to pass voice commands to central control. It pairs with Bluetooth modules and sends the voice commands in the form of a string. You can also use similar apps, for example, Bluetooth Controller 8 Lamp, RemoteXY: Arduino Control, Virtual etc.

3: Relay Board:

A relay is an electrical device used to control high voltages using low input. It is used to connect small current transistor circuits with large current AC circuits. The relay boards used in this project has four channels.

Circuit Design:

For the circuit design follow the following procedure.

1: Connect Bluetooth Module to Arduino:

Connect Arduino to Bluetooth module using the RX and TX pins of Arduino as Bluetooth is based on UART Protocol. By using the Software Serial library of Arduino for digital pins we will define our pins as Pin 2 and Pin 3 (Pin 2 for RX and Pin 3 for TX)

2: Connect Relay Board to Arduino:

Simply connect the inputs of the individual relays to the Arduino. Detailed connections of the resistor, transistor, diode, and relay are shown in circuit diagram.

Working on Home Automation System:

After making circuit design and connecting Bluetooth, Arduino and relay, turn on power supply to the circuit. Next, you are required to install the “Bluetooth Voice Control for Arduino” app mentioned before. Now, connect your phone to the Bluetooth HC-05 module. For this open, the app on your phone, choose option “Connect Robot” and select the Bluetooth device. You will have to pair these devices by using the pin of the Bluetooth HC-05 module.

After you have successfully completed all these steps, your device is ready to transmit voice messages. Press the microphone icon on your app and give your voice command. (In case you are using google app make sure the voice recognition feature is enabled)

For example: Press the microphone icon and say “turn on light”, the app will transfer your command after recognition to the Bluetooth module. The command is then displayed on the app screen for confirmation. When the app detects the voice command “turn on light”, it transmits this command as “*turn on light#”. The symbols ‘*’ and ‘#’ at the start and end of the command help to identify the start and end of a message.

We have used the following simple voice commands in this home automation : “turn on light”, “turn off light”, “turn on fan”, “turn off fan”, “turn on AC”, “turn off AC”,  “turn on TV”, “turn off TV”, “turn on all”, “turn off all”.

Source Code: 



<pre>#include <SoftwareSerial.h>

const int rxPin = 2;
const int txPin = 3;               
SoftwareSerial mySerial(rxPin, txPin);

int ac=4;
int light=5;
int fan=6;
int tv=7;
String data;

void setup() 
{
   Serial.begin(9600);
   mySerial.begin(9600);
   
   pinMode(ac, OUTPUT);
   pinMode(light, OUTPUT);
   pinMode(fan, OUTPUT);
   pinMode(tv, OUTPUT);
 
   digitalWrite(ac, LOW);
   digitalWrite(light, LOW);
   digitalWrite(fan, LOW);
   digitalWrite(tv, LOW);
}

void loop() 
{
    int i=0;
    char ch=0;
    data="";
    while(1)
    { 
      while(mySerial.available()<=0);
      ch = mySerial.read();
      if(ch=='#')
      break;
      data+=ch;
    }
   Serial.println(data);
    
    if(data=="*turn on AC")
    { 
      digitalWrite(ac,HIGH);
      Serial.println("ac on");
    }
    else if(data=="*turn off AC")
    {
      digitalWrite(ac,LOW);
      Serial.println("ac off");
    }
    else if(data=="*turn on light")
    {
      digitalWrite(light,HIGH);
      Serial.println("light on");
    }
    else if(data=="*turn off light")
    {
      digitalWrite(light,LOW);
      Serial.println("light off");
    }
    else if(data=="*turn on fan")
    {
      digitalWrite(fan,HIGH);
      Serial.println("fan on");
    }
    else if(data=="*turn off fan")
    {
      digitalWrite(fan,LOW);
      Serial.println("fan off");
    }
    else if(data=="*turn on TV")
    {
      digitalWrite(tv,HIGH);
      Serial.println("tv on");
    }
    else if(data=="*turn on TV")
    {
      digitalWrite(tv,LOW);
      Serial.println("tv off");
    }
    else if(data=="*turn on all")
    {
      digitalWrite(ac,HIGH);
      digitalWrite(light,HIGH);
      digitalWrite(fan,HIGH);
      digitalWrite(tv,HIGH);
      Serial.println("all on");
    }
    else if(data=="*turn off all")
    {
      digitalWrite(ac,LOW);
      digitalWrite(light,LOW);
      digitalWrite(fan,LOW);
      digitalWrite(tv,LOW);
      Serial.println("all off");
    
    }
    
}


Construction and Output Video

 

Applications of Home Automation System:

It helps is to control a number of appliances through a common network easily by simple voice commands. You can manage all your devices from one place. This system will prove to be highly useful for people with are old or disabled. With voice-activated home automation system, you can make your space more energy efficient and can improve your home management.



Related posts

Top Arduino sensors – the ultimate list 2021

Google Assistant Voice Controlled Switch – NodeMCU IOT Project

ElectronicsLovers ZERO-IoT-Development Board – ZID-2020

5 comments

Serkan June 1, 2018 - 1:14 pm

Can you share Android code with me?
serkanbaki37@outlook.com

Abid Jamal June 1, 2018 - 2:23 pm

Dear Serkan,

Kindly read the above article carefully with more attention and hopefully you will find a LInk to Download an Android App ( No code)

Bill Jiang June 16, 2018 - 8:21 pm

That is really interesting, I like this .

Raghavendra March 21, 2019 - 7:54 pm

I can’t understand circuit diagram Plz send with understand ing circuit diagram send in my Gmail

thuwaibah February 16, 2020 - 8:06 pm

Hello can you please send me the report of this project to my email for my reference, thank you. My email is noorthuwaibah97@gmail.com.

Add Comment