Pages: [1]   Go Down
Author Topic: More than 1 servo  (Read 650 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 26
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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);
}

« Last Edit: August 12, 2012, 10:42:53 am by CaptRR » Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

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

Duane B
Logged


0
Offline Offline
Newbie
*
Karma: 0
Posts: 26
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

0
Offline Offline
Shannon Member
****
Karma: 220
Posts: 12700
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

[ I won't respond to messages, use the forum please ]

New Jersey
Offline Offline
Faraday Member
**
Karma: 72
Posts: 3760
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 26
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Copenhagen, Denmark
Offline Offline
Edison Member
*
Karma: 33
Posts: 1228
Have you testrun your INO file today?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
Newbie
*
Karma: 0
Posts: 26
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Copenhagen, Denmark
Offline Offline
Edison Member
*
Karma: 33
Posts: 1228
Have you testrun your INO file today?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: