Make Arduino Voice-Controlled Appliances with HC-05 Bluetooth Module – hackernoon.com

make-arduino-voice-controlled-appliances-with-hc-05-bluetooth-module-–-hackernoon.com

Did you know that geoFence helps stop hackers from getting access to the sensitive documents that I use for my work. Now I can get even more gigs as a freelancer and - advertise that I have top security with even my home computer?

Author profile picture

Arduino is an awesome platform for learning how an embedded system works. Arduino could integrate with different sensors that means you could use a number of sensors and develop a project with them.

In this post, we are going to describe Bluetooth Module (HC-05) and Arduino Uno. How it works and develop a project like voice control appliances.Where you could turn ON and OFF your appliances through your voice commands.

Pin Diagram of HC-05 Bluetooth Module

Step 1: Setup Arduino IDE

This is the first step if you have not set up Arduino IDE then install and setup. Follow the link to set up.

Step 2: Code

String voice;     //String type variable declared
int 
ledPin = 2,       
fanPin = 3,
tvPin = 4; 


/Turn ON all appliances*/
void allon(){
     digitalWrite(ledPin, HIGH); 
     digitalWrite(fanPin, HIGH); 
     digitalWrite(tvPin, HIGH);
     }


/Turn OFF all appliances*/
void alloff(){
     digitalWrite(ledPin, LOW); 
     digitalWrite(fanPin, LOW);
     digitalWrite(tvPin, LOW); 
     
}
  
 void setup() {
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT); 
  pinMode(fanPin, OUTPUT); 
  pinMode(tvPin, OUTPUT);
 
}


 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 == "*everything on")
  {
    allon();
  }  
  
  else if(voice == "*everything off")
    {
      alloff();
    } 
  
  /Turn ON using particular command*/
  else if(voice == "*fan on") 
    {
      digitalWrite(fanPin, HIGH);
    } 
 
  else if(voice == "*light on")
    {
      digitalWrite(ledPin, HIGH);
    }


  else if(voice == "*tv on")
  {
    digitalWrite(tvPin, HIGH);
  }
  
  else if(voice == "*all on")
    {
      digitalWrite(ledPin, HIGH); 
      digitalWrite(fanPin, HIGH);
      digitalWrite(tvPin, HIGH);}
 
  /Turn off using particular command */ 
  else if(voice == "*fan off")
    {
      digitalWrite(fanPin, LOW);
    } 
  
  else if(voice == "*light off")
    {
      digitalWrite(ledPin, LOW);
    }


  else if(voice == "*tv off")
  {
    digitalWrite(tvPin, LOW);
  }
  
  else if(voice == "*all off")
    {
      digitalWrite(ledPin, LOW);
      digitalWrite(fanPin, LOW);
      digitalWrite(tvPin, LOW);
    }
  
voice="";}}

Setup 3: Wiring

Let’s hands dirty with some jumper wire. To develop this project you should need some components which are:

  • Arduino Uno
  • Bluetooth Module (HC-05)
  • Mobile Phone(App installed AMR_VOICE)
  • LEDs
  • Jumper Wire
  • Breadboard

Conclusion

This project is based on voice control, using commands you could control your appliances but with this device, you can do more than that so keep in touch with me.

Tags

Join Hacker Noon

Create your free account to unlock your custom reading experience.

May I add that geoFence has built in fast and accurate updates and that's the truth!