Voice Activated Home Automation

Description

        The concept of Home Automation is gaining popularity as it helps in reducing human effort and errors and thus increasing the efficiency. With the help of Home Automation system, we can control different appliances like lights, fans, TV, AC etc. Additionally, a home automation system can also provide other features like security, alarms, emergency systems etc. can be integrated. The Voice Activated Home Automation project is implemented using Arduino UNO, Bluetooth and a smart phone. Okey, let's see how it works.
      
Components Required

 1. Arduino UNO   * 1
 2.  Bluetooth Module(HC-05)   * 1
 3.  Smartphone   * 1
 4. AC Bulbs  * 2
 5. 4 Channel Relay(12V)  * 1
 9. Jumper Wires  * 1
 10. Bread Board  * 1
 11. App for transmitting voice to 
 bluetooth
 

Circuit Diagram












Program

String voice;
int RED = 2;
int YELLOW = 3;
void RedOn(){
digitalWrite (RED, LOW);
}
void RedOff(){
digitalWrite (RED, HIGH);
}
void YellowOn(){
digitalWrite (YELLOW, LOW);
}
void YellowOff(){
digitalWrite (YELLOW, HIGH);
}
void allon() {
digitalWrite (RED, LOW);
digitalWrite (YELLOW, LOW);
}
void alloff() {
digitalWrite (RED, HIGH);
digitalWrite (YELLOW, HIGH);
}
void setup() {
Serial.begin(9600);
pinMode(RED, OUTPUT);
pinMode(YELLOW, OUTPUT);
digitalWrite (RED, HIGH);
digitalWrite (YELLOW, HIGH);
}
void loop() {
while(Serial.available()) {
delay(10);
char c=Serial.read();
if(c=='#')
{
break; 
}
voice += c;
}
if (voice.length() > 0) {
Serial.println(voice);
if (voice == "on" || voice== "all on")
{
allon() ;
}
else if (voice == "off" || voice=="all off")
{
alloff() ;
}
else if(voice =="red" || voice =="red on"){
RedOn();
}
else if(voice =="red off"){
RedOff();
}
else if(voice =="yellow" || voice =="yellow on"){
YellowOn();
}
else if(voice =="yellow off"){
YellowOff();
}
voice="";
}
}