Instructables

Speech Recognition with BitVoicer and Arduino

Picture of Speech Recognition with BitVoicer and Arduino
BitVoicerTest2.jpg
BitVoicerTest3.jpg
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!
goldenshuttle2 months ago

excellent post..great job indeed.

orestman3 months ago
I have a problem.I downloaded the bitvoicer but i cannot find the activation key!!!Whyy???Where is it? please help.
leandro4b (author)  orestman3 months ago
BitVoicer is not a free software. You have to buy the product key at their website, but it's only $4.50.
Is there any similar FREE software that I could use in case I do not want to pay????:)Thanks a lot!
leandro4b (author)  orestman3 months ago
Sorry, I don't know any other program like this. Besides, as I said, it's only $4.50.
Youssef Emad9 months ago
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 ) ?
leandro4b (author)  Youssef Emad4 months ago
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: http://www.instructables.com/id/Wireless-Audio-Streaming-and-Speech-Recognition/
nate2thedog10 months ago
(removed by author or community request)
leandro4b (author)  nate2thedog9 months ago
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: http://www.instructables.com/id/Speech-Recognition-with-Arduino/
ckrmustafa12 months ago
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.
leandro4b (author)  ckrmustafa11 months ago
In this project I used the computer microphone, but in this one (http://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.
leandro4b (author) 1 year ago
I added a wireless module and a microphone to this project. Here is the Instructable link: http://www.instructables.com/id/Wireless-Audio-Streaming-and-Speech-Recognition/
leandro4b (author) 1 year ago
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.
Its really very funny technology.
09288850861 year ago
I use your steps to make it ,but my arduino not work
leandro4b (author)  09288850861 year ago
Is the Arduino enviroment able to compile your sketch?
I use arduino uno and my sketch can upload my board
leandro4b (author)  09288850861 year ago
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.
very cool, do you think there's any way to do this without a computer?
leandro4b (author)  amandaghassaei1 year ago
I believe it is impossible to perform this kind of speech recognition without a computer. Microcontrollers simply do not have enough processing power.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!