Control LED From Your Voice Command Using Arduino and HC-05 Bluetooth

What are you thinking about Controlling LED from your own voice command ?? When I heard about it I thought it would be very difficult project to controlling LED from Voice. If you are also feeling the same trust me it’s as easy as making cup of tea. So without wasting time let’s see How to Control LED from your Voice Command using Arduino and HC-05 Bluetooth module.

So to catch our voice command and process to Arduino board we need something right? To achieve this we have developed an Android App that is IoTBoys freely available on Google Play Store. So what does this IoTBoys App do ? Ok. The purpose of this application is to detect the voice command and pass through Serial Communication HC-05 to the Arduino Board. As we have written sketch below that will take care of all. Once you watch below video you will understand clearly.

Components you needed for Control LED From Your Voice Command Using Arduino and HC-05 Bluetooth:-

  1. Arduino Uno Board
  2. 1 x USB cable
  3. 1 x Bread Board
  4. 1 x Bluetooth (Module HC-05)
  5. 3 x LED (Red, Green, Blue)
  6. 4 x Jumper wire (Male to Male)
  7. 4 x Jumper wire (Male to Female)
  8. Android app IoTBoys Available in play store

Wiring Connection for Control LED From Your Voice Command Using Arduino and HC-05 Bluetooth:-

Note – You need to first unplug RX and TX connection from Arduino and then upload the below sketch else you may face uploading error.

Sketch/Source Code :-

String voice;
int RED = 2;
int GREEN = 3;
int BLUE = 4;
void RedOn(){
digitalWrite (RED, HIGH);
}
void RedOff(){
digitalWrite (RED, LOW);
}
void GreenOn(){
digitalWrite (GREEN, HIGH);
}
void GreenOff(){
digitalWrite (GREEN, LOW);
}
void BlueOn(){
digitalWrite (BLUE, HIGH);
}
void BlueOff(){
digitalWrite (BLUE, LOW);
}
void allon() {
digitalWrite (RED, HIGH);
digitalWrite (GREEN, HIGH);
digitalWrite (BLUE, HIGH);
}
void alloff() {
digitalWrite (RED, LOW);
digitalWrite (GREEN, LOW);
digitalWrite (BLUE, LOW);
}
void setup() {
Serial.begin(9600);
pinMode(RED, OUTPUT);
pinMode(GREEN, OUTPUT);
pinMode(BLUE, 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 == "on" || voice == "all")
{
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 =="green" || voice =="green on"){
GreenOn();
}
else if( voice =="green off" ){
GreenOff();
}
else if(voice =="blue" || voice =="blue on"){
BlueOn();
}
else if(voice =="blue off"){
BlueOff();
}
voice="";
}
}
Control LED From Your Voice Command Using Arduino and HC-05 Bluetooth

Home Automation Using Facebook Chat And Arduino ESP8266 WiFi Module

Voice Control Home Automation System Using Arduino and HC-05

How To Control Home Appliance From Internet Using Arduino and ESP8266

You may also like...

8 Responses

  1. loveth says:

    hello i am having issuses uploading to my elegoo UNO R3 board.
    this is the error message
    Arduino: 1.8.3 (Windows 10), Board: “Arduino/Genuino Uno”

    Sketch uses 3836 bytes (11%) of program storage space. Maximum is 32256 bytes.
    Global variables use 282 bytes (13%) of dynamic memory, leaving 1766 bytes for local variables. Maximum is 2048 bytes.
    avrdude: ser_open(): can’t open device “\\.\COM1”: The system cannot find the file specified.

    Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

    This report would have more information with
    “Show verbose output during compilation”
    option enabled in File -> Preferences.

  2. memoll says:

    hi
    when i click on upload after some minutes this massage appear: what do u suggest?
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x54
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x54
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x54
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x54
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x54
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x54
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x54
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x54
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x54
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x54
    Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

  3. Sunil says:

    Control LED From Your Voice Command Using Arduino and HC-05 Bluetooth,how to turn off wall led even I say off it not recognising
    Explain me code and how off wall led at one time

  4. Rosina10 says:

    my problem is that the phone does not connect to the bluetooth, answer immediately, please urgently!thanks

Leave a Reply

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