Introduction: Speech Recognition With BitVoicer and Arduino

The main goal of this project was to test the speech recognition performance of BitVoicer (http://www.bitsophia.com/BitVoicer.aspx). For this purpose, I designed a simple led control sketch which I integrated with BitVoicer. Of course you can do anything you want once you have received the commands from Bitvoicer, but to keep things simple, I thought a led test would do just fine.

Here is the YouTube video with the results:


This is the Arduino sketch that controls the leds and retrieves data sent from BitVoicer:

//Includes the BitVoicer library to the sketch
#include <BitVoicer.h>

//Sets up the pins and default variables
int pinR = 3;
int pinY = 5;
int pinG = 6;
int blinkDelay = 250;
int sequenceDir = 0;
int lightLevel = 0;

//Creates a new instance of the BitVoicerSerial class
//Sets up serial port to 0
BitVoicerSerial bitVoicer = BitVoicerSerial(0);

void setup()
{
  //Starts serial communication and sets up the pinModes
  Serial.begin(9600);
  pinMode(pinR, OUTPUT);
  pinMode(pinY, OUTPUT);
  pinMode(pinG, OUTPUT);
}

void loop()
{
  //Retrieves data from serial buffer 
  bitVoicer.getData();
 
  //Quits the loop if no string data was returned from getData
  if (bitVoicer.strData == "")
  {
    return;
  }
 
  //Each of the next 'if' statements performs a different
  //task based on the data received from BitVoicer
  if (bitVoicer.strData == "wake")
  {
    digitalWrite(pinR, LOW);
    digitalWrite(pinY, LOW);
    digitalWrite(pinG, LOW);
    digitalWrite(pinR, HIGH);
    digitalWrite(pinY, HIGH);
    digitalWrite(pinG, HIGH);
    delay(200);
    digitalWrite(pinR, LOW);
    digitalWrite(pinY, LOW);
    digitalWrite(pinG, LOW);
    delay(200);
    digitalWrite(pinR, HIGH);
    digitalWrite(pinY, HIGH);
    digitalWrite(pinG, HIGH);
    delay(200);
    digitalWrite(pinR, LOW);
    digitalWrite(pinY, LOW);
    digitalWrite(pinG, LOW);
    delay(200);
    digitalWrite(pinR, HIGH);
    digitalWrite(pinY, HIGH);
    digitalWrite(pinG, HIGH);
    delay(200);
    digitalWrite(pinR, LOW);
    digitalWrite(pinY, LOW);
    digitalWrite(pinG, LOW);
    bitVoicer.strData = "";
    lightLevel = 0;
  }
  else if (bitVoicer.strData == "sleep")
  {
    digitalWrite(pinR, LOW);
    digitalWrite(pinY, LOW);
    digitalWrite(pinG, LOW);
    digitalWrite(pinR, HIGH);
    digitalWrite(pinY, HIGH);
    digitalWrite(pinG, HIGH);
    delay(200);
    digitalWrite(pinR, LOW);
    digitalWrite(pinY, LOW);
    digitalWrite(pinG, LOW);
    delay(200);
    digitalWrite(pinR, HIGH);
    digitalWrite(pinY, HIGH);
    digitalWrite(pinG, HIGH);
    delay(200);
    digitalWrite(pinR, LOW);
    digitalWrite(pinY, LOW);
    digitalWrite(pinG, LOW);
    bitVoicer.strData = "";
    lightLevel = 0;
  }
  else if (bitVoicer.strData == "RH")
  {
    digitalWrite(pinR, HIGH);
    bitVoicer.strData = "";
    lightLevel = 255;
  }
  else if (bitVoicer.strData == "RL")
  {
    digitalWrite(pinR, LOW);
    bitVoicer.strData = "";
    lightLevel = 0;
  }
  else if (bitVoicer.strData == "YH")
  {
    digitalWrite(pinY, HIGH);
    bitVoicer.strData = "";
    lightLevel = 255;
  }
  else if (bitVoicer.strData == "YL")
  {
    digitalWrite(pinY, LOW);
    bitVoicer.strData = "";
    lightLevel = 0;
  }
  else if (bitVoicer.strData == "GH")
  {
    digitalWrite(pinG, HIGH);
    bitVoicer.strData = "";
    lightLevel = 255;
  }
  else if (bitVoicer.strData == "GL")
  {
    digitalWrite(pinG, LOW);
    bitVoicer.strData = "";
    lightLevel = 0;
  }
  else if (bitVoicer.strData == "blink")
  {
    digitalWrite(pinR, HIGH);
    digitalWrite(pinY, HIGH);
    digitalWrite(pinG, HIGH);
    delay(blinkDelay);
    digitalWrite(pinR, LOW);
    digitalWrite(pinY, LOW);
    digitalWrite(pinG, LOW);
    delay(blinkDelay);
    lightLevel = 255;
  }
  else if (bitVoicer.strData == "BF")
  {
    blinkDelay = 100;
    bitVoicer.strData = "blink";
    lightLevel = 255;
  }
  else if (bitVoicer.strData == "BFF")
  {
    switch (blinkDelay)
    {
      case 500:
        blinkDelay = 250;
        break;
      case 250:
        blinkDelay = 100;
        break;
      default:
        break;
    }
    bitVoicer.strData = "blink";
    lightLevel = 255;
  }
  else if (bitVoicer.strData == "BS")
  {
    blinkDelay = 500;
    bitVoicer.strData = "blink";
    lightLevel = 255;
  }
  else if (bitVoicer.strData == "BSS")
  {
    switch (blinkDelay)
    {
      case 100:
        blinkDelay = 250;
        break;
      case 250:
        blinkDelay = 500;
        break;
      default:
        break;
    }
    bitVoicer.strData = "blink";
    lightLevel = 255;
  }
  else if (bitVoicer.strData == "sequence")
  {
    if (sequenceDir == 0)
    {
      digitalWrite(pinR, HIGH);
      delay(250);
      digitalWrite(pinR, LOW);
      digitalWrite(pinY, HIGH);
      delay(250);
      digitalWrite(pinY, LOW);
      digitalWrite(pinG, HIGH);
      delay(250);
      digitalWrite(pinG, LOW);
    }
    else
    {
      digitalWrite(pinG, HIGH);
      delay(250);
      digitalWrite(pinG, LOW);
      digitalWrite(pinY, HIGH);
      delay(250);
      digitalWrite(pinY, LOW);
      digitalWrite(pinR, HIGH);
      delay(250);
      digitalWrite(pinR, LOW);
    }
    lightLevel = 255;
  }
  else if (bitVoicer.strData == "revert")
  {
    if (sequenceDir == 0)
    {
      sequenceDir = 1;
    }
    else
    {
      sequenceDir = 0;
    }
    bitVoicer.strData = "sequence";
    lightLevel = 255;
  }
  else if (bitVoicer.strData == "ALLON")
  {
    digitalWrite(pinR, HIGH);
    digitalWrite(pinY, HIGH);
    digitalWrite(pinG, HIGH);
    bitVoicer.strData = "";
    lightLevel = 255;
  }
  else if (bitVoicer.strData == "ALLOFF")
  {
    digitalWrite(pinR, LOW);
    digitalWrite(pinY, LOW);
    digitalWrite(pinG, LOW);
    bitVoicer.strData = "";
    lightLevel = 0;
  }
  else if (bitVoicer.strData == "brighter")
  {
    if (lightLevel < 255)
    {
      lightLevel += 85;
      analogWrite(pinR, lightLevel);
      analogWrite(pinY, lightLevel);
      analogWrite(pinG, lightLevel);
    }
    bitVoicer.strData = "";
  }
  else if (bitVoicer.strData == "darker")
  {
    if (lightLevel > 0)
    {
      lightLevel -= 85;
      analogWrite(pinR, lightLevel);
      analogWrite(pinY, lightLevel);
      analogWrite(pinG, lightLevel);
    }
    bitVoicer.strData = "";
  }
  else
  {
    Serial.println("ERROR:" + bitVoicer.strData);
    bitVoicer.strData = "";
  }
}


This sketch uses the BitVoicer Arduino Library that can be downloaded from their website: www.bitsophia.com.

The BitVoicer Voice Schema that recognizes the speech shown in the video is available at: http://www.justbuss.xpg.com.br/BitVoicerTest.zip (you need to have BitVoicer installed in order to open it).

I hope you guys have fun with it!

Comments

author
VintD (author)2017-05-08

and resistor is 330 ohm?

author
suryak53 (author)2017-03-30

dude, i have a question. bitvoicer runs in the pc, but i want to run the project separately without connecting aurdino to the pc? now will the bitvoicer library be loaded in aurdino? ( i ll give the power to the aurdino via adapter)

author
sentiner (author)2016-11-29

Should i connect the arduino to the computer???

author
ValentinaM22 (author)2016-10-04

Instead of using a voice, can I just use a harmony (a few keys) from my Clarinet?

author
paulrobert27 (author)2016-07-02

I have a question my friend. Will i have to open the sketch and the Bitvoicer when do i run the project?

author
leandro4b (author)paulrobert272016-07-04

You do not have to open the sketch (Arduino IDE), but BitVoicer must be open and running. If you use BitVoicer Server, you do not have to open anything.

author
paulrobert27 (author)leandro4b2016-07-15

Thanks very much leandro4b. I asked that because I haven't made the project yet. =).

author
paulrobert27 (author)leandro4b2016-07-15

Thanks very much leandro4b. I asked that because I haven't made the project yet. =).

author
ARYANB12 (author)2016-07-01

do bitvoicer only works when it activated???

author
leandro4b (author)ARYANB122016-07-04

To enable communication with your Arduino, yes.

author
PandulaM (author)2016-05-20

I have problem in this line

BitVoicerSerial bitVoicer = BitVoicerSerial(0);

and I try to solve it. but failed. Please help me

author
leandro4b (author)PandulaM2016-05-23

The code on this Instructable no longer works with the new BitVoicer library. Take a look at the example on this other Instructable and make the appropriate adjustments to the code.

author
PandulaM (author)leandro4b2016-05-24

thank you very much.

author
adeelsaqib (author)2016-04-13

I have a problem.. when i upload this program to arduino... i got an error of

#include <BitVoicer.h>

can you help me plzzzz it's urgently...

author
leandro4b (author)adeelsaqib2016-04-14

What is the exact error message? Have you placed all the library files in the right folder? More information here: http://www.arduino.cc/en/Guide/Libraries

author
adeelsaqib (author)2016-04-13

sir plzzz help me

author
chiragc1 (author)2015-12-12

shows error on compiling

error:'BitVoicerSerial' does not name a type????..pls help

author
leandro4b (author)chiragc12015-12-15

Chiragc, this post is too old and the last BitVoicer version no longer has the BitVoicer.h library. Take a look at this post: https://www.instructables.com/id/Speech-Recognition-with-Arduino/. It is newer and uses the current version of the BitVoicer library.

author
MAE38415 (author)2015-08-04

I Do I need to connect arduıno to computer for this project? please answer quick . It's important to me.

author
JayJ7 (author)MAE384152015-10-06

yes bit voicer sends the data to arduino and the arduino performs the function according to the received string

author
AdityaS9 (author)2015-05-17

"BitVoicerSerial bitVoicer = BitVoicerSerial(0);" this line has an error i think when i write "BitVoicerSerial(0);" the sketch was not compiling and when i write "BitVoicerSerial(0);" it compiled. Is their any mistake in this line??

author
leandro4b (author)AdityaS92015-05-17

I am sorry Aditya, but I don't get any erros compiling this sketch. Make sure you have installed the library correctly. Also, I do not see the difference between "BitVoicerSerial(0);" and "BitVoicerSerial(0);"???

author
AdityaS9 (author)leandro4b2015-05-17

sorry, i did a mistake above,
when i write "BitVoicerSerial(0);" it give an error and when i write "BitVoicerSerial();" the code compiles successfully.

The difference is "(0)" and "()".

author
leandro4b (author)AdityaS92015-05-18

You are right Aditya. The problem is that the code above was written for the first version of the BitVoicer library. The current version does not take an argument with the constructor. You must use the setAudioInput function to set up the pin.

author
AdityaS9 (author)leandro4b2015-05-18

ok..got it thankuu

author
ga3 (author)2015-01-20

hey,, tnx,, i have a question,, what is the resistor size?

author
leandro4b (author)ga32015-01-21

330 ohms.

author
ga3 (author)leandro4b2015-01-22

tnx,,

author
orestman (author)2013-12-23

I have a problem.I downloaded the bitvoicer but i cannot find the activation key!!!Whyy???Where is it? please help.

author
ohoilett (author)orestman2014-11-15

It appears that it is possible to do voice recognition with Arduino using an Android phone and accompanying app. Here is an Instructable that demonstrates this https://www.instructables.com/id/Voice-Activated-Ar...

There are other Instructables that demonstrate the same thing.

And here is the app they are using https://play.google.com/store/apps/details?id=robo...

Good luck!

author
orestman (author)ohoilett2014-11-17

Thanks!That was really helpfull !

author
leandro4b (author)orestman2013-12-26

BitVoicer is not a free software. You have to buy the product key at their website, but it's only $4.50.

author
orestman (author)leandro4b2013-12-27

Is there any similar FREE software that I could use in case I do not want to pay????:)Thanks a lot!

author
leandro4b (author)orestman2013-12-28

Sorry, I don't know any other program like this. Besides, as I said, it's only $4.50.

author
aloksvm (author)2014-11-14

shows error on compiling

error:'BitVoicerSerial' does not name a type????..pls help

author
Adith Jagadish made it! (author)2014-08-31

Acknowledged you in my Instructable - https://www.instructables.com/id/Speech-Controlled-Quadropod/

FW5A3HIHYSITOHX.MEDIUM[1].jpg
author
goldenshuttle (author)2014-02-03

excellent post..great job indeed.

author
Youssef Emad (author)2013-07-18

You didn't use a USB cable or a Bluetooth slave , so how did you connect between the Arduino and the computer ( how did you use the computer microphone ) ?

author
leandro4b (author)Youssef Emad2013-12-12

In this project I am using a USB cable. The cable is not very visible, but it is there. On this post I use a wireless module from sparkfun: https://www.instructables.com/id/Wireless-Audio-Streaming-and-Speech-Recognition/

author
leandro4b (author)2013-06-24

The new version of BitVoicer no longer supports the BitVoicer.h library. You will need the new library (BitVoicer11.h). Check out the code on this instructable: https://www.instructables.com/id/Speech-Recognition-with-Arduino/

author
ckrmustafa (author)2013-04-22

Hi leandro4b,
I would like to make your awesome project. I wonder that what kind of microphone you used. Please help me where I find it? link pls. Thanks for your help.

author
leandro4b (author)ckrmustafa2013-04-25

In this project I used the computer microphone, but in this one (https://www.instructables.com/id/Speech-Recognition-with-Arduino/) I used an electret microphone from sparkfun. Here is the link to the mic: https://www.sparkfun.com/products/9964. I made a small modification to the breakout board to reduce the frequency range, although the results with the original board were very good.

author
leandro4b (author)2013-01-14

I added a wireless module and a microphone to this project. Here is the Instructable link: https://www.instructables.com/id/Wireless-Audio-Streaming-and-Speech-Recognition/

author
leandro4b (author)2012-12-18

BitSophia released a new version of BitVoicer and the above sketch no longer works with it. I'll post a new instructable as soon as I figure out how to stream audio to BitVoicer.

author
uniphoresolution (author)2012-12-10

Its really very funny technology.

author
0928885086 (author)2012-12-02

I use your steps to make it ,but my arduino not work

author
leandro4b (author)09288850862012-12-03

Is the Arduino enviroment able to compile your sketch?

author
0928885086 (author)leandro4b2012-12-06

I use arduino uno and my sketch can upload my board

author
leandro4b (author)09288850862012-12-06

The second line of my sketch had an error. I don't know why, but when I wrote this post part of the code was not copied. It should work now.

author
amandaghassaei (author)2012-11-20

very cool, do you think there's any way to do this without a computer?

About This Instructable

41,165views

72favorites

License:

More by leandro4b:2WD Voice Controlled Robot with Arduino and BitVoicer ServerSpeech Recognition and Synthesis with ArduinoSpeech Recognition with Arduino and BitVoicer Server
Add instructable to: