Go Down

Topic: Arduino Uno + EasyVR Shield train Speaker Dependent commands (Read 929 times) previous topic - next topic


I have gotten pretty deep into testing this module and have most features working.  I even went as far as to load the EasyVR Bridge sketch, used EasyVR Commander and manually trained the commands on the PC.  I can get it to recognize these commands via recognizeWord(group) no problem. What's got me stuck is trying to train a speaker-dependent command offline (directly through Arduino code, not using EasyVR Commander in bridge mode).  Has anyone else gotten this working?  From the looks of page41 of the Easy VR manual, you just need to call easyvr.trainCommand(group,index) and then poll hasFinished() until true.

but, when I execute this, and continuously poll hasFinished, it always returns false.  It theoretically should time out after a few seconds.  I even tried using eraseCommand(group,index) first (it returns true) before using the trainCommand, but still get the same result.


Hi a bit late but I thought it could be useful to someone, I successed to train SD  commands without pc easyvr commander with this code:

// ARDUINO 1.6.6
// EasyVR Shield 2.0
// EasyVR library v1.7

#include "Arduino.h"
#error "Arduino version not supported. Please update your IDE to the latest version."

#define pcSerial SERIAL_PORT_MONITOR

#include "SoftwareSerial.h"
SoftwareSerial port(12, 13);

#include "EasyVR.h"
EasyVR easyvr(port);


char label[33];
uint8_t data;

bool train = false;
bool recog = false;

int8_t group = EasyVR::PASSWORD;
int8_t index = 0;

void setup()

  while (!easyvr.detect())
    pcSerial.println(F("EasyVR not detected!"));


  easyvr.setPinOutput(EasyVR::IO1, LOW);
  pcSerial.print(F("EasyVR detected, version "));
  //  easyvr.setLevel(EasyVR::HARD);



void printCommands()
  pcSerial.print(F("Password: "));
  int16_t count = easyvr.getCommandCount(group);
  pcSerial.println(F(" command(s)"));
  for (int8_t idx = 0; idx < count; ++idx) {
    if (easyvr.dumpCommand(group, idx, label, data)) {
      pcSerial.print(F(" = "));
      pcSerial.print(F(", Trained "));
      pcSerial.print(data, DEC);
      if (!easyvr.isConflict()) pcSerial.println(F(" times, OK"));

bool checkMonitorInput()
  if (pcSerial.available() <= 0) return false;

  int16_t rx = pcSerial.read();
  //  pcSerial.print(rx);

  if (rx == 's')
    easyvr.removeCommand(group, index);
    easyvr.addCommand(group, index);
    easyvr.setCommandLabel(group, index, "cuss");


  if (rx == 't')
    recog = false;
    pcSerial.print("say something");
    train = true;

  if (rx == 'r')
    train = false;
    pcSerial.print("start recognition");
    recog = true;


  if (rx >= 0)
    return true;
  return false;

void loop()

  if (train) {
    pcSerial.println("Train a word");
    easyvr.trainCommand(group, index);

  if (recog) {
    pcSerial.println("Say the word");


  do {
    if (checkMonitorInput()) return;
  while (!easyvr.hasFinished());


  int16_t idx = easyvr.getCommand();
  if (idx >= 0) {
    if (easyvr.dumpCommand(EasyVR::PASSWORD, idx, label, data)) {
      pcSerial.print("recognized = ");
    easyvr.playSound(0, EasyVR::VOL_FULL);

  } else {
    if (easyvr.isTimeout()) pcSerial.println("Timed out, try again...");
    int16_t err = easyvr.getError();
    if (err >= 0) {
      pcSerial.print("Error 0x");
      pcSerial.println(err, HEX);

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131