Voice Control Home Automation

SaumyaTiwari6 3,898 views 14 slides Dec 16, 2017
Slide 1
Slide 1 of 14
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14

About This Presentation

This project is called ‘Voice Controlled Home Automation project using Arduino’
which enables a user to control the home appliances through voice commands sent to
an Android app i.e AMR voice app.


Slide Content

 
MBSD​ ​Project 
Voice​ ​Control​ ​Home​ ​Automation 
December​ ​04,​ ​2017 
By:​ ​Arushi​ ​Chaudhry,​ ​Saumya​ ​Tiwari,​ ​Sonam​ ​Yadav 
Overview 
In​ ​today’s​ ​modern​ ​technology​ ​world,​ ​where​ ​almost​ ​all​ ​the​ ​electronic​ ​devices​ ​or 
appliances​ ​can​ ​be​ ​remotely​ ​controlled,​ ​our​ ​​ ​new​ ​project​ ​which​ ​would​ ​help​ ​an 
individual​ ​to​ ​control​ ​the​ ​lights,​ ​fans​ ​etc.​ ​by​ ​just​ ​talking​ ​to​ ​them​ ​and​ ​will​ ​be​ ​a​ ​boon​ ​for 
physically​ ​challenged​ ​and​ ​disabled​ ​people. 
This​ ​project​ ​is​ ​called​ ​‘Voice​ ​Controlled​ ​Home​ ​Automation​ ​project​ ​using​ ​Arduino’ 
which​ ​enables​ ​a​ ​user​ ​to​ ​control​ ​the​ ​home​ ​appliances​ ​through​ ​voice​ ​commands​ ​sent​ ​to 
an​ ​Android​ ​app. 
What​ ​is​ ​Home​ ​Automation? 
Home​ ​automation​​ ​or​ ​​domotics​
​ ​​
is​ ​building​ ​automation​ ​for​ ​a​ ​home,​ ​called​ ​a​ ​​smart 
home​​ ​or​ ​​smart​ ​house​.​ ​It​ ​involves​ ​the​ ​control​ ​and​ ​automation​ ​of​ ​lighting,​ ​heating​ ​(such 
as​ ​smart​ ​thermostats),​ ​ventilation,​ ​air​ ​conditioning​ ​(HVAC),​ ​and​ ​security,​ ​as​ ​well​ ​as 
home​ ​appliances​ ​such​ ​as​ ​washer/dryers,​ ​ovens​ ​or​ ​refrigerators/freezers.​ ​Wi-Fi​ ​is​ ​often 
used​ ​for​ ​remote​ ​monitoring​ ​and​ ​control.​ ​Home​ ​devices,​ ​when​ ​remotely​ ​monitored​ ​and 
controlled​ ​via​ ​the​ ​Internet,​ ​are​ ​an​ ​important​ ​constituent​ ​of​ ​the​ ​Internet​ ​of​ ​Things. 
Modern​ ​systems​ ​generally​ ​consist​ ​of​ ​switches​ ​and​ ​sensors​ ​connected​ ​to​ ​a​ ​central​ ​hub 
sometimes​ ​called​ ​a​ ​"gateway"​ ​from​ ​which​ ​the​ ​system​ ​is​ ​controlled​ ​with​ ​a​ ​user​ ​interface 
 
 
 

2  
that​ ​is​ ​interacted​ ​either​ ​with​ ​a​ ​wall-mounted​ ​terminal,​ ​mobile​ ​phone​ ​software, 
tablet​ ​computer​ ​or​ ​a​ ​web​ ​interface,​ ​often​ ​but​ ​not​ ​always​ ​via​ ​Internet​ ​cloud​ ​services. 
Goals​ ​: 
1.​ ​Home​ ​automation​ ​using​ ​voice​ ​control​ ​can​ ​help​ ​disabled​ ​persons​ ​use​ ​appliances​ ​with 
ease. 
2.​ ​The​ ​Internet​ ​is​ ​not​ ​required​ ​for​ ​using​ ​this​ ​project. 
3.​ ​Multiple​ ​devices/appliances​ ​can​ ​be​ ​controlled​ ​using​ ​one​ ​Android​ ​device. 
Specifications: 
The​ ​components​ ​that​ ​are​ ​used​ ​in​ ​the​ ​Home​ ​Automation​ ​using​ ​voice​ ​control​ ​project​ ​are 
a.​ ​Device​ ​Control​ ​app​ ​installed​ ​on​ ​an​ ​Android​ ​smartphone. 
b.​ ​A​ ​Bluetooth​ ​(HC-05)​ ​receiver​ ​unit,​ ​which​ ​is​ ​used​ ​to​ ​connect​ ​the​ ​devices​ ​to​ ​the 
Android​ ​mobile. 
c.​ ​A​ ​Microcontroller​ ​–​ ​Arduino​ ​Uno.​ ​However,​ ​other​ ​microcontrollers​ ​like​ ​89s51,​ ​89c51, 
89s52,​ ​89v51RD2,​ ​PIC18F4550,​ ​AVR​ ​ATmega32​ ​can​ ​also​ ​be​ ​used. 
d.​ ​​ ​Relay. 
f.​ ​Electrical​ ​appliances​ ​–​ ​Any​ ​home​ ​appliance.​ ​For​ ​demonstration​ ​two​ ​DC​ ​devices​ ​to 
the​ ​2​ ​relays​ ​(LED​ ​bulb​ ​and​ ​one​ ​servo​ ​motor​ ​)​ ​are​ ​connected.​ ​And​ ​3​ ​out​ ​of​ ​5​ ​relays​ ​are 
kept​ ​open​ ​that​ ​can​ ​be​ ​used​ ​to​ ​connect​ ​additional​ ​devices. 
  
 
 

3  
Components​ ​Used: 
●Arduino​ ​Board 
●Bluetooth​ ​Module 
●Relay 
●Breadboard 
●Bulb 
●Jumper​ ​Wire 
 
Bluetooth​ ​Module: 
HC-05 
HC‐05​ ​module​​ ​is​ ​an​ ​easy​ ​to​ ​use​ ​​Bluetooth​ ​SPP​ ​(Serial​ ​Port​ ​Protocol) 
module​,designed​ ​for​ ​transparent​ ​wireless​ ​serial​ ​connection​ ​setup. 
The​ ​Bluetooth​ ​module​ ​HC-05​ ​is​ ​a​ ​MASTER/SLAVE​ ​module.By​ ​default​ ​the​ ​factory 
setting​ ​is​ ​SLAVE.The​ ​Role​ ​of​ ​the​ ​module​ ​(Master​ ​or​ ​Slave)​ ​can​ ​be​ ​configured​ ​only​ ​by 
AT​ ​COMMANDS.The​ ​slave​ ​modules​ ​cannot​ ​initiate​ ​a​ ​connection​ ​to​ ​another​ ​Bluetooth 
device,​ ​but​ ​can​ ​accept​ ​connections.Master​ ​module​ ​can​ ​initiate​ ​a​ ​connection​ ​to​ ​other 
devices.The​ ​user​ ​can​ ​use​ ​it​ ​simply​ ​for​ ​a​ ​serial​ ​port​ ​replacement​ ​to​ ​establish 
connection​ ​between​ ​MCU​ ​and​ ​GPS,​ ​PC​ ​to​ ​your​ ​embedded​ ​project,​ ​etc. 
2​ ​Relay​ ​Module: 
The​ ​relay​ ​is​ ​actually​ ​a​ ​switch​ ​alike​ ​component​ ​just​ ​the​ ​difference​ ​is​ ​the​ ​way​ ​of 
triggering​ ​is​ ​through​ ​the​ ​magnetic​ ​field​ ​that​ ​will​ ​change​ ​the​ ​contact​ ​and​ ​thus 
activating​ ​a​ ​switch. 
This​ ​is​ ​a​ ​5V,​ ​10A​ ​2-Channel​ ​Relay​ ​interface​ ​board.​ ​It​ ​can​ ​be​ ​used​ ​to​ ​control​ ​various 
  
 
 

4  
appliances,​ ​and​ ​other​ ​equipments​ ​with​ ​large​ ​current.​ ​It​ ​can​ ​be​ ​controlled​ ​directly 
with​ ​3.3V​ ​or​ ​5V​ ​logic​ ​signals​ ​from​ ​a​ ​microcontroller​ ​(Arduino,​ ​8051,​ ​AVR,​ ​PIC,​ ​DSP, 
ARM,​ ​ARM,​ ​MSP430,​ ​TTL​ ​logic). 
 
Block​ ​Diagram: 
 
 
 
  
 
 

5  
 
Voice​ ​Recognition​ ​Concept 
 
●The​ ​way​ ​of​ ​this​ ​concept​ ​function​ ​is​ ​when​ ​a​ ​user​ ​speaks​ ​out​ ​some​ ​command, 
then​ ​the​ ​voice​ ​is​ ​captured​ ​through​ ​microphone​ ​as​ ​the​ ​input​ ​devices.  
●Once​ ​the​ ​voice​ ​is​ ​captured,​ ​the​ ​usage​ ​of​ ​a​ ​decoding​ ​system​ ​that​ ​will​ ​convert​ ​the 
analog​ ​(voice)​ ​to​ ​digital​ ​(binary​ ​signal).  
●Later,​ ​the​ ​input​ ​voice​ ​is​ ​compared​ ​with​ ​the​ ​data​ ​stored​ ​in​ ​the​ ​memory​ ​early 
before​ ​the​ ​testing.  
●The​ ​output​ ​of​ ​the​ ​comparison​ ​is​ ​the​ ​voice​ ​matched​ ​with​ ​any​ ​of​ ​the​ ​command 
trained​ ​and​ ​certain​ ​signal​ ​is​ ​produced​ ​as​ ​the​ ​input​ ​for​ ​the​ ​controlling​ ​system. 
 
Working​ ​Procedure: 
 
The​ ​home​ ​automation​ ​circuit​ ​is​ ​built​ ​around​ ​an​ ​Arduino​ ​Uno​ ​board,​ ​Bluetooth​ ​module 
HC-05​ ​and​ ​a​ ​2-channel​ ​relay​ ​board.​ ​The​ ​number​ ​of​ ​channels​ ​depends​ ​on​ ​the​ ​number 
of​ ​appliances​ ​you​ ​wish​ ​to​ ​control.​ ​Arduino​ ​Uno​ ​is​ ​powered​ ​with​ ​a​ ​12V​ ​DC 
adaptor/power​ ​source.​ ​The​ ​relay​ ​module​ ​and​ ​Bluetooth​ ​module​ ​can​ ​be,​ ​in​ ​turn, 
  
 
 

6  
powered​ ​using​ ​a​ ​board​ ​power​ ​supply​ ​of​ ​Arduino​ ​Uno.  
In​ ​this​ ​home​ ​automation​ ​project​ ​circuit,​ ​Pins​ ​0​ ​and​ ​1​ ​of​ ​Arduino​ ​are​ ​connected​ ​to​ ​pins 
TXD​ ​and​ ​RXD​ ​of​ ​the​ ​Bluetooth​ ​module,​ ​respectively.​ ​Pins​ ​Gnd​ ​and​ ​Vcc​ ​of​ ​the​ ​Bluetooth 
module​ ​are​ ​connected​ ​to​ ​Gnd​ ​and​ ​+5V​ ​of​ ​Arduino​ ​board​ ​respectively.​ ​Pins​ ​2​ ​,3​ ​and​ ​5 
are​ ​connected​ ​to​ ​the​ ​one​ ​relay​ ​(RL1)​ ​and​ ​two​ ​LED​ ​lights.​ ​Pins​ ​Vin​ ​and​ ​Gnd​ ​of​ ​the​ ​relay 
board​ ​are​ ​connected​ ​to​ ​pins​ ​Vin​ ​and​ ​Gnd​ ​of​ ​Arduino​ ​board,​ ​respectively. 
 
 
  
 
 

7  
Application​ ​and​ ​Advantages: 
 
●Turning​ ​lights​ ​down​ ​/​ ​off​ ​at​ ​night.  
●Operating​ ​outside​ ​lights  
●Turning​ ​lights​ ​or​ ​radio​ ​on​ ​/​ ​off​ ​when​ ​someone​ ​approaches​ ​the​ ​house, 
simulating​ ​occupancy  
●Operating​ ​television,​ ​hot​ ​water​ ​heater,​ ​kettle,​ ​toaster​ ​etc.​ ​ready​ ​for​ ​your​ ​use.  
●Optimizing​ ​use​ ​of​ ​low​ ​cost​ ​electricity.​ ​​ ​Working​ ​with​ ​intelligent​ ​electrical​ ​white 
goods​ ​e.g.​ ​washing​ ​machine,​ ​fridge,​ ​microwave​ ​etc. 
●Flexibility​ ​&​ ​Convenience  
●Security  
●Cost​ ​Saving​ ​and​ ​​ ​Remote​ ​Control 
●The​ ​main​ ​advantage​ ​of​ ​​Home​ ​Automation​ ​through​ ​Android​ ​Mobile​​ ​is​ ​that​ ​the 
Physically​ ​Challenged​ ​and​ ​Disabled​ ​People. 
Results​ ​and​ ​Conclusion: 
●The​ ​main​ ​aim​ ​of​ ​the​ ​project​ ​was​ ​to​ ​design​ ​a​ ​system​ ​in​ ​such​ ​a​ ​way​ ​that​ ​it​ ​can 
yield​ ​maximum​ ​output​ ​with​ ​minimum​ ​complexity​ ​and​ ​this​ ​home​ ​automation 
system​ ​successfully​ ​delivered​ ​it.  
●There​ ​are​ ​some​ ​issue​ ​that​ ​arises​ ​when​ ​using​ ​this​ ​system.​ ​The​ ​problems​ ​are​ ​the 
pronunciation​ ​of​ ​the​ ​user​ ​when​ ​doing​ ​the​ ​process.  
●For​ ​the​ ​pronunciation​ ​matter,​ ​the​ ​system​ ​takes​ ​it​ ​at​ ​a​ ​quite​ ​high​ ​level​ ​of 
sensitivity.  
●So​ ​when​ ​the​ ​user​ ​wishes​ ​to​ ​use​ ​the​ ​system,​ ​thus​ ​he​ ​or​ ​she​ ​must​ ​produce​ ​the 
word​ ​with​ ​the​ ​correct​ ​pronunciation​ ​as​ ​in​ ​the​ ​training​ ​process. 
 
 
 
 
  
 
 

8  
CODE: 
String​ ​voice;
int
led1​ ​=​ ​2,​ ​//Connect​ ​LED​ ​1​ ​To​ ​Pin​ ​#2
led2​ ​=​ ​3,​ ​//Connect​ ​LED​ ​2​ ​To​ ​Pin​ ​#3
led3​ ​=​ ​4,​ ​//Connect​ ​LED​ ​3​ ​To​ ​Pin​ ​#4
led4​ ​=​ ​5,​ ​//Connect​ ​LED​ ​4​ ​To​ ​Pin​ ​#5
led5​ ​=​ ​6;​ ​//Connect​ ​LED​ ​5​ ​To​ ​Pin​ ​#6
//--------------------------Call​ ​A​ ​Function-------------------------------//
void​ ​allon()​ ​{
​ ​​ ​digitalWrite(led1,​ ​HIGH);
​ ​​ ​digitalWrite(led2,​ ​HIGH);
​ ​​ ​digitalWrite(led3,​ ​HIGH);
​ ​​ ​digitalWrite(led4,​ ​LOW);
​ ​​ ​digitalWrite(led5,​ ​HIGH);
  
 
 

9  
}
void​ ​alloff()​ ​{
​ ​​ ​digitalWrite(led1,​ ​LOW);
​ ​​ ​digitalWrite(led2,​ ​LOW);
​ ​​ ​digitalWrite(led3,​ ​LOW);
​ ​​ ​digitalWrite(led4,​ ​HIGH);
​ ​​ ​digitalWrite(led5,​ ​LOW);
}
//-----------------------------------------------------------------------//
void​ ​setup()​ ​{
​ ​​ ​Serial.begin(9600);
​ ​​ ​pinMode(led1,​ ​OUTPUT);
​ ​​ ​pinMode(led2,​ ​OUTPUT);
​ ​​ ​pinMode(led3,​ ​OUTPUT);
​ ​​ ​pinMode(led4,​ ​OUTPUT);
​ ​​ ​digitalWrite(led4,​ ​HIGH);
  
 
 

10  
​ ​​ ​pinMode(led5,​ ​OUTPUT);
}

//-----------------------------------------------------------------------//
void​ ​loop()​ ​{
​ ​​ ​int​ ​a​ ​=​ ​analogRead(0);
​ ​​ ​Serial.println(a);
​ ​​ ​if​ ​(a​ ​>​ ​10)
​ ​​ ​{
​ ​​ ​​ ​​ ​//Serial.println("Saumya​ ​Rocks");
​ ​​ ​​ ​​ ​Serial.println("Alert");
​ ​​ ​}
​ ​​ ​while​ ​(Serial.available())​ ​{​ ​//Check​ ​if​ ​there​ ​is​ ​an​ ​available​ ​byte​ ​to​ ​read
​ ​​ ​​ ​​ ​delay(10);​ ​//Delay​ ​added​ ​to​ ​make​ ​thing​ ​stable
​ ​​ ​​ ​​ ​char​ ​c​ ​=​ ​Serial.read();​ ​//Conduct​ ​a​ ​serial​ ​read
​ ​​ ​​ ​​ ​if​ ​(c​ ​==​ ​'#')​ ​{
  
 
 

11  
​ ​​ ​​ ​​ ​​ ​​ ​break;​ ​//Exit​ ​the​ ​loop​ ​when​ ​the​ ​#​ ​is​ ​detected​ ​after​ ​the​ ​word
​ ​​ ​​ ​​ ​}
​ ​​ ​​ ​​ ​voice​ ​+=​ ​c;​ ​//Shorthand​ ​for​ ​voice​ ​=​ ​voice​ ​+​ ​c
​ ​​ ​}
​ ​​ ​if​ ​(voice.length()​ ​>​ ​0)​ ​{
​ ​​ ​​ ​​ ​Serial.println(voice);
​ ​​ ​​ ​​ ​//-----------------------------------------------------------------------//
​ ​​ ​​ ​​ ​//----------Control​ ​Multiple​ ​Pins/​ ​LEDs----------//
​ ​​ ​​ ​​ ​if​ ​(voice​ ​==​ ​"*all​ ​on")​ ​{
​ ​​ ​​ ​​ ​​ ​​ ​allon();​ ​//Turn​ ​Off​ ​All​ ​Pins​ ​(Call​ ​Function)
​ ​​ ​​ ​​ ​}
​ ​​ ​​ ​​ ​else​ ​if​ ​(voice​ ​==​ ​"*all​ ​off"​ ​||​ ​voice​ ​==​ ​"*all​ ​of")​ ​{
​ ​​ ​​ ​​ ​​ ​​ ​alloff();​ ​//Turn​ ​On​ ​​ ​All​ ​Pins​ ​(Call​ ​Function)
​ ​​ ​​ ​​ ​}

​ ​​ ​​ ​​ ​//----------Turn​ ​On​ ​One-By-One----------//
  
 
 

12  
​ ​​ ​​ ​​ ​else​ ​if​ ​(voice​ ​==​ ​"*TV​ ​on")​ ​{
​ ​​ ​​ ​​ ​​ ​​ ​digitalWrite(led1,​ ​HIGH);
​ ​​ ​​ ​​ ​}
​ ​​ ​​ ​​ ​else​ ​if​ ​(voice​ ​==​ ​"*fan​ ​on")​ ​{
​ ​​ ​​ ​​ ​​ ​​ ​digitalWrite(led2,​ ​HIGH);
​ ​​ ​​ ​​ ​}
​ ​​ ​​ ​​ ​else​ ​if​ ​(voice​ ​==​ ​"*computer​ ​on")​ ​{
​ ​​ ​​ ​​ ​​ ​​ ​digitalWrite(led3,​ ​HIGH);
​ ​​ ​​ ​​ ​}
​ ​​ ​​ ​​ ​else​ ​if​ ​(voice​ ​==​ ​"*bedroom​ ​lights​ ​on"​ ​||voice​ ​==​ ​"*bedroom​ ​light​ ​on"​ ​)​ ​{
​ ​​ ​​ ​​ ​​ ​​ ​digitalWrite(led4,​ ​LOW);
​ ​​ ​​ ​​ ​}
​ ​​ ​​ ​​ ​else​ ​if​ ​(voice​ ​==​ ​"*bathroom​ ​lights​ ​on")​ ​{
​ ​​ ​​ ​​ ​​ ​​ ​digitalWrite(led5,​ ​HIGH);
​ ​​ ​​ ​​ ​}
​ ​​ ​​ ​​ ​//----------Turn​ ​Off​ ​One-By-One----------//
  
 
 

13  
​ ​​ ​​ ​​ ​else​ ​if​ ​(voice​ ​==​ ​"*TV​ ​off"​ ​||​ ​voice​ ​==​ ​"*TV​ ​of")​ ​{
​ ​​ ​​ ​​ ​​ ​​ ​digitalWrite(led1,​ ​LOW);
​ ​​ ​​ ​​ ​}
​ ​​ ​​ ​​ ​else​ ​if​ ​(voice​ ​==​ ​"*fan​ ​off"​ ​||​ ​voice​ ​==​ ​"*fan​ ​of")​ ​{
​ ​​ ​​ ​​ ​​ ​​ ​digitalWrite(led2,​ ​LOW);
​ ​​ ​​ ​​ ​}
​ ​​ ​​ ​​ ​else​ ​if​ ​(voice​ ​==​ ​"*computer​ ​off"​ ​||​ ​voice​ ​==​ ​"*computer​ ​of")​ ​{
​ ​​ ​​ ​​ ​​ ​​ ​digitalWrite(led3,​ ​LOW);
​ ​​ ​​ ​​ ​}
​ ​​ ​​ ​​ ​else​ ​if​ ​(voice​ ​==​ ​"*bedroom​ ​lights​ ​off"​ ​||​ ​voice​ ​==​ ​"*bedroom​ ​lights​ ​of"​ ​||voice​ ​==
"*bedroom​ ​light​ ​off"​ ​||​ ​voice​ ​==​ ​"*bedroom​ ​light​ ​of"​ ​)​ ​{
​ ​​ ​​ ​​ ​​ ​​ ​digitalWrite(led4,​ ​HIGH);
​ ​​ ​​ ​​ ​}
​ ​​ ​​ ​​ ​else​ ​if​ ​(voice​ ​==​ ​"*bathroom​ ​lights​ ​off"​ ​||​ ​voice​ ​==​ ​"*bathroom​ ​lights​ ​of")​ ​{
​ ​​ ​​ ​​ ​​ ​​ ​digitalWrite(led5,​ ​LOW);
​ ​​ ​​ ​​ ​}
  
 
 

14  

​ ​​ ​​ ​​ ​//-----------------------------------------------------------------------//
​ ​​ ​​ ​​ ​voice​ ​=​ ​"";
​ ​​ ​}
}​ ​//Reset​ ​the​ ​variable​ ​after​ ​initiating