Voice Control Home Automation System Using Arduino and HC-05

In this article we are showing voice control home automation system to control appliances with own voice command an Android app IoTBoys. An Arduino Uno board is used for controlling the relay through which an appliance is getting switch on/off.

 

Components you needed :-

  1. 1 x Arduino uno
  2. 1 x Relay board
  3. 2 X AC Bulb (red, yellow)
  4. 1 x Bluetooth module (HC-05)
  5. 1 x USB cable
  6. 1 x breadboard
  7. 8 x jumper wire (male to female)
  8. 2 x jumper wire (male to female)
  9. 1 x Android app IoTBoys available on google play store

Connection :-

Sketch/Source Code :-

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="";
}
}

Share on facebook
Share on twitter
Share on linkedin
Share on pinterest
Share on whatsapp
Share on telegram
Share on reddit
Share on tumblr
Related Posts
About Author

Leave a Comment

Your email address will not be published. Required fields are marked *