Remapping of D11 for using a Motor Driver Shield L293D for Arduino

Hello,

I am using an Arduino Mega 2560 and want to use a Motor Driver Shield (L293D) for Arduino with the MOVI as well. My problem is that the motor driver shield uses pin D11. This means I would have to remap the D10 and D11 used by MOVI, but I am not sure how. I have read the user manual, but I am still not sure how to wire things. Should I just put a wire going from J2 and J3 to pins 18 (TX) and 19 (RX)? Or to somewhere else? Also, would I have to change anything in the code?
*Edit: If you could please upload a picture or video of how to do the wiring, that would be really helpful. Thank you.

Thanks

Since you are using a Mega 2560, I highly recommend to use Jumper 2 and Jumper 3 on MOVI to change from software serial (D10/D11) and wire yourself up to one of the Hardware serials. This is described in pretty good detail on page 10 of the MOVI user manual.

You can search the user manual for “HardwareSerial” for the alternate initializer, and/or refer to the issue I raised with MOVI’s lead engineer here:

Good luck!

Thank you for your reply. I think I have managed to wire J2 and J3 to pins 14 (TX3) and 15 (RX3) (which I think are hardware serials if I am not mistaken). Do I need to change anything in the code? It is mentioned in the manual and in the github link you sent me that “you need to call the begin method with a bitrate before calling MOVI’s init()
method.”. However, in the manual, the following constructor is used for this: MOVI(bool debugonoff, HardwareSerial *hs). I have tried to use it with no luck. I’ll attach my code in another reply to show what I did. My code is based on the LightSwitch example, since I got familiarised with it.

#include “MOVIShield.h”

#if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_PIC32)
#include <SoftwareSerial.h>
#endif

int redPin = 46;
int bluePin = 44;
int greenPin = 45;
//HardwareSerial begin(); don’t know how to use this
//MOVI recognizer(true, Serial3); Do I put it here or in setup?

void setup()
{
MOVI recognizer(true, Serial3); //This is where I get the problem
pinMode(redPin, OUTPUT);
pinMode(bluePin, OUTPUT);
pinMode(greenPin, OUTPUT);
digitalWrite(greenPin, HIGH);
digitalWrite(bluePin, HIGH);
digitalWrite(redPin, HIGH);
delay(1);
digitalWrite(greenPin, LOW);
digitalWrite(bluePin, LOW);
digitalWrite(redPin, LOW);
delay(1);
Serial3.begin(9600);
recognizer.init();
recognizer.setVolume(45);
recognizer.callSign(“Arduino”);
recognizer.addSentence(“Let there be light”); //Sentence 1
recognizer.addSentence(“Go dark”); // Sentence 2
recognizer.train(); // Train (may take 20seconds)
//*/
if (recognizer.getFirmwareVersion()>=1.1f)
{
recognizer.setSynthesizer(SYNTH_ESPEAK,"-p90 -vf3");
}
}

void loop()
{
signed int res=recognizer.poll();
if (res==1) { // Sentence 1.
digitalWrite(greenPin, HIGH);
digitalWrite(bluePin, HIGH);
digitalWrite(redPin, HIGH);
recognizer.say(“and there was light!”);
}
if (res==2) { // Sentence 2
digitalWrite(greenPin, LOW);
digitalWrite(bluePin, LOW);
digitalWrite(redPin, LOW);
}
}

I will do my best to paste in the relevant parts of my sketch here. A few notes: you have to hack MOVI’s sdcard if you want to use a bitrate other than 9600. This is described starting on page 61 of the MOVI user manual. I recommend it as MOVI will be snappier with the bitrate I use.

My loop() is extraordinarily complicated so I’m not pasting it here. Yours should work, though I highly recommend looking at using a Call Sign. Without a call sign MOVI will be too eager to turn anything you say into a best guess of what it has been trained. My setup sets the call sign to MOVI_sentence_0. Change the string literals to words you want to recognize.

#include "arduino2.h"
#include <Arduino.h>

uint8_t MOVI_THRESHOLD = 3;

MOVI movi(false, &Serial1);

String MOVI_last_words;
char MOVI_last_words_trained[64];

const char MOVI_sentence_0[] PROGMEM = "OKAYMONTEECARLOW";
const char MOVI_sentence_1[] PROGMEM = "SPEED";
const char MOVI_sentence_2[] PROGMEM = "RPM";
const char MOVI_sentence_3[] PROGMEM = "THROTTLE";
const char MOVI_sentence_4[] PROGMEM = "LOOP STATUS";
const char MOVI_sentence_5[] PROGMEM = "FLUIDS";
const char MOVI_sentence_6[] PROGMEM = "OXYGEN";
const char MOVI_sentence_7[] PROGMEM = "PRESSURE";
const char MOVI_sentence_8[] PROGMEM = "TEMPERATURE";
const char MOVI_sentence_9[] PROGMEM = "BATTERY";
const char MOVI_sentence_10[] PROGMEM = "DUTY CYCLE";
const char MOVI_sentence_11[] PROGMEM = "SPARK ADVANCE";
const char MOVI_sentence_12[] PROGMEM = "KNOCKS";
const char MOVI_sentence_13[] PROGMEM = "CYCLE DISPLAY";
const char MOVI_sentence_14[] PROGMEM = "TROUBLE CODES";
const char MOVI_sentence_15[] PROGMEM = "ERRORS";
const char MOVI_sentence_16[] PROGMEM = "MAXIMUMS";
const char MOVI_sentence_17[] PROGMEM = "AVERAGES";
const char MOVI_sentence_18[] PROGMEM = "FAVOURITE SONG";
const char MOVI_sentence_19[] PROGMEM = "RANDOM SONG";
const char MOVI_sentence_20[] PROGMEM = "CANCEL";
const char MOVI_sentence_21[] PROGMEM = "";

const char * const MOVI_sentence_table[] PROGMEM =
{   
  MOVI_sentence_0, MOVI_sentence_1, MOVI_sentence_2, MOVI_sentence_3,
  MOVI_sentence_4, MOVI_sentence_5, MOVI_sentence_6, MOVI_sentence_7,
  MOVI_sentence_8, MOVI_sentence_9, MOVI_sentence_10, MOVI_sentence_11,
  MOVI_sentence_12, MOVI_sentence_13, MOVI_sentence_14, MOVI_sentence_15,
  MOVI_sentence_16, MOVI_sentence_17, MOVI_sentence_18, MOVI_sentence_19,
  MOVI_sentence_20, MOVI_sentence_21
};

void setup() {
  // put your setup code here, to run once:

  Serial1.begin(115200);

  movi.welcomeMessage(false);             // silence MOVI's welcome message
  movi.sendCommand(F("SYSTEMMESSAGES"), F("OFF"));


  movi.init();

  strcpy_P(MOVI_last_words_trained, (char*)pgm_read_word(&(MOVI_sentence_table[0])));
  movi.callSign(MOVI_last_words_trained);

  int i = 0;
  while(strlen_P((char *)pgm_read_word(&MOVI_sentence_table[i])) > 0) {
    strcpy_P(MOVI_last_words_trained, (char *)pgm_read_word(&MOVI_sentence_table[i]));
    
    movi.addSentence(MOVI_last_words_trained);
    ++i;
  }

  movi.train();

  movi.responses(false);                  // silence MOVI's responses

  movi.setThreshold(MOVI_THRESHOLD);    // uncomment and set to a higher value (valid range 2-95) if you have a problems due to a noisy environment.

}

Thank you