Arduino Projects-Voice Control for Everything

Want to control your household Appliances or Projects with Voice?Then the answer is yes, this can be done just by using your Smartphone, Arduino and a Bluetooth Module without using any voice recognition Module costing Hundreds of Dollars.The working is very simple, we use a smartphone application that used google voice recognition to recognize our voice and sends it over a Bluetooth connection in a text format to the Arduino.This text format is then Processed to perform a task which we will write in our Arduino Sketch.We can use it to turn on Relay’s for home automation, control the movements of a robot etc.So let’s get started!!

Things you need:

  •  Arduino
  •  Bluetooth Module(HC-05/06)
  •  LED’s(For example in this tutorial)
  •  Smartphone
  •  Wires
  •  Breadboard

Arduino Voice Control Code

This code is much simpler and use’s some basic C language.To process a command first we need to get the command from Bluetooth module then store it in a string named voice and compare the string with our commands written in the code.The code runs a Loop() which again consists of a while loop which checks if there is any serial data available to be read, if available the data will be stored in a string named voice character by character till “#” is found, as # is used by the smartphone application to indicate end of statement.After the data is stored in a string, this string is checked with IF and Else to see if there is any command matching with it.when the command is found, respective function for the command is executed, if not found then the whole process starts again.

For eg-  When you speak a command on your smartphone application “Turn on all LED”.The command is sent to Bluetooth module as”Turn on all LED#”.Arduino reads it till # and stores it in a                    string(voice=”Turn on all LED”).This string is then checked with the available commands in the code, and the respective function for the command is executed.

You can modify the code as per your needs and change the commands.

#include <SoftwareSerial.h>

SoftwareSerial BLU(0,1);

String voice;

int Blue   = 2;  //Connect To Pin #2 

int Green  = 3;  //Connect To Pin #3 

int Yellow = 4;  //Connect To Pin #4 

int Red    = 5;  //Connect To Pin #5 

void allon()
  digitalWrite(Red, HIGH); 
  digitalWrite(Yellow, HIGH); 
  digitalWrite(Green, HIGH); 
  digitalWrite(Blue, HIGH); 


void alloff()
  digitalWrite(Red, LOW); 
  digitalWrite(Yellow, LOW); 
  digitalWrite(Green, LOW); 
  digitalWrite(Blue, LOW); 

void setup() 
  pinMode(Red, OUTPUT); 
  pinMode(Yellow, OUTPUT); 
  pinMode(Green, OUTPUT); 
  pinMode(Blue, OUTPUT); 

void loop() 
  while (Serial.available())     //Check if there is an available byte to read
    delay(10);                   //Delay added to make thing stable 
    char c =;      //Conduct a serial read
    if (c == '#') 
      break;                     //Exit the loop when the # is detected after the word
    voice += c; 
  if (voice.length() > 0) 
    if(voice == "*turn on all LED") 
    else if(voice == "*turn off all LED")
    else if(voice == "*switch on red") 
    else if(voice == "*switch on yellow") 
    else if(voice == "*switch on green") 
    else if(voice == "*switch on blue") 

     else if(voice == "*switch off red") 
    else if(voice == "*switch off yellow") 
    else if(voice == "*switch off green") 
    else if(voice == "*switch off blue") 

    voice="";            //Reset variable


Wiring up the Circuit

For explanation purpose I will be using four Led’s, You can connect anything you want to control eg-Relays, transistors etc.

I will be using 2,3,4 and 5 pins of Arduino as output pins for my Blue, Green, Yellow and Red LEDs with a resistor in series to limit the current.Now connect the Bluetooth Module to Arduino.

Bluetooth Module>>Arduino





Arduino Voice Control
Arduino Voice Control

Setting up your Smartphone

        Download the below application and Install it.After installing connect the Application to your Bluetooth Module while your whole circuit is powered on.(Password for HC-05 is 1234)


        After the connection is established tap on the mic button and speak your command.For eg-“Turn on Red Led”.The red Led turns on.

Watch my Youtube video on this Subject

2 thoughts on “Arduino Projects-Voice Control for Everything

  1. Hi,
    I wrote a sketch to make a servo turn right and left using Bluetooth and audrino but it’s not working. Can I send the you the sketch and see if you can help me with the codes please.


Leave a Reply

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

Show Buttons
Hide Buttons