LED Speech Recognition with EasyVR3 Shield 3

EasyVR3

The EasyVR3 is the third generation of the EasyVR product line. The EasyVR3 is a multi-purpose speech recognition module designed to easily add versatile, robust and cost effective speech recognition capabilities. Main features that it includes are up to 32 user-defined Speaker Dependent or speaker verification commands that can be trained in any language, a selection of built-in speaker independent commands for ready-to-run basic controls, up to 22 minutes of pre-recorded sounds or speech, DTMF tone generation, standard UART interface compatible CMOS/TTL levels at 3.3V or 5V, and many more features. This module can be used with any host with a UART interface powered at 3.3V – 5V, such as Arduino boards and PIC. The module does come with a mic and speaker wires, but not a loudspeaker module. Applications of this module can range from simple robot commands to industrial user interactive systems. Devices that use similar modules for speech recognition enable us to be able to turn on a light on command or hands-free dialing of a friend when a user requests on their Smartphone devices.

Wiring

It outputs a serial TTL signasl and runs off of 3.3V, but can also run off 5V. The basic connections are to plug in the microphone, hook up power, and then the serial RX/TX pins. The RX and TX swap when connecting to mbed (i.e., RX-TX and TX-RX).

MBEDEASYVR3
Vu5V
GNDGND
TX(p13)RX
RX(p14)TX

Using EasyVR3 for basic Speech Recognition Commands to light up an RGB LED

The demo below shows an RGB LED lighting up different colors based on speech commands. When a user says "Hello," the LED will light up green. Following by the command "Run," the LED will blink red, green, and blue continuously until a command of "Stop" is requested by the user which will turn the LED off. For the status, if the MBED's LED1 light up then the EasyVR3 is ready for listening. The green light on the EasyVR3 module also indicates a listening status. When the EasyVR3 takes a command, the MBED's LED4 will toggle.

Some downside to using this module is that the mic can sometimes not pick up your voice correctly and will not respond to your command. Depending on how well you project your voice, the module may or may not pick it up the first time.

Picture

/media/uploads/thuynh42/photo.jpg

MBED Code

main.cpp

#include "mbed.h"
#include "EasyVR.h"
 
DigitalOut led1(LED1);
DigitalOut led4(LED4);

EasyVR VR(p13, p14);  // tx, rx
Serial pc(USBTX,USBRX);

PwmOut red(p21);
PwmOut blue(p22);
PwmOut green(p23);

void ledDance();
 
int main() {
    char buffer=0;

    if(VR.awake())                //wake up device - needs more work and a timeout
    {
        led1 = 1;
    }
    
    while (1)
    {
        VR.sendCmd(CMD_RECOG_SI); // Start Recognition
        VR.sendArg(1);            // Use Wordset 1
        
        buffer = VR.recv();       // Receive a byte from easyVR 
        
        if(buffer == CMD_SLEEP)   // If easyVR is sleeping
        {
            VR.sendCmd(' ');      // Send blanck to activate it
        }
        else
        {
            VR.decrypt(&buffer);  // If not sleeping, decrtpt received message
            pc.printf("%d\n",buffer);
        }
        
        // if command is taken by easyVR, the LED4 will toggle
        if (buffer==7) {red = 0; green = 1; blue = 0;led4=!led4;}   // hello
        if (buffer==6) {red = 0; green = 0; blue = 0;led4=!led4;}   // stop or turn off
        if (buffer==3) {led4=!led4;ledDance();}                     // run
        if (buffer==7) led4=!led4;
        wait(0.1);
    }
}

void ledDance()
{
    for(int i=0;i<5000;i++)
    {
        red = !green;
        green = !blue;
        blue = !red;
        wait(0.001);
    }
    red = 1;
    green = 0;
    blue = 0;
    
}

Import MBED Program

Import programEasyVR3_LED

EasyVR3_LED

Demo Video

Library

Import library

Public Member Functions

EasyVR (PinName tx, PinName rx)
Use Serial communication.
void sendCmd (uint8_t)
Send a command to EasyVR to excute device build in routine.
void sendArg (int8_t)
Send a argument for the routine.
int8_t recv (int8_t timeOut=1)
Receive return value from device routine, default timeOut to 1.
void decrypt (char *)
Decrypt returned value from device.
bool awake (int timeOut=100)
Used for awaking up device, default time out value to 100.


Please log in to post comments.