Arduino + Easy VR + Waveshield = Problem? :(

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
mmm_nibbles
 
Posts: 3
Joined: Thu Dec 26, 2013 12:18 pm

Arduino + Easy VR + Waveshield = Problem? :(

Post by mmm_nibbles »

Hello all I've come to you guys for help!

Basically I want to turn an LED on using voice commands, which is what the Easy VR sheild is for, I have successfully done this with the Easy VR Sheid and the Arduino Uno.

I now wanted the arduino to give a voice command back, so when the arduino turns the LED on it was play a waveshield saying "no problem!" etc. I have previously used a waveshield for something simular with RFID tags so i thought it would work fine with this.

The waveshield is able to play audio fine...just not with the easy VR Shield between the arduino and the waveshield. (I've attached an image so you guys get a better idea.the top bit is the waveshield, the middle is the easy VR and the bottom is the Uno)

In the serial monitor it is saying
"Wave test!
Free RAM: 669
Error: Card init. failed!
SD I/O error: 1, 0
"

I'm guessing there is a connection problem but i'm not sure how to resolve this, any help would be great.

thank you
Attachments
4-up on 26-12-2013 at 16.12.jpg
4-up on 26-12-2013 at 16.12.jpg (213.33 KiB) Viewed 4889 times

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Arduino + Easy VR + Waveshield = Problem? :(

Post by adafruit_support_mike »

It sounds like you have a pin conflict.

The Wave Shield uses pins 10, 11, 12, and 13 to talk to the SD card. Pins 11-13 are the SPI bus, and pin 10 is Chip Select.. it tells the SD card to listen to the bus.

What pins does the EasyVR use?

mmm_nibbles
 
Posts: 3
Joined: Thu Dec 26, 2013 12:18 pm

Re: Arduino + Easy VR + Waveshield = Problem? :(

Post by mmm_nibbles »

Ahh I see. I believe it uses pins 12 and 13 when the jumper is in the SW position. Those are two of the SPI pins that the WiFi shield uses to communicate with the Arduino, Is there anything I can do that you can you can recommend?

https://www.sparkfun.com/products/11002

would something like this help?

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Arduino + Easy VR + Waveshield = Problem? :(

Post by adafruit_support_mike »

Hmm.. how does the Easy VR use pins 12 and 13?

If it's talking to another SPI device, things aren't so bad. SPI is designed to allow multiple devices to share the same bus, and the microcontroller uses the CS signal to decide which device should use the bus at any moment.

If it's using 12 and 13 as general data pins, the go-between shield might help. You'd need to change the pin numbers in the Easy VR code, but the go-between would let you re-route the signals without having to change the physical connections on the Easy VR shield.

We usually design shields so you can reassign the pins for compatibility with other shields, but in this case we need the microcontroller's high-speed SPI hardware, and that only exists on pins 11-13.

mmm_nibbles
 
Posts: 3
Joined: Thu Dec 26, 2013 12:18 pm

Re: Arduino + Easy VR + Waveshield = Problem? :(

Post by mmm_nibbles »

I'm quite new to this but I see in the code for the easy vr shield that the serial ports are 12 and 13. I've tried simply changing these to for example 1 and 2 but it could no longer detect the easy vr shield.

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

Is it not as simple as that? If changing the code doesn't work I will ordered the go-between shield and see if that helps at all

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Arduino + Easy VR + Waveshield = Problem? :(

Post by adafruit_support_mike »

You're on the right track, but the wiring on the shields has to match the numbers in the code.

Reassigning the softwareSerial connection to another set of pins was exactly the right thing to do in the code. The Easy VR's connections are still wired to pins 12 and 13 though. A go-between shield will let you move "what the Easy VR sees as pins 12 and 13" to some other pins on the Arduino though.

The Wave Shield uses pins 2-5 and 10-13. The Arduino IDE uses pins 0 and 1 for the Serial connection, so you have pins 6-9 free for the Easy VR's softwareSerial connection. For the sake of an example, replace 12 and 13 with 5 and 6 in the Easy VR code, and re-route the signals that connect to pins 5 and 6 on the bottom of the go-between shield to pins 12 and 13 on the top of the go-between shield. Then you can stack the shields up as Arduino / Wave Shield / go-between shield / Easy VR and they should all play nicely together.

TheFifthStooge
 
Posts: 2
Joined: Tue Mar 04, 2014 10:33 pm

Re: Arduino + Easy VR + Waveshield = Problem? :(

Post by TheFifthStooge »

I've started a similar project using a lilypad mp3 player and the easyvr. Finally gave up and swapped to an Arduino Uno. I'm still working on getting my code correct since I just started playing with arduinos. Were you ever able to get your project working?

TheFifthStooge
 
Posts: 2
Joined: Tue Mar 04, 2014 10:33 pm

Re: Arduino + Easy VR + Waveshield = Problem? :(

Post by TheFifthStooge »

Finally figured it out. I'll need to get a go between shield but I know the code works. I'll share my code and pics if anyone requests.

kelseymchalffey
 
Posts: 4
Joined: Fri May 02, 2014 2:36 am

Re: Arduino + Easy VR + Waveshield = Problem? :(

Post by kelseymchalffey »

TheFifthStooge wrote:Finally figured it out. I'll need to get a go between shield but I know the code works. I'll share my code and pics if anyone requests.
Hi! I am trying to use the Arduino Uno, Motor Shield, and the EasyVR

I ran into a similar issue as you guys. Can you show me how you fixed it???

Also, is there a library you can change that will keep you from having to change the pins physically?

Thanks!!

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Arduino + Easy VR + Waveshield = Problem? :(

Post by adafruit_support_mike »

Which version of the Motor Shield are you using?

The v2 Motor Shield (which we currently sell) uses I2C for communication with the Arduino, so you shouldn't have to worry about pin conflicts on 11-13.

kelseymchalffey
 
Posts: 4
Joined: Fri May 02, 2014 2:36 am

Re: Arduino + Easy VR + Waveshield = Problem? :(

Post by kelseymchalffey »

adafruit_support_mike wrote:Which version of the Motor Shield are you using?

The v2 Motor Shield (which we currently sell) uses I2C for communication with the Arduino, so you shouldn't have to worry about pin conflicts on 11-13.
motor shield v1.2 from Seeed Studio

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Arduino + Easy VR + Waveshield = Problem? :(

Post by adafruit_support_mike »

Ah.. that's not one of ours, so I don't know what pins it uses. You'll have to check with the folks at Seeed and see what information they have about the pin usage.

kelseymchalffey
 
Posts: 4
Joined: Fri May 02, 2014 2:36 am

Re: Arduino + Easy VR + Waveshield = Problem? :(

Post by kelseymchalffey »

Well, I got the adafruit Motor Shield v2 from y'all now. I don't quite understand how the I2C works..

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Arduino + Easy VR + Waveshield = Problem? :(

Post by adafruit_support_mike »

This tutorial tells you how to hook things up and explains how to use the library: https://learn.adafruit.com/adafruit-mot ... or-arduino

kelseymchalffey
 
Posts: 4
Joined: Fri May 02, 2014 2:36 am

Re: Arduino + Easy VR + Waveshield = Problem? :(

Post by kelseymchalffey »

adafruit_support_mike wrote:This tutorial tells you how to hook things up and explains how to use the library: https://learn.adafruit.com/adafruit-mot ... or-arduino
Ok, I've tried to follow everything. Now I'm having a problem where once I say a command corresponding with the motor shield, it keeps repeating instead of stopping. Do you see where I'm going wrong in the code?

It's the two voice commands at the bottom of the coding, the foldin and foldout.

I'm sorry, I'm very new to this.

Code: Select all

#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 <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_PWMServoDriver.h"
Adafruit_MotorShield AFMS = Adafruit_MotorShield(); 

// Select which 'port' M1, M2, M3 or M4. In this case, M1
Adafruit_DCMotor *myMotor = AFMS.getMotor(3);
// You can also make another motor on port M2
//Adafruit_DCMotor *myOtherMotor = AFMS.getMotor(2);

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

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

enum Group0 
{
  G0_START = 0,
};

enum Group1 
{
  G1_STOP = 0,
  G1_TILTUP = 1,
  G1_TILTDOWN = 2,
  G1_TABLETRIGHT = 3,
  G1_TABLETLEFT = 4,
  G1_TABLETFORWARD = 5,
  G1_TABLETBACK = 6,
  G1_ARMUP = 7,
  G1_ARMDOWN = 8,
  G1_ARMRIGHT = 9,
  G1_ARMLEFT = 10,
  G1_FOLDOUT = 11,
  G1_FOLDIN = 12,
};


EasyVRBridge bridge;

int8_t group, idx;

int tiltup = 2;
int tiltdown = 3;
int tabletright = 4;
int tabletleft = 5;
int tabletforward = 6;
int tabletback = 7;

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(0);

  group = EasyVR::TRIGGER; //<-- start group (customize)
  
  AFMS.begin();  // create with the default frequency 1.6KHz
  //AFMS.begin(1000);  // OR with a different frequency, say 1KHz
  
  // Set the speed to start, from 0 (off) to 255 (max speed)
  myMotor->setSpeed(150);
  myMotor->run(FORWARD);
  // turn on motor
  myMotor->run(RELEASE);
  
  pinMode(tiltup, OUTPUT);
  digitalWrite(tiltup, LOW);
  pinMode(tiltdown, OUTPUT);
  digitalWrite(tiltdown, LOW);
  pinMode(tabletright, OUTPUT);
  digitalWrite(tabletright, LOW);
  pinMode(tabletleft, OUTPUT);
  digitalWrite(tabletleft, LOW);
  pinMode(tabletforward, OUTPUT);
  digitalWrite(tabletforward, LOW);
  pinMode(tabletback, OUTPUT);
  digitalWrite(tabletback, LOW);
}

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);
    }
    
    group = GROUP_1;
  }
}

void action()
{
    switch (group)
    {
    //case GROUP_0:
    //  switch (idx)
    //  {
    //  case G0_START:
        // 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_STOP:
           digitalWrite(tiltup,LOW); 
           digitalWrite(tiltdown,LOW); 
           digitalWrite(tabletright,LOW); 
           digitalWrite(tabletleft,LOW);  
           digitalWrite(tabletforward,LOW); 
           digitalWrite(tabletback,LOW);    
        break;
      case G1_TILTUP:
          digitalWrite(tiltup, HIGH);
          delay(250);
          digitalWrite(tiltup, LOW);
        break;
      case G1_TILTDOWN:
          digitalWrite(tiltdown, HIGH);
          delay(250);
          digitalWrite(tiltdown, LOW);
        break;
      case G1_TABLETRIGHT:
          digitalWrite(tabletright, HIGH);
          delay(2000);
          digitalWrite(tabletright, LOW);
        break;
      case G1_TABLETLEFT:
          digitalWrite(tabletleft, HIGH);
          delay(2000);
          digitalWrite(tabletleft, LOW);
        break;
      case G1_TABLETFORWARD:
          digitalWrite(tabletforward, HIGH);
          delay(250);
          digitalWrite(tabletforward, LOW);
        break;
      case G1_TABLETBACK:
          digitalWrite(tabletback, HIGH);
          delay(250);
          digitalWrite(tabletback, LOW);
        break;
      case G1_ARMUP:
        // write your action code here
        // group = GROUP_X; <-- or jump to another group X for composite commands
        break;
      case G1_ARMDOWN:
        // write your action code here
        // group = GROUP_X; <-- or jump to another group X for composite commands
        break;
      case G1_ARMRIGHT:
        // write your action code here
        // group = GROUP_X; <-- or jump to another group X for composite commands
        break;
      case G1_ARMLEFT:
        // write your action code here
        // group = GROUP_X; <-- or jump to another group X for composite commands
        break;
      case G1_FOLDOUT:
          Serial.print("tick");
          myMotor->run(FORWARD);
          for (idx=0; idx<255; idx++) {
          myMotor->setSpeed(idx);  
          delay(10);
          }
          for (idx=255; idx!=0; idx--) {
          myMotor->setSpeed(idx);  
          delay(10);
          }
          Serial.print("tech");
          myMotor->run(RELEASE);
          delay(1000);
          break;
      case G1_FOLDIN:
          Serial.print("tock");
          myMotor->run(BACKWARD);
          for (idx=0; idx<255; idx++) {
          myMotor->setSpeed(idx);  
          delay(10);
          }
          for (idx=255; idx!=0; idx--) {
          myMotor->setSpeed(idx);  
          delay(10);
          }
          Serial.print("tech");
          myMotor->run(RELEASE);
          delay(1000);
          break;
      }
      break;
    }
}

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”