Pages: [1]   Go Down
Author Topic: hi all!!! I'm in trouble with test easyvr shield on arduino!!! Help!!!!  (Read 2874 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 2
Posts: 215
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi, i'm trying to test an easyvr shield on my arduino 2009. When i test it with commander software, so set jumper on pc position, plug usb cable, set on commander the arduino com port and connect, all it's ok, with the test group function on software i'm able to test the speech recognition. So, on arduino ide 0022, i copied the correct libraries on the ide folder/libraries, load the testeasyvr under the example/easyvr, set jumper in sw position, upload the code and open the serial monitor... and always say  "EasyVR not detected!" The 12 and 13 pins are ok, test with the basic blink sketch and an led... what i'm doing wrong?!? Thanks!!!


ps this is the example sketch i'm testing:

Code:
/**
  EasyVR Tester
 
  Dump contents of attached EasyVR module
  and exercise it with playback and recognition.
 
  Serial monitor can be used to send a few basic commands:
  'c' - cycles through available command groups
  'b' - cycles through built-in word sets
  's123.' - play back sound 123 if available (or beep)
 
  With EasyVR Shield, the green LED is ON while the module
  is listening (using pin IO1 of EasyVR).
  Successful recognition is acknowledged with a beep.
  Details are displayed on the serial monitor window.

**
  Example code for the EasyVR library v1.0
  Written in 2011 by RoboTech srl for VeeaR <http:://www.veear.eu>

  To the extent possible under law, the author(s) have dedicated all
  copyright and related and neighboring rights to this software to the
  public domain worldwide. This software is distributed without any warranty.

  You should have received a copy of the CC0 Public Domain Dedication
  along with this software.
  If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
*/

#if defined(ARDUINO) && ARDUINO >= 100
  #include "Arduino.h"
  #include "SoftwareSerial.h"
  SoftwareSerial port(12,13);
#else // Arduino 0022 - use modified NewSoftSerial
  #include "WProgram.h"
  #include "NewSoftSerial.h"
  NewSoftSerial port(12,13);
#endif

#include "EasyVR.h"

EasyVR easyvr(port);

int8_t set = 0;
int8_t group = 0;
uint32_t mask = 0; 
uint8_t train = 0;
char name[32];
bool useCommands = true;

EasyVRBridge bridge;

void setup()
{
  // bridge mode?
  if (bridge.check())
  {
    cli();
    bridge.loop(0, 1, 12, 13);
  }
  // run normally
  Serial.begin(9600);
  port.begin(9600);

  if (!easyvr.detect())
  {
    Serial.println("EasyVR not detected!");
    for (;;);
  }

  easyvr.setPinOutput(EasyVR::IO1, LOW);
  Serial.println("EasyVR detected!");
  easyvr.setTimeout(5);
  easyvr.setLanguage(EasyVR::ITALIAN);
 
  int16_t count = 0;
 
  Serial.print("Sound table: ");
  if (easyvr.dumpSoundTable(name, count))
  {
    Serial.println(name);
    Serial.print("Sound entries: ");
    Serial.println(count);
  }
  else
    Serial.println("n/a");
 
  if (easyvr.getGroupMask(mask))
  {
    uint32_t msk = mask; 
    for (group = 0; group <= EasyVR::PASSWORD; ++group, msk >>= 1)
    {
      if (!(msk & 1)) continue;
      if (group == EasyVR::TRIGGER)
        Serial.print("Trigger: ");
      else if (group == EasyVR::PASSWORD)
        Serial.print("Password: ");
      else
      {
        Serial.print("Group ");
        Serial.print(group);
        Serial.print(": ");
      }
      count = easyvr.getCommandCount(group);
      Serial.println(count);
      for (int8_t idx = 0; idx < count; ++idx)
      {
        if (easyvr.dumpCommand(group, idx, name, train))
        {
          Serial.print(idx);
          Serial.print(" = ");
          Serial.print(name);
          Serial.print(", Trained ");
          Serial.print(train, DEC);
          if (!easyvr.isConflict())
            Serial.println(" times, OK");
          else
          {
            int8_t confl = easyvr.getWord();
            if (confl >= 0)
              Serial.print(" times, Similar to Word ");
            else
            {
              confl = easyvr.getCommand();
              Serial.print(" times, Similar to Command ");
            }
            Serial.println(confl);
          }
        }
      }
    }
  }
  group = 0;
  mask |= 1; // force to use trigger
  useCommands = (mask != 1);
}

const char* ws0[] =
{
  "ROBOT",
};
const char* ws1[] =
{
  "ACTION",
  "MOVE",
  "TURN",
  "RUN",
  "LOOK",
  "ATTACK",
  "STOP",
  "HELLO",
};
const char* ws2[] =
{
  "LEFT",
  "RIGHT",
  "UP",
  "DOWN",
  "FORWARD",
  "BACKWARD",
};
const char* ws3[] =
{
  "ZERO",
  "ONE",
  "TWO",
  "THREE",
  "FOUR",
  "FIVE",
  "SIX",
  "SEVEN",
  "EIGHT",
  "NINE",
  "TEN",
};
const char** ws[] = { ws0, ws1, ws2, ws3 };

bool checkMonitorInput()
{
  if (Serial.available() <= 0)
    return false;
 
  // check console commands
  int16_t rx = Serial.read();
  if (rx == 'b')
  {
    useCommands = false;
    set++;
    if (set > 3)
      set = 0;
  }
  if (rx == 'c')
  {
    useCommands = true;
    do
    {
      group++;
      if (group > EasyVR::PASSWORD)
        group = 0;
    } while (!((mask >> group) & 1));
  }
  if (rx == 's')
  {
    int16_t num = 0;
    delay(5);
    while ((rx = Serial.read()) >= 0)
    {
      if (isdigit(rx))
        num = num * 10 + (rx - '0');
      else
        break;
      delay(5);
    }
    if (rx == '.')
    {
      easyvr.stop();
      easyvr.playSound(num, EasyVR::VOL_DOUBLE);
    }
  }
  if (rx >= 0)
  {
    easyvr.stop();
    Serial.flush();
    return true;
  }
  return false;
}

void loop()
{
  checkMonitorInput();
 
  easyvr.setPinOutput(EasyVR::IO1, HIGH); // LED on (listening)
  if (useCommands)
  {
    Serial.print("Say a command in Group ");
    Serial.println(group);
    easyvr.recognizeCommand(group);
  }
  else
  {
    Serial.print("Say a word in Wordset ");
    Serial.println(set);
    easyvr.recognizeWord(set);
  }

  do
  {
    if (checkMonitorInput())
      return;
  }
  while (!easyvr.hasFinished());
 
  easyvr.setPinOutput(EasyVR::IO1, LOW); // LED off

  int16_t idx = easyvr.getWord();
  if (idx >= 0)
  {
    Serial.print("Word: ");
    Serial.print(easyvr.getWord());
    Serial.print(" = ");
    if (useCommands)
      Serial.println(ws[group][idx]);
    else
      Serial.println(ws[set][idx]);
    // ok, let's try another set
    set++;
    if (set > 3)
      set = 0;
    easyvr.playSound(0, EasyVR::VOL_FULL);
  }
  else
  {
    idx = easyvr.getCommand();
    if (idx >= 0)
    {
      Serial.print("Command: ");
      Serial.print(easyvr.getCommand());
      if (easyvr.dumpCommand(group, idx, name, train))
      {
        Serial.print(" = ");
        Serial.println(name);
      }
      else
        Serial.println();
      // ok, let's try another group
      do
      {
        group++;
        if (group > EasyVR::PASSWORD)
          group = 0;
      } while (!((mask >> group) & 1));
      easyvr.playSound(0, EasyVR::VOL_FULL);
    }
    else // errors or timeout
    {
      if (easyvr.isTimeout())
        Serial.println("Timed out, try again...");
      int16_t err = easyvr.getError();
      if (err >= 0)
      {
        Serial.print("Error ");
        Serial.println(err, HEX);
      }
    }
  }
}


Logged

USA, FL
Offline Offline
God Member
*****
Karma: 14
Posts: 689
A life? Where can I download one of those?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is there a reason you haven't upgraded to the IDE 1.0.1 version?  

Is there anything connected to the Arduino/EasyVR Shield?

What blink sketch are you talking about?  

If you are using the EasyVR examples from the IDE, try using the Commander to export a sketch for you.  

Open Commander and connect the EasyVR device.  (you don't have to move the jumper from SW, just make sure you don't have the IDE Serial monitor open)  Hit the button beside the COM port drop down (hover over it and it will say "Generate Code.."  Copy and paste that into the IDE and upload.  Disconnect Commander from the Shield.  Open Serial monitor and post what it says.

You don't have to use so many explanation points!!!  It gets annoying!!!!  See what I mean!!!!  It gets hard to read!!!!!!
Logged

//LiNK

0
Offline Offline
Full Member
***
Karma: 2
Posts: 215
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No reason, i try also with 1.0, i'll try with 1.01... anything connected, only arduino and shield. also with code generated from commander on serial monitor say easyvr not detected! on the example sketch on ide, there is one called blink, just for blink the onboard led or by changing the pin, another led on another pin. Sorry for many explanation point, just for show better my situation!
Logged

USA, FL
Offline Offline
God Member
*****
Karma: 14
Posts: 689
A life? Where can I download one of those?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Post the code from the Commander.  For some reason your code is different from mine..
Logged

//LiNK

0
Offline Offline
Full Member
***
Karma: 2
Posts: 215
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
#if defined(ARDUINO) && ARDUINO >= 100
  #include "Arduino.h"
  #include "SoftwareSerial.h"
  SoftwareSerial port(12,13);
#else // Arduino 0022 - use modified NewSoftSerial
  #include "WProgram.h"
  #include "NewSoftSerial.h"
  NewSoftSerial port(12,13);
#endif

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

//Groups and Commands
enum Groups
{
  GROUP_0  = 0,
  GROUP_1  = 1,
};

enum Group0
{
  G0_PROVA = 0,
};

enum Group1
{
  G1_PROVA = 0,
};


EasyVRBridge bridge;

int8_t group, idx;

void setup()
{
  // bridge mode?
  if (bridge.check())
  {
    cli();
    bridge.loop(0, 1, 12, 13);
  }
  // run normally
  Serial.begin(9600);
  port.begin(9600);

  if (!easyvr.detect())
  {
    Serial.println("EasyVR not detected!");
    for (;;);
  }

  easyvr.setPinOutput(EasyVR::IO1, LOW);
  Serial.println("EasyVR detected!");
  easyvr.setTimeout(5);
  easyvr.setLanguage(1);

  group = EasyVR::TRIGGER; //<-- start group (customize)
}

void action();

void loop()
{
  easyvr.setPinOutput(EasyVR::IO1, HIGH); // LED on (listening)

  Serial.print("Say a command in Group ");
  Serial.println(group);
  easyvr.recognizeCommand(group);

  do
  {
    // can do some processing while waiting for a spoken command
  }
  while (!easyvr.hasFinished());
 
  easyvr.setPinOutput(EasyVR::IO1, LOW); // LED off

  idx = easyvr.getWord();
  if (idx >= 0)
  {
    // built-in trigger (ROBOT)
    // group = GROUP_X; <-- jump to another group X
    return;
  }
  idx = easyvr.getCommand();
  if (idx >= 0)
  {
    // print debug message
    uint8_t train = 0;
    char name[32];
    Serial.print("Command: ");
    Serial.print(idx);
    if (easyvr.dumpCommand(group, idx, name, train))
    {
      Serial.print(" = ");
      Serial.println(name);
    }
    else
      Serial.println();
    easyvr.playSound(0, EasyVR::VOL_FULL);
    // perform some action
    action();
  }
  else // errors or timeout
  {
    if (easyvr.isTimeout())
      Serial.println("Timed out, try again...");
    int16_t err = easyvr.getError();
    if (err >= 0)
    {
      Serial.print("Error ");
      Serial.println(err, HEX);
    }
  }
}

void action()
{
    switch (group)
    {
    case GROUP_0:
      switch (idx)
      {
      case G0_PROVA:
        // write your action code here
        // group = GROUP_X; <-- or jump to another group X for composite commands
        break;
      }
      break;
    case GROUP_1:
      switch (idx)
      {
      case G1_PROVA:
        // write your action code here
        // group = GROUP_X; <-- or jump to another group X for composite commands
        break;
      }
      break;
    }
}
Logged

USA, FL
Offline Offline
God Member
*****
Karma: 14
Posts: 689
A life? Where can I download one of those?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

When you copy and paste the entire code into the Arduino IDE and upload the sketch, you get "EasyVR not detected!"?

You do have NewSoftSerial library intalled at C:/yourinstallationfolder/Arduino/libraries/  ?

I don't see anything wrong with that code.  Is the LED at D6 turning on when you power the Arduino?
Logged

//LiNK

0
Offline Offline
Full Member
***
Karma: 2
Posts: 215
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

easyvr not detected! it's on serial monitor, after i uploaded the code and open the serial monitor... yes, i have newsoftserial under libriaries, so no error in compiling.... and the led stay solid green when i power arduino!!! it's very strange....
Logged

USA, FL
Offline Offline
God Member
*****
Karma: 14
Posts: 689
A life? Where can I download one of those?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can you take a pic of your setup and attach it to a post?  There is something going on that I am not seeing...
Logged

//LiNK

0
Offline Offline
Full Member
***
Karma: 2
Posts: 215
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

http://image.forumfree.it/9/4/1/3/8/5/1/1351515734.jpgok!!! even if there is no error, it's just an arduino and a shield!!!
« Last Edit: October 29, 2012, 04:26:04 pm by nytro81 » Logged

USA, FL
Offline Offline
God Member
*****
Karma: 14
Posts: 689
A life? Where can I download one of those?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Once you get the "not detected" message hit the reset button on the Arduino.  

After that, I am clueless.  I used your code with mine and it works.  If yours still don't detect, I would try to get an exchange from where you bought it from..  

As a last ditch effort, you could google search that error and see if any other solution works.

Are you addicted to the exclamation mark?
Logged

//LiNK

0
Offline Offline
Full Member
***
Karma: 2
Posts: 215
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, many thanks with all of your support.... sorry again for the mark... !!!!!!!!! ;-)
Logged

Pages: [1]   Go Up
Jump to: