5

I'm trying to use the Ethernet Shield and the EasyVR (voice recognition) together. The Ethernet shield uses the same pins that the EasyVR, but the easyVR works fine if I don't call Ethernet.begin(). Is there a way to disconnect the ethernet shield in order to be able to use the EasyVR again?

I haven't seen any method like "release" or "disconnect" in the Ethernet's class.

Thanks!

4
  • EasyVR only uses pins 0 and 1 (UART) (or 12 and 13 if SW-serial is selected). The ethernet shield doesn't seem to use those at all (only SPI and a few other digital pins). Seems more likely that the two libraries are conflicting with each other.
    – Gerben
    Commented Jul 5, 2015 at 12:06
  • Oh! okay thanks!. But it works if I import all the libraries needed. The easyvr stops working when I use the Ethernet for the first time. So I wonder if I can disconnect the Ethernet shield after using it. Thanks Commented Jul 5, 2015 at 12:24
  • 1
    What happens after you call Ethernet.begin()? Also, are you sure that your board has enough memory? Commented Jul 20, 2015 at 0:01
  • I'm using the same system, how can I define new ports for easyVR? Thanks.
    – user19418
    Commented Mar 19, 2016 at 18:52

1 Answer 1

3

You have correctly determined the root of the problem, both shields are trying to use the same pins. To work around this we need to know which pins are being used, and for what.

The Ethernet Shield documentation reveals the following:

The Arduino board communicates with the shield using the SPI bus. This is on digital pins 11, 12, and 13 on the Uno and pins 50, 51, and 52 on the Mega. On both boards, pin 10 is used as SS. On the Mega, the hardware SS pin, 53, is not used to select the Ethernet controller chip, but it must be kept as an output or the SPI interface won't work.

https://www.arduino.cc/en/Reference/Ethernet

The documentation for Sparkfun's EasyVR library isn't as explicit, but one of the examples gives us another clue:

#if defined(__SAMD21G18A__)
  // Shield Jumper on HW (for Zero, use Programming Port)
  #define port SERIAL_PORT_HARDWARE
  #define pcSerial SERIAL_PORT_MONITOR
#elif defined(SERIAL_PORT_USBVIRTUAL)
  // Shield Jumper on HW (for Leonardo and Due, use Native Port)
  #define port SERIAL_PORT_HARDWARE
  #define pcSerial SERIAL_PORT_USBVIRTUAL
#else
  // Shield Jumper on SW (using pins 12/13 or 8/9 as RX/TX)
  #include "SoftwareSerial.h"
  SoftwareSerial port(12, 13);
  #define pcSerial SERIAL_PORT_MONITOR
#endif

#include "EasyVR.h"

EasyVR easyvr(port);

EasyVR-Arduino/examples/TestEasyVR/TestEasyVR.ino

This block of code is determining how to set up the serial communication. The first two if statements are for different boards, but the third one sets up the software serial connection... and it says there are two options, pins 12/13 OR 8/9! If there are two options, there must be a way to switch it on the board itself.

enter image description here

And sure enough! Check out that white box labeled "SW Serial Pins". Jackpot!

Here's what the manual has to say:

On the bottom side of the board there are two SMD resistors that you can move to select the two pins of Arduino that the EasyVR will be connected to when in Software Serial mode (Mode Jumper on SW).

  • RX – Software Serial Receiver pin
    • D12 – Use digital pin 12 as serial receiver (default)
    • D8 – Use digital pin 8 as serial receiver
  • TX – Software Serial Transmitter pin
    • D13 – Use digital pin 13 as serial transmitter (default)
    • D9 – Use digital pin 9 as serial transmitter

The choice of pins 12-13 is maintained for backward compatibility with the previous hardware revisions of the EasyVR Shield. However those pins may also be used for the SPI interface, so another choice of pins 8- 9 is provided. If you want to use different pins make sure the receiver pin supports change interrupts.

2
  • the question is from 2015 when the EasyVR had only the pins 12 and 13 for SW Serial
    – Juraj
    Commented Nov 29, 2018 at 20:33
  • I excited because this question popped up on "unanswered", but you're totally right. I didn't realize it was 3 years old. :-/
    – djbeadle
    Commented Nov 29, 2018 at 22:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.