Hi,
I am using Motor Shield V2 on an Arduino Mega.
I have 2 servos attached which where working fine when tested alone. I am using the PWMServo library as I have 2 NeoPixel rings connected to pin 52 and 53.
Now I added an external 12V DC (2x6V in series) supply and 4 x GHM-16 motors (http://www.lynxmotion.com/p-653-gear-he ... shaft.aspx).
After successfully testing the DC motors, the Servos stopped working. This is the case with DC supply disconnected / connected and with VIN Jumper on and off. Would appreciate some help on this.
Thanks
Michael
Motor Shield v.2 - suddenly servos stopped responding
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- azzopardim
- Posts: 9
- Joined: Tue Aug 19, 2014 10:04 am
- adafruit_support_bill
- Posts: 88092
- Joined: Sat Feb 07, 2009 10:11 am
Re: Motor Shield v.2 - suddenly servos stopped responding
It sounds like you changed a lot of things between the time when the servos worked and the time when they stopped working. Go back to the original configuration and see if the servos are still working. When integrating systems, it is best to change one thing at a time. That way, if something stops working, you know which change caused the problem.I have 2 servos attached which where working fine when tested alone. I am using the PWMServo library as I have 2 NeoPixel rings connected to pin 52 and 53.
Now I added an external 12V DC (2x6V in series) supply and 4 x GHM-16 motors (http://www.lynxmotion.com/p-653-gear-he ... shaft.aspx).
After successfully testing the DC motors, the Servos stopped working. This is the case with DC supply disconnected / connected and with VIN Jumper on and off.
- azzopardim
- Posts: 9
- Joined: Tue Aug 19, 2014 10:04 am
Re: Motor Shield v.2 - suddenly servos stopped responding
That's what I have been trying to do since I submitted the post. Looks like it is something related to the PWMServo library. When I test with Servo library the servos work. Could there be something related to the external DC or the DC motors attached to the MotorShield that could be affecting PWMServo ? The problem with the standard Servo library is that the NeoFruit Rings was causing interrupt issues with the servos.
- adafruit_support_bill
- Posts: 88092
- Joined: Sat Feb 07, 2009 10:11 am
Re: Motor Shield v.2 - suddenly servos stopped responding
Good. Since then, you have added both DC motors and Neopixels. Which one of those additions caused the servos to stop working?When I test with Servo library the servos work.
Once you have determined which of those additions causes the problem, post the minimum code needed to reproduce the problem.
- azzopardim
- Posts: 9
- Joined: Tue Aug 19, 2014 10:04 am
Re: Motor Shield v.2 - suddenly servos stopped responding
Servo + NeoPixels worked fine together with PWMServo library.
Just the DC Motors. I exclude the code as I have a test program just running the servo and that did not work either.
I am suspecting that its the noise from the DC motors. Added 104k capacitors and will do rewiring again tomorrow to validate that hypothesis.
Just the DC Motors. I exclude the code as I have a test program just running the servo and that did not work either.
I am suspecting that its the noise from the DC motors. Added 104k capacitors and will do rewiring again tomorrow to validate that hypothesis.
- azzopardim
- Posts: 9
- Joined: Tue Aug 19, 2014 10:04 am
Re: Motor Shield v.2 - suddenly servos stopped responding
BTW ... thanks for the support on a Sunday night. Highly appreciated.
- azzopardim
- Posts: 9
- Joined: Tue Aug 19, 2014 10:04 am
Re: Motor Shield v.2 - suddenly servos stopped responding
OH my....
it's the PWMServo library. Not working with the MotorShield.
I am trying to use this one http://arduiniana.org/libraries/pwmservo/ based on the info here https://learn.adafruit.com/adafruit-neo ... ced-coding.
Are you aware of any issues with this library and the shield ?
it's the PWMServo library. Not working with the MotorShield.
I am trying to use this one http://arduiniana.org/libraries/pwmservo/ based on the info here https://learn.adafruit.com/adafruit-neo ... ced-coding.
Are you aware of any issues with this library and the shield ?
- azzopardim
- Posts: 9
- Joined: Tue Aug 19, 2014 10:04 am
Re: Motor Shield v.2 - suddenly servos stopped responding
This is the sample code:
#include <PWMServo.h>
PWMServo servo_pan; // create servo object to control a servo
PWMServo servo_tilt; // create servo object to control a servo
int val; // variable to read the value from the analog pin
void setup()
{
servo_pan.attach(9);
servo_tilt.attach(10);
}
void loop()
{
servo_pan.write(90);
servo_tilt.write(135);
delay(1000);
for (int p=1; p++; p <=180) {
servo_pan.write(p);
delay(100);
}
}
#include <PWMServo.h>
PWMServo servo_pan; // create servo object to control a servo
PWMServo servo_tilt; // create servo object to control a servo
int val; // variable to read the value from the analog pin
void setup()
{
servo_pan.attach(9);
servo_tilt.attach(10);
}
void loop()
{
servo_pan.write(90);
servo_tilt.write(135);
delay(1000);
for (int p=1; p++; p <=180) {
servo_pan.write(p);
delay(100);
}
}
- azzopardim
- Posts: 9
- Joined: Tue Aug 19, 2014 10:04 am
Re: Motor Shield v.2 - suddenly servos stopped responding
Can I use Adafruit_PWMServoDriver.h with the MotorShield attached servos or should I be considering getting a separate servo shield to avoid the issue of interrupts and the conflict with NeoPixels, Would you know if there are known compatibility issues if both a MotorShield v2 and ServoShield are running on the same Arduino ? Like this I will avoid using the Servo.h library.
Please be positive and constructive with your questions and comments.