2s9v1 driving motors

Hello, recently I’ve purchased a 2s9v1 dual motor driver for a line following project with my Arduino. I’m using the suggested coding library, but having trouble getting the motors to actually do something. The demo mode does show each motor independently working as described in the users manual, so there’s not wiring problems there. Below is a simple test code I’ve written to test things with the CompactQik9s2v1 and NewSoftSerial libraries. With the following code, nothing actually happens, I only see the heartbeat led blinking. I also test the motor outputs for voltage and see no activity. I do not have access to an oscilloscope. Thanks in advance!

#include <CompactQik2s9v1.h>
#include <NewSoftSerial.h>

#define rxPin 0
#define txPin 1
#define rstPin 2

NewSoftSerial mySerial =  NewSoftSerial(rxPin, txPin);
CompactQik2s9v1 motor = CompactQik2s9v1(&mySerial,rstPin);

void setup(){
  Serial.begin(9600);
  mySerial.begin(9600);
  motor.begin();
  motor.stopBothMotors();
}

void loop(){
  motor.motor0Forward(127);
  motor.motor1Forward(127);
  delay(1000);
  motor.stopBothMotors();
}

Hello.

The pins you’re using for your software serial happen to be the Arduino’s hardware serial lines, which could be causing problems. What happens if you try using pins other than 0 and 1 for your software serial and qik reset?

- Ben

I’ve thought the same and tried pins 3, 4, 5, but to no avail.

Also, I have tried this on two separate 2s9v1 drivers, both using pins 0,1,2 and 3,4,5 on each. Both run demo modes without any glitches.

For the setup, I’m using 4 AA’s to power the Arduino which also has 3 IR reflectance sensors connected to it on analog pins. To power the 2s9v1, I’m using an 8.4v 700mAh NiMH battery. The logic supply for the driver and the IR sensors are both connected to the 5V output of the Arduino.

Hello.

The demo mode won’t verify that you have the correct wiring between the Arduino and the Qik. Can you describe your wiring between the two? In particular, they should share a common ground.

- Ryan

See below for full wiring diagram. Note: I’ve wired it in digital pins 0,1,2 and 3,4,5 with the same results.

Hello,

It looks like you are connecting TX on the Arduino to TX on the qik. Those are both outputs, so you are shorting them together and potentially breaking things. You should definitely redo this with TX-RX and RX-TX. There is a good comment about that in the qik2s9v1 arduino example.

Also, you are definitely asking for trouble by using the hardware serial lines, which are already used by the Arduino bootloader, and by giving your Arduino less than its minimum input voltage. Why are you not using your higher-voltage batteries to power everything?

-Paul

Oh wow, I totally misread the tx-rx and just connected likes. I see where this could be a problem. I’m going to also move the pins used down three to avoid any problems with the serial lines and report back once this is done. Once I get a connector to power the Arduino, I’ll wire it to a bigger battery. Thanks for all your help!

Swapping the rx and tx connections along with not using Arduino’s serial lines has fixed this problem.

I’m glad to hear you were able to get things working. Thanks for letting us know.

- Ben