easyVR with Ethernet

Hello,

i have a problem with the ethernet and the easyvr Shield.
Separately the shield work's fine.

When i stack modules together, i can't obtain a ip address.....

did you have a idea ?

/*
  Web client
 
 This sketch connects to a website (http://www.google.com)
 using an Arduino Wiznet Ethernet shield. 
 
 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13
 
 created 18 Dec 2009
 by David A. Mellis
 
 */
#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 <SPI.h>
#include <Ethernet.h>
#include "EasyVR.h"
// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = {  0x90, 0xA2, 0xDA, 0x08, 0x00, 0xBF };
IPAddress server(192,168,2,114); // Google
// Initialize the Ethernet client library
// with the IP address and port of the server 
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;

EasyVR easyvr(port);
EasyVRBridge bridge;

uint32_t mask = 0;
int8_t group = 0;
uint8_t train = 0;
char name[32];

void setup() {  
  // start the serial library:
  Serial.begin(9600);
  
  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    for(;;)
      ;
  }  
  // give the Ethernet shield a second to initialize:
  delay(1000);
  
  // bridge mode?
  if (bridge.check()) {
    cli();
    bridge.loop(0, 1, 12, 13);
  }


  if (!easyvr.detect()) {
    Serial.println("EasyVR not detected!");
    for (;;);
  }
  
  easyvr.setPinOutput(EasyVR::IO1, LOW);
  Serial.println("EasyVR detected!");
  easyvr.setTimeout(5);
  easyvr.setLanguage(EasyVR::FRENCH);
  
  int16_t count = 0;
  
  if (easyvr.getGroupMask(mask)) // get trained user names and passwords
  {
    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);
          }
        }
      }
    }
  }
}

void loop()
{   
  int idx_cmd;	
  int idx_pwd;
  
  easyvr.setPinOutput(EasyVR::IO1, HIGH); // LED on (listening)
  
  Serial.println("Say a name in Group 1");  
  easyvr.recognizeCommand(1); // recognise command in group 1 
  while (!easyvr.hasFinished()); // wait for user name
  
  easyvr.setPinOutput(EasyVR::IO1, LOW); // LED off
 
  idx_cmd = easyvr.getCommand(); // get recognised command
  
  if (idx_cmd >= 0) 
  {    
    Serial.print("Command: ");    
    if (easyvr.dumpCommand(1, idx_cmd, name, train))
      Serial.println(name);
    else
      Serial.println();    
    
    /*
    Serial.println("Say the password");    
    easyvr.recognizeCommand(EasyVR::PASSWORD); // set group 16
    while (!easyvr.hasFinished()); // wait for password
    */

    easyvr.setPinOutput(EasyVR::IO1, HIGH); // LED on (listening)
    
    Serial.println("Say command");    
    easyvr.recognizeCommand(1); // set group 16
    while (!easyvr.hasFinished()); // wait for password
    
    /*
    idx_pwd = easyvr.getCommand(); // get recognised password
    
    if (idx_pwd >= 0)
    {
      Serial.print("Password: ");     
      
      if (easyvr.dumpCommand(EasyVR::PASSWORD, idx_pwd, name, train))
      {
        Serial.print(" = ");
        Serial.println(name);
      }
      else
        Serial.println();      
      
      if ( idx_pwd == idx_cmd) // index of username and password are the same, access granted
      {
        Serial.println("Access granted");
      }
      else // index of username and password differ, access is denied
      {
        Serial.println("Access denied");
      }
      
    }
   */   
    
    int16_t err = easyvr.getError();
    
    if (easyvr.isTimeout() || (err >= 0)) // password timeout, access is denied
    {
      Serial.println("Error, try again...");      
    }
  }
  
  else
  {
    if (easyvr.isTimeout()) 
        Serial.println("Timed out, try again...");
      
    int16_t err = easyvr.getError();
    if (err >= 0)
    {
      Serial.print("Error ");
      Serial.println(err, HEX);          
    }
  }
  
    /*
    //Read input
    if (val == 0) {
      connectWS("off");
    } else if (val == 1) {
      connectWS("on");
    }
    */
}

String connectWS(char* action){
  //port 80 is typical of a www page
    if (client.connect(server, 80)) {
      Serial.println("connected");
      client.println("GET /index.php?action=" + (String)action + " HTTP/1.0");
      client.println("Connection: close");
      client.println();
      disconnectWS();
    }
}
  
String disconnectWS() {
  delay(10);
  Serial.println("disconnecting.");
  Serial.flush();
  client.stop();
}

i have a problem with the ethernet and the easyvr Shield.

"the ethernet (shield)" is a common commodity. "the easyvr Shield" is not.

Post a link to it is you expect us to determine what pins it uses, and what conflicts there are with the other pins you are using.

Depending on the J12 setting, the EasyVR shield uses pins 0/1 or 12/13. How have you got J12 set?

i used J12 in SW mode (pins 12-13)

Then there's your problem.

#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

Then there's your problem.

That's only one of the problems. The Ethernet shield uses SPI to communicate with the Arduino, on pins 11, 12, and 13.

The Ehternet shield and that shield are simply incompatible, if you (try to) use pins 12 and 13.

Of course, using the hardware serial pins will cause other issues.

Thx for the answer.

Can i use other pi to communicate ?

Can i use other pi to communicate ?

To communicate from what to what?

You need to post a link so we are all looking at the same thing/documentation.

That's only one of the problems.

Yes, meant to include this line too...

 * Ethernet shield attached to pins 10, 11, 12, 13

PaulS:

Can i use other pi to communicate ?

To communicate from what to what?

You need to post a link so we are all looking at the same thing/documentation.

I would to use ethernet shield and easyvr in same time.....

The goal of the project is to turn on a light with the voice.

When then voice command is recognized, an http request is made...

I clicked on that "link". Nothing happened. The site must be down. I'll try again later.

Hi,
Here is the solution for an easyvr board and an Arduino with Ethernet Shield:

  • You must put your easyvr shield un SW mode
  • you must change your code like this:
  • NewSoftSerial port(12,13); => NewSoftSerial port(2,3);
  • bridge.loop(0, 1, 12, 13); => bridge.loop(0, 1, 2, 3);
  • And finally:
  • connect pin 12 from the easyvr shield to pin 2 of your Arduino
  • connect pin 13 from the easyvr shield to pin 3 of your Arduino
  • connect +5v from the easyvr shield to +5v of your Arduino
  • connect GND from the easyvr shield to GND of your Arduino
  • connect RESET pin from the easyvr shield to RESET pin of your Arduino

For me, it's working like a charm.
Regards,

Jmi

Hi,

i tried your solution, but it doesn't work for me. (Easyvr is in SW Mode, all cables have been placed correctly.)
Everytime I change the connection of pin 12 & 13 from easyvr shield to other pins (e.g. 2 & 3) the easyvr could not be found any more.

I also changed my sourcode to:

SoftwareSerial port(2,3);
bridge.loop(0, 1, 2, 3);

My serial Monitor always shows "EasyVR not detected!"

So what can i do to user easyVR shield together with Ethernet Shield ?

Thanks.
Hawk78

Hi,

Maybe not relevant any more but this worked for me:

/*
To use both ethernet shield and EasyVR shield:
Arduino Wire EasyVR
reset blue reset
3.3v ---- 3.3v
5v red 5v
gnd orange gnd
D2 green D12
D3 yellow D13

EasyVR
J12 SW
*/

And adjust the code at 3 places:

//Due to ethernet shield working on 10,1,12,13
//Move EasyVR to 2,3
//SoftwareSerial port(12,13);
SoftwareSerial port(2,3);

//Due to ethernet shield working on 10,1,12,13
//Move EasyVR to 2,3
//NewSoftSerial port(12,13);
NewSoftSerial port(2,3);

//Due to ethernet shield working on 10,1,12,13
//Move EasyVR to 2,3
//bridge.loop(0, 1, 12, 13);
bridge.loop(0, 1, 2, 3);

Rgds
Robert