I am a newbie to electronics, microcontrollers and arduino. So please go easy on me.
I am building a small robot and am using the following components for it.
Pololu Qik2s9v1 motor controller with a couple of micro motors for movement. I am using the PololuQik class library to drive the controller
2 Servos with pan and tilt bracket for sensor mount. I am using the Servo class library to drive the servos
Sharp IR distance sensor for object detection
I am just starting to put this thing together, but I am having the following problem. Whenever I call the PololuQik class to set the motor speed it causes the servo's to pulse and sometimes the board locks up or resets.
My thoughts on the cause at this stage are the following;
There is a software conflict between the Servo class library and the PololuQik class library
I need to use some kind of pull down resistor on the servo signal pin to remove noise
Can someone give me some advice on how to start trouble shooting the problem.
I am just starting to put this thing together, but I am having the following problem. Whenever I call the PololuQik class to set the motor speed it causes the servo's to pulse and sometimes the board locks up or resets.
Did you notice what part of the forum you were posting in? Where's your code?
I hope someone can give me some pointers.
Well, sure. When you post in the programming section, we expect to see your code. No code == no help!;
// Sweep
// by BARRAGAN <http://barraganstudio.com>
// This example code is in the public domain.
#include <Servo.h>
#include <PololuQik.h>
#include <SoftwareSerial.h>
Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created
PololuQik2s9v1 qik(2, 3, 4);
int pos = 0; // variable to store the servo position
void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
qik.init();
}
void loop()
{
for(pos = 0; pos < 127; pos += 1) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
//myservo.write(pos); // tell servo to go to position in variable 'pos'
qik.setM0Speed(pos);
delay(15); // waits 15ms for the servo to reach the position
}
for(pos = 127; pos>=1; pos-=1) // goes from 180 degrees to 0 degrees
{
//myservo.write(pos); // tell servo to go to position in variable 'pos'
qik.setM0Speed(pos);
delay(15); // waits 15ms for the servo to reach the position
}
}
I have taken the example Servo code, added the PololuQik library, instantiated a PololuQik object. Whenever a call to qik.setM0Speed or qik.setM1Speed is called the servo will pulse or rotate.
This even happens when I disconnect the motors from the motor controller board.
I was hoping someone had experienced this and could offer some advice on where to start debugging this as I am sure its a software issue.
So I thought I would report my findings for others benefit.
PololuQik library uses/extends the SoftwareSerial class. Arduino IDE 1.0 seems to introduce a conflict between the SoftwareSerial and Servo class. It's apparently an interrupt issue, I'm not 100% on the exact cause of the conflict.