Go Down

Topic: More than 1 servo (Read 668 times) previous topic - next topic

CaptRR

Aug 12, 2012, 05:30 pm Last Edit: Aug 12, 2012, 05:42 pm by CaptRR Reason: 1
Hello,

I think I must be missing something simple, but I can't seem to get more than one servo going

I have a PT785-S from servo city.  I hooked it up to the arduino.  I am using a seperate power source to drive the servo's, but can only move one servo (pin 9).  If I swap y and z sero pins the other sero works.  Its almost like I can't get the arduino working on more than one pin at a time.

Here is my code below

Quote

#include <Servo.h>


Servo yservo;  // create servo object to control a servo
Servo zservo;




void setup()
{
 Serial.begin(9600);
 yservo.attach(9);  // attaches the servo on pin 9 to the servo object \
 zservo.attach(10);

}


void loop()
{
 Serial.write("Start y-------");
 yservo.write(0);  
 delay(500);
 yservo.write(180);  
 delay(1000);
 
 Serial.write("Start z-------");
 zservo.write(0);  
 delay(500);
 zservo.write(180);  
 delay(1000);
}


DuaneB

Hi,

Looks fine, check your wiring and check that you have a common ground connection between the two power sources

Duane B
Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

CaptRR


Hi,

Looks fine, check your wiring and check that you have a common ground connection between the two power sources

Duane B


I was thinking the same thing, so I double checked, and I do have the common ground between my power supply and the ground on the arduino.  Another note on this, no matter what I do only pin 9 seems to work for driving the servo.  I have tried this on both a duemilanove and a mega 2560.  For some reason no other pin will drive the servo.  In fact the non working servo doesn't even hold, its like theirs no signal going to it at all.


MarkT


In fact the non working servo doesn't even hold, its like theirs no signal going to it at all.




Then maybe that servo isn't getting power?.  It will hold without a signal I think.  Anyway either its a wiring problem or you've burnt-out pin 10.  Easy to test either hypothesis with multimeter.
[ I won't respond to messages, use the forum please ]

wildbill

Quote
I have tried this on both a duemilanove and a mega 2560


Then it seems likely that it's a wiring issue - how have you got it all connected?

CaptRR



In fact the non working servo doesn't even hold, its like theirs no signal going to it at all.




Then maybe that servo isn't getting power?.  It will hold without a signal I think.  Anyway either its a wiring problem or you've burnt-out pin 10.  Easy to test either hypothesis with multimeter.



I went ahead and put a scope on pin 10, and I'm not seeing anything on it.  Thinking that I might have a burned out pin like you said, I set it up to digital out, and had it pulse every second or so.  It seemed to work fine, I could see the changing state on the scope.

I then plugged both servo's onto the same pin, and both servo's run fine in parallel, so it doesn't look like a wiring problem.  Again, it seems like only pin 9 is able to send out pulse width.  I think I have a netduino around here somewhere, I 'll grab that and test it, and see if I can get them moving on separate pins with it.  If it works, I think that pretty much eliminates the wiring as a cause.

Msquare

OK, so you have tested with pin 9 and 10. What abouth the other 10 output pins?

CaptRR


OK, so you have tested with pin 9 and 10. What abouth the other 10 output pins?


Yep, on the mega I ran it on pi 3,4,5,7, 10, 11, and 13.  No PWM on any of them.  Even when I comment out all the yservo stuff (pin 9 servo), and just use the other pins I get nothing.  This is really confusing.

Msquare

So... either you have a very bad/burned AVR-chip or your wiring is wrong or faulty - bad powersupply, a loose connection, unexpected short. (Possibly one servo is bad, messing up activity the other one)

Suggestion. Rebuild it. Take all wires off, rewire, cleaner, more carefully.

Go Up