problema con easyvr shield e newsoftserial....

Salve, avrei x le mani un easyvr shield, ma sto incontrando qualche problemino.... qualcuno di voi ne possiede uno o ci ha messo le mani sopra? Il mio problema consiste nel fatto che dopo aver caricato la libreria, caricato lo sketch di esempio, aprendo il terminal seriale mi dice "EasyVR not detected!".... idee? Grazie!!

Ho usato un anno fa l'easyvr, solo il modulo senza shield.
Con lo shield non devi fare nessun collegamento basta solo che lo monti sopra l'arduino (almeno credo).
Sicuramente fai un errore con il software, hai letto la documentazione rilasciata dal produttore?
Purtroppo non ce l'ho più sotto mano, non posso aiutarti a fare le prove.

In teoria dovrei aver fatto tutto ok... ho connesso prima il modulo direttamente alla seriale in modo da farlo comunicare col commander, per caricare, addestrare nuovi comandi e testare il riconoscimento, e li funziona. Una volta caricate le libreria e sketch non me lo rileva proprio a terminale!!!! Cercando su google ho trovato poco....

questo è il codice di prova che sto utilizzando:

/**
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);
}
}
}
}

Ti sei fatto generare lo sketch dal commander?
Da quanto vedo hai ancora i comandi di default in inglese nel tuo sketch.
C'è un pulsante nel commander che ti genera il codice con i vocaboli che hai impostato, dovresti usare quello e modificarlo leggermente; la modifica consiste nell'aggiungere cosa dovrà fare l'arduino quando arrivano i comandi quindi accendere led, azionare motori, scrivere sulla seriale, ecc.

Per una migliore leggibilità inserisci il codice dentro i tag [code] [/code] (senza asterisco iniziale)

no, questo è lo sketch che compare negli example una volta inserita la libreria, l'unica cosa che ho cambiato è appunto la lingua in italiano... ma anche generando il codice dal commander mi da sempre il solito messaggio... non riesco a capire dove è che si impunta con la comunicazione... adesso proverò con un altra arduino tante volte fossero i pin 12 e 13 che danno problemi... dovrebbero essere proprio questi quelli adibiti alla comunicazione seriale con il modulo giusto?

Puoi usare qualsiasi pin per la seriale, se fai caso usa la softwareSerial per il modulo

 SoftwareSerial port(12,13);

e la seriale hardware per il collegamento al pc (bridge)

bridge.loop(0, 1, 12, 13);

ok, ma sulla shield i pin sono forzati a quelli collegati no!??!

mi aiuti a comprendere questa parte... che dovrebbe essere quella che mi genera il messaggio su seriale...

if (!easyvr.detect())
{
Serial.println("EasyVR not detected!"); //questo è il messaggio maledetto!!
for (;;);
}

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

if (!easyvr.detect()) // se il modulo non è rilevato (il punto esclamativo all'inizio è la negazione)
  {
    Serial.println("EasyVR not detected!");       //stampa il "messaggio maledetto" sulla seriale hardware (0 e 1)
    for (;;); // entra in un ciclo infinito, lo sketch si ferma qui
  }

il resto del codice non viene eseguito.

ed il controllo se rileva o meno l'easyvr come lo fa?! adesso proverò i pin 12 e 13 x vedere se c'è qualche problema hardware... ma che tu ti ricordi, quando collegando sempre tramite arduino il modulo (o in questo caso la shield) al pc e verificandone il funzionamento con il software commander, i pin che utilizza su arduino ovviamente sono i soliti no?

Nulla, i pin 12 e 13 sono ok... non so dove sbattere la capoccia!!!!!!!

nessuno che ha un modulo così eh!!?!? Come sono triste....!

Posta il codice generato dal commander, ci devono essere i comandi che hai registrato

ecco, questo è il codice generato con il commander connesso al modulo tramite arduino, ovviamente mettendo il jumper sulla posizione PC. Ho provato soltanto ad aggiungere un trigger chiamato prova, tutto il resto sono i comandi già presenti di default

#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;
}
}

anche se vado a caricare questo, sempre andando prima a mettere il jumper stavolta in posizione SW come da manuale, quando apro il monitor seriale mi da sempre il messaggio che non rileva la easyvr!!

Prova a mettere un condensatore da 1uF tra i pin reset e gnd, mi raccomando il negativo del condensatore su gnd e il positivo sul pin reset.

ok, stasera/stanotte proverò, dici ci possono essere problemi con il reset? Lunedì avrò cmq modo di provare con un altra arduino, adesso ho una vecchia 2009, lunedì mi faccio prestare una uno...

Provato col condensatore, nulla.... ma con il condensatore messo tra reset e massa non è che è come se fosse sempre abilitato il reset? xchè quando apro il monitor seriale con il condensatore inserito non mi da neanche il messaggio not detect!

Proviamo a fregarlo, carica questo sketch.... in pratica ho commentato il controllo.
Una volta caricato prova a dire il comando PROVA e guarda cosa ti dice nel serial monitor.
Se non accade nulla resetta l'arduino e vediamo che succede

#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

                                                                              Serial.println("hai detto PROVA");

        // 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
                                                                              Serial.println("hai ridetto PROVA");
        // group = GROUP_X; <-- or jump to another group X for composite commands
        break;
      }
      break;
    }
}

Nulla!!!!! Cioè, ovvimamente non da + il messaggio ma "EasyVR detected!
Say a command in Group 0", il led verde rimane fisso acceso ma parlando non succede proprio nulla.... pare proprio che non riesce a comunicare in seriale con il modulo... ho l'impressione che sia un problema di ide/librerie... ricapitolando, adesso sto facendo le prove con la ide 0022, ho copiato le librerie adatte... poi ho provato anche con la ide 1.0 e le rispettive librerie, ma nulla... quasi quasi te la spedisco a casa e me la provi!!!! :grin: