Go Down

Topic: Servos jumping to max position (Read 2088 times) previous topic - next topic

Hello guys, I am working on a quadruped project with 8 servos and whenever I try to run more than 3-4 servos every servo in the system jumps to the maximum position and stops there. Even I readjust one manually it jumps to max pos again. Only way to fix it is remove all servos from the breadboard and relink them and it happens again if i run more than 3-4. Could this be a battery problem? I use 4 AA batteries (6v total), this issue started after i used the servolibrary with slowmove. Can batteries be depleted so quickly? (I didnt run more than 5-6 and total running time is like 30-40 minutes, could that deplete the 4 batteries?)

Code: [Select]
// Sweep
// by BARRAGAN <http://barraganstudio.com>
// This example code is in the public domain.


#include <VarSpeedServo.h>

VarSpeedServo myservo1;
VarSpeedServo myservo2;
VarSpeedServo myservo3;
VarSpeedServo myservo4;
VarSpeedServo myservo5;
VarSpeedServo myservo6;
VarSpeedServo myservo7;
VarSpeedServo myservo8;
unsigned long leg1timer;
unsigned long leg2timer;
unsigned long leg3timer;
unsigned long leg4timer;
void setup()
{
  myservo1.attach(2);
  myservo2.attach(3);
  myservo3.attach(4);
  myservo4.attach(5);
  myservo5.attach(6);
  myservo6.attach(7);
  myservo7.attach(8);
  myservo8.attach(9);  // attaches the servo on pin 9 to the servo object
  leg1timer=millis();
  leg2timer=millis();
  leg3timer=millis();
  leg4timer=millis();

}


void leg1forward()
{
leg1timer = millis ();
myservo2.write(80);
myservo1.slowmove(120,60);

delay(600);
myservo2.write(60);
myservo1.slowmove(40,20);

 
}
 

void leg2forward()
{
leg2timer = millis ();
myservo4.write(80);
myservo3.slowmove(40,60);
delay(600);
myservo4.write(60);
myservo3.slowmove(120,20);
 




void leg3forward()
{
leg3timer = millis ();
myservo6.write(80);
myservo5.slowmove(20,60);
delay(600);
myservo6.write(60);
myservo5.slowmove(100,20);
 



void leg4forward()
{
leg4timer = millis ();
myservo8.write(80);
myservo7.slowmove(100,60);
delay(600);
myservo8.write(80);
myservo7.slowmove(20,20);
 
}



void loop()
{
if ( (millis () - leg1timer) >= 2000)
     leg1forward();
     
if ( (millis () - leg3timer) >= 2000)
     leg3forward();


if ( (millis () - leg2timer) >= 2000)
     leg2forward();
     

if ( (millis () - leg4timer) >= 2000)
     leg4forward();


}


This is the code I use

JimboZA

It might be that the batteries can't provide enough current to drive more than 3 motors at once.

Try with a second battery pack and run 2 groups of 3 motors to see if that works, then try 2 groups of 4. Maybe you'll need three groups, 3, 3 and 2.
No PMs for help please.
Arduino with e'net at http://jimboza.gotdns.com:8085/
DO NOT power servos from Arduino 5V: give them their own power and connect the grounds.

Yeah, probably the batteries cannot provide enough current as they're basic cheap aa batteries. So what can I do to improve the current and lifespan without changing the voltage? (lithium batteries???)

For powering lots of servos I use Lipo batteries (2S - 3S) with UBECs to drop the voltage.
www.bajdi.com

oric_dan

#4
Sep 18, 2013, 05:51 pm Last Edit: Sep 18, 2013, 05:56 pm by oric_dan Reason: 1
From what I've seen, some servos do jump over to the mechanical stops when the battery voltage drops too low. However, I use NiMH AA-cells, 2200-2500 mAh, on my walkers, and they will handle 8 servos easily, in general. At least the smaller servos. If the servos are over 100 oz-in of torque, they draw a lot current, and will drag the battery down faster.

Also, I wouldn't expect much more than 30-40 min running time for the typical walker. Time for you to do some serious measurements on your energy requirements. Instantaneous current draw, integrated over time, etc.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy