Introduction: Voice Activated Home Automation
I was thinking about writing an instructable, since last year though i read instructable daily on instructables.com. So, here is my first attempt i hope that you all appreciate my efforts. I am a B.Tech final year student of ECE department.
It's a project based on the day to day need of people. Using this system, anyone can control four appliances through human voice from a mobile. It's a very affordable home automation system.
Step 1: Component Used
Here is the list of all the components which we need:-
Hardware:-
1. Arduino Uno.
2. 5V Four channel Relay Module.
3. 16*2 LCD display.
4. Bluetooth module(HC-05).
5. Breadboard.
6. USB cable for Arduino Uno.
7. Connecting wires.
Software:-
Arduino IDE.
Android Application:-
BT Voice Control for Arduino by SimpleLabsIN.
Step 2: Interfacing/Assembling of Components
LCD Connections
RS --> digital pin 7
Enable --> digital pin 6
d4 --> digital pin 5
d5 --> digital pin 4
d6 --> digital pin 3
d7 --> digital pin 2
Bluetooth Connections
TxD --> digital pin 0
RxD --> digital pin 1
Vcc --> 5V
Gnd --> Gnd
Relay Connections
In1 --> digital pin 10
In2 --> digital pin 11
In3 --> digital pin 12
In4 --> digital pin 13
Vcc --> 5V
Gnd --> Gnd
Step 3: The Code
#include<SoftwareSerial.h>
#include<LiquidCrystal.h>
const int rxPin = 0;
const int txPin = 1;
SoftwareSerial mySerial(rxPin, txPin);
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
int light=10;
int fan=11;
int tv=12;
int ac=13;
String data;
void setup()
{
Serial.begin(9600);
mySerial.begin(9600);
pinMode(light, OUTPUT);
pinMode(fan, OUTPUT);
pinMode(tv, OUTPUT);
pinMode(ac, OUTPUT);
digitalWrite(light, LOW);
digitalWrite(fan, LOW);
digitalWrite(tv, LOW);
digitalWrite(ac, LOW);
Serial.begin(9600);
lcd.begin(16, 2);
lcd.print("VOICE ACTIVATED");
lcd.setCursor(0,1);
lcd.print("HOME AUTOMATION");
}
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 light")
{
digitalWrite(light,HIGH);
Serial.println("light on");
lcd.clear();
lcd.print(" **LIGHT ON**");
}
else if(data=="*turn off light")
{
digitalWrite(light,LOW);
Serial.println("light off");
lcd.clear(); lcd.print(" **LIGHT OFF**");
}
else if(data=="*turn on fan")
{
digitalWrite(fan,HIGH);
Serial.println("fan on");
lcd.clear();
lcd.print(" **FAN ON**");
}
else if(data=="*turn off fan")
{
digitalWrite(fan,LOW);
Serial.println("fan off");
lcd.clear();
lcd.print(" **FAN OFF**");
}
else if(data=="*turn on TV")
{
digitalWrite(tv,HIGH);
Serial.println("tv on");
lcd.clear();
lcd.print(" **TV ON**");
}
else if(data=="*turn off TV")
{
digitalWrite(tv,LOW);
Serial.println("tv off");
lcd.clear();
lcd.print(" **TV OFF**");
}
else if(data=="*turn on AC")
{
digitalWrite(ac,HIGH);
Serial.println("ac on");
lcd.clear();
lcd.print(" **AC ON**");
}
else if(data=="*turn off AC")
{
digitalWrite(ac,LOW);
Serial.println("ac off");
lcd.clear();
lcd.print(" **AC OFF**");
}
else if(data=="*turn on all")
{
digitalWrite(ac,HIGH);
digitalWrite(light,HIGH);
digitalWrite(fan,HIGH);
digitalWrite(tv,HIGH);
Serial.println("all on");
lcd.clear();
lcd.print(" **ALL ON**");
}
else if(data=="*turn off all")
{
digitalWrite(ac,LOW);
digitalWrite(light,LOW);
digitalWrite(fan,LOW);
digitalWrite(tv,LOW);
Serial.println("all off");
lcd.clear();
lcd.print(" **ALL OFF**");
}
}
Attachments
Step 4: Final Setup
So, Here is the final setup i have made hope you all like it.