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.
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.
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.
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:
Try your code without any motors connected. Does the qik still appear to reset?
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).
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?
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.