Qik 2s9v1 Resetting to initial state

I am using a Qik 2s9v1 to drive the Pololu tank chassis. The motor controller is controlled by an Arduino Uno.

I am powering the Arduino via USB. I connect the 5V out of the Arduino to the VCC on the Qik and connect the ground of the Qik to the Ground on the Arduino. I connect the reset pin of the Qik to digital pin 7 on the Arduino. I connect digital pin 1 of the Arduino to the Qik Rx pin.

I then run a simple program that sends the Qik 0xAA.

I can verify that the Qik will exit from the initial mode (green LED blinking every 0.4s) to the operating mode (blinking every 2s). However, when I send the Qik a command after this it goes back to the initial mode blinking every 0.4s.

I am somewhat confused and not sure what to try. I can confirm that this happens independently of whether the Arduino is powered by the USB or a 9v battery. This behavior is also independent of whether the Qik is connected to one or two of the motors and connected to motor voltage (a different 9v battery - 6 AA batteries in series).

I can confirm that demo mode of the Qik works as it should - the controller alternately drives the motors whilst lighting the red and green LEDs on and off as documented.

Here is the code:
There is a 1 second delay between issuing the start byte and then attempting to drive the motor. During this time it’s clear that the controller has left the initial state. If I remove the call to go then it remains blinking the green LED every 2s. Also, subsequent sends of the initial byte also cause to keep blinking the green LED every 2s.

Any help would be appreciated.

Regards,

Owen.

#define resetPin 7

void reset () {
  digitalWrite (resetPin, LOW);
  delay (100);
  digitalWrite (resetPin, HIGH);
  delay (10);
}

void start (){
  Serial.write (170);
}

void go () {
  Serial.write (136);
  Serial.print (127);
}

void setup () {
  pinMode (resetPin, OUTPUT);
  digitalWrite (resetPin, HIGH);
  delay (100);
  reset ();
  delay (100);
  Serial.begin (9600);
  delay (100);
  start ();
  delay (2000);
  go ();
}

void loop () {
}

Sorry - the Serial.print (127) in the code is incorrect, the code is actually a Serial.write (127), I replaced all the Serial.write(0xXX) with Serial.print (0xXX, BYTE), with no difference.

Hi,

I have performed some further debugging and it seems to be time dependent on multibyte calls.

If I add in a delay (2000) between the two Serial.writes in my go function then it works correctly. So, if go () becomes:

void go () {
  Serial.write (0x8C);
  delay (2000);
  Serial.write (0x7F);
}

Then the controller starts to drive the motor, but if go is

void go () {
  Serial.write (0x8C);
  Serial.write (0x7F);
}

Then it resets back to the initial state (with no error LED being set).

If I have any delay less than 1.5 seconds - e.g.

void go () {
  Serial.write (0x8C);
  delay (1200);
  Serial.write (0x7F);
}

Then it will also reset back to the initial state.

This is strange, any ideas what’s causing this? Dodgy soldering? Broken arduino?

I’ll do some more debugging and just see what happens if I stream bytes down the Serial and read them in on my computer - I’ll check to make sure everything is being sent.

All the best,

Owen.

Hello.

It sounds like the qik or Arduino is resetting, which could be caused by a dip in power to either board. There are a few things you can try to help figure out what is going on:

  1. Try your code without any motors connected. Does the qik still appear to reset?
  2. Try sending a command that doesn’t attempt to drive the motors (e.g. set the speed to zero or try to read the error byte).
  3. Program the Arduino to do something distinctive on reset, such as flash the LED, so you can tell if it is resetting.

Do you have access to an oscilloscope you can use to look at the qik’s logic power line?

- Ben

Hi Ben,

It’s been a while since I have had the time to look at this.

The problem happens irrespective of whether I have the motors or the motor batteries connected.

I unfortunately don’t have an oscilloscope

The problem also seems to occur irrespective of command I send - for instance get firmware version or get error byte all set the motor controller to reset unless spaced by delays of around 1 second.

Can you post a picture that shows how everything is connected?

- Ben