Table of Contents
Voice controlled Home Automation using Arduino: In this project, we are using a voice function to control home devices. This project is the part of my Home Automation series. This project is similar to home automation using Bluetooth. In that project we use the S2 Terminal application in this we use AMR_Voice application. This application is free and very easy to use. This project is very easy to use in real life. People of any age can control it by just speaking the commands. This Arduino based project has a larger range than IR and PC-based ones. Before making this project, you should know how to interface HC 05 Bluetooth module with Arduino and should also know about Arduino programming basics.
you may also like to check other home automation projects developed by us:
- IR remote controlled based home automation using Arduino
- PC-based home automation system
- Bluetooth based home automation system
- GSM based home automation system
Block Diagram of Voice controlled Based Home Automation
Components Required for voice controlled home automation system using Arduino
- Arduino Uno: We use Arduino due to its simplicity and it also provides the much digital pin to interface with LCD, Bluetooth module, and relay module at the same time.
- HC-05 Bluetooth Module: HC-05 is used to communicate with the mobile phone.
- 4 Channel Relay Modules: The module we use in this project is HL-54S. It switches on and off using a 5v logical signal from Arduino. It can bear up to 250VAC and 10A. These modules have 4 channels so we can control 4 AC devices at a time.
- 16×2 LCD: LCD is used to display project name, a list of commands which can be entered then it asks to give any command and show the status of the command which is entered. We use 16×2 LCD because it is easy to interface with Arduino and very cheap in price. 10k potentiometer is used to control the contrast of display
- AC bulbs with holders: AC bulbs are used to represent appliances. Because it is easy to handle and very useful when you are prototyping any AC project. In final product just replace with devices to control.
- AC wire with plug: I advise you to use good quality wire when working with higher voltages. It is always good to use electrical tape to protect connections.
- External 5 Volt supply: 5-volt dc supply is required to switch a relay on and off. Otherwise, it did not work. Also, do not supply 5v from Arduino.
Circuit Diagram of voice controlled home automation system using Arduino
Connections:
Bluetooth Module HC-05
- HC-05 Rx to Arduino Tx.
- HC-05 Tx to Arduino Rx.
- Vcc to 5v
- Ground to ground.
16×2 LCD:
- VSS to ground.
- VDD to supply voltage.
- VO to adjust pin of 10k potentiometer.
- RS to Pin 8.
- RW to ground.
- Enable to Pin 9.
- LCD D4 to Pin 10.
- LCD D5 to Pin 11.
- LCD D6 to Pin 12.
- LCD D7 to Pin 13.
- Ground one end of a potentiometer.
- 5v to another end of the potentiometer.
4 Channel Relay modules:
- External 5 volt to JD VCC.
- Ground to ground.
- Ini1 to Pin 3.
- Ini2 to Pin 4.
- Ini3 to Pin5.
- Vcc to Arduino 5v.
- Connect one terminal of all bulbs to normally open terminal of relays.
- One end of 220VAC to all common terminals of the relay and another end with another terminal of bulbs.
Working of voice controlled home automation system
We speak the predefined commands to AMR_Voice application. The application sends the command to Bluetooth which is then received by Arduino and perform the described task. At the same time, Arduino displays the status on LCD and write on the serial monitor. Each command has its unique operations which are defined in code. You can change the commands according to your ease. Below is the list of commands.
Commands: Following commands should be spoken by the user to turn on and turn off devices.
Command send by mobile | Message display on monitor |
white on | White ON |
white shutdown | White OFF |
blue on | Blue ON |
blue shutdown | Blue OFF |
green on | Green ON |
green shutdown |
Green OFF |
Code of voice controlled home automation system
#include <LiquidCrystal.h> LiquidCrystal lcd(8, 9, 10, 11, 12, 13); #define white 3 #define blue 4 #define green 5 int tx=1; int rx=0; char inSerial[15]; void setup(){ Serial.begin(9600); pinMode(white, OUTPUT); pinMode(blue, OUTPUT); pinMode(green, OUTPUT); pinMode(tx, OUTPUT); pinMode(rx, INPUT); digitalWrite(white, HIGH); digitalWrite(blue, HIGH); digitalWrite(green, HIGH); lcd.begin(16, 2); lcd.clear(); lcd.print("MICROCONTROLLERS "); lcd.setCursor(0,1); lcd.print(" LAB "); delay(2000); lcd.clear(); lcd.print("VOICE CONTROL"); lcd.setCursor(0,1); lcd.print("HOME AUTOMATION "); delay(2000); lcd.clear(); lcd.print("1. Bulb 1 WHITE"); lcd.setCursor(0,1); lcd.print("2. Bulb 2 BLUE"); delay(2000); lcd.clear(); lcd.print("3. Bulb 3 GREEN"); delay(2000); lcd.clear(); lcd.print("Bulb 1 2 3 "); lcd.setCursor(0,1); lcd.print(" OFF OFF OFF"); } void loop(){ int i=0; int m=0; delay(500); if (Serial.available() > 0) { while (Serial.available() > 0) { inSerial[i]=Serial.read(); i++; } inSerial[i]='\0'; Check_Protocol(inSerial); }} void Check_Protocol(char inStr[]){ int i=0; int m=0; Serial.println(inStr); if(!strcmp(inStr,"*white on#")){ digitalWrite(white, LOW); Serial.println("White ON"); lcd.setCursor(4,1); lcd.print("ON "); for(m=0;m<11;m++){ inStr[m]=0;} i=0;} if(!strcmp(inStr,"*white off#")){ digitalWrite(white, HIGH); Serial.println("White OFF"); lcd.setCursor(4,1); lcd.print("OFF "); for(m=0;m<11;m++){ inStr[m]=0;} i=0;} if(!strcmp(inStr,"*blue on#")){ digitalWrite(blue, LOW); Serial.println("Blue ON"); lcd.setCursor(8,1); lcd.print("ON "); for(m=0;m<11;m++){ inStr[m]=0;} i=0;} if(!strcmp(inStr,"*blue of#")){ digitalWrite(blue, HIGH); Serial.println("Blue OFF"); lcd.setCursor(8,1); lcd.print("OFF "); for(m=0;m<11;m++){ inStr[m]=0;} i=0;} if(!strcmp(inStr,"*green on#")){ digitalWrite(green, LOW); Serial.println("Green ON"); lcd.setCursor(12,1); lcd.print("ON "); for(m=0;m<11;m++){ inStr[m]=0;} i=0;} if(!strcmp(inStr,"*green of#")){ digitalWrite(green, HIGH); Serial.println("Green OFF"); lcd.setCursor(12,1); lcd.print("OFF "); for(m=0;m<11;m++){ inStr[m]=0;} i=0;} else{ for(m=0;m<11;m++){ inStr[m]=0; } i=0; }}
Implementation
Following video shows how we used android app which converts our voice into a speech signal and sends this signal to Arduino through Bluetooth module. This is a very easy to use with Arduino and this project can be made with little be an effort. Let us know if you face any issue while making this project.
Sir plzz email the project code plzz sir..
sir please send me project code voice app please sir urgent.
Sir can you tell me the proper code i could not understand where it start and where it ends