Pages: [1]   Go Down
Author Topic: Servo Twitching in an Arm  (Read 1775 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello, I'm using a total of 6 servos in a Lynxmotion arm, and they twitch when the arm is holding its position, specifically the "shoulder joint"

let me explain, from tip to base of the arm

controlling the gripper on top is a small servo that never twitches
controlling the "wrist" joint below is a normal servo (same as other 5) that never twitches
controlling the "elbow" joint is another normal servo that never twitches
controlling the "shoulder" joint are TWO normal servos that twitch MOST OFTEN
controlling the "base" rotate is another normal servo that twitches LESS OFTEN

The ONLY servos that twitch are those in the shoulder and the rotating base.

I was thinking that it's because the weight of the arm causes the arm to droop, and the servo twitches when it corrects that droop to maintain the degree set in the code.

does that sound right, or is it something else I can fix? i have 3 of the servos powered by the 5v on the arduino, and the other 3 powered by an external 5v power supply, tapping directly from the same battery that powers the arduino.

I can post code if necessary, but i'm just using a playstation 2 controller and having the input from that sequentially increase a "position" variable for each joint.

i'm using degrees instead of microseconds... would microseconds be better?

Thanks for your help!
Logged

0
Offline Offline
Tesla Member
***
Karma: 114
Posts: 8919
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
i have 3 of the servos powered by the 5v on the arduino, and the other 3 powered by an external 5v power supply, tapping directly from the same battery that powers the arduino.

Powering other than a micro servo from an arduino will typically produce bad results. You probably need to follow Lynxmotion's recomendations for powering the arm. A typical servo under strain can draw 1a+ in current. 
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Powering other than a micro servo from an arduino will typically produce bad results. You probably need to follow Lynxmotion's recomendations for powering the arm. A typical servo under strain can draw 1a+ in current.

The servos that power the shoulder are connected into the dedicated power supply, and those are the ones that twitch (they still twitch when plugged into the Arduino as well).  I added in the additional power supply because the Arduino was rebooting under too much load from the servos. Adding the power supply did fix that problem. 

Thanks for the reply

edit. by the way, I used to power the arm with lynxmotion's instructions, and it twitched even worse, even with the help of an sc-32 ( or maybe slightly different numbers) servo controller and a Basic Micro controller.
« Last Edit: June 17, 2011, 06:37:57 pm by chambo622 » Logged

0
Offline Offline
Tesla Member
***
Karma: 114
Posts: 8919
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
and the other 3 powered by an external 5v power supply, tapping directly from the same battery that powers the arduino.

What is your battery? Hope it isn't four AA batterys. Also 5v is only .2v above the usual recomended 4.8v-6v servo supply voltages. Best  to measure your power supply voltages while the servos are twitching to see what they actually are. Could be bad code, but the usual suspect is inadequate power.
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
What is your battery? Hope it isn't four AA batterys. Also 5v is only .2v above the usual recomended 4.8v-6v servo supply voltages. Best  to measure your power supply voltages while the servos are twitching to see what they actually are. Could be bad code, but the usual suspect is inadequate power.

My battery is a sealed lead acid battery at 1.3 amp-hours, and the current coming out of my transformer is 5.11 volts under the load of just the two twitching shoulder servos.

With all other servos unplugged from the Arduino, and the only servos connected to power being the shoulders into the transformer, they still twitch.

If I unplug the signal wire from the Arduino, the servos completely die and are limp.

Here's the code for the servos, which works fine other than twitching.

Position is initialized like this (values are where I want them to start)

Code:
Servo gripper;
Servo wrist;
Servo elbow;
Servo shoulder;
Servo base;

int gripperPos = 106;
int wristPos = 90;
int elbowPos = 150;
int shoulderPos = 140;
int basePos = 90;

They are later called upon like this:
Code:
if(ps2x.Button(PSB_PAD_UP))
    {
      Serial.println("up pressed");
      loop;{
      shoulderPos+=2;
      if(0 < shoulderPos < 180){
        shoulder.write(shoulderPos);
      }
      if(shoulderPos > 180){
        shoulderPos = 180;
        shoulder.write(shoulderPos);
      }
      if(shoulderPos < 0){
        shoulderPos = 180;
        shoulder.write(shoulderPos);
      }
      } 
    }
     
  if(ps2x.Button(PSB_PAD_DOWN))
   {
     Serial.println("down pressed");
     loop;{
      shoulderPos-=2;
      if(0 < shoulderPos < 180){
        shoulder.write(shoulderPos);
      }
      if(shoulderPos > 180){
        shoulderPos = 0;
        shoulder.write(shoulderPos);
      }
      if(shoulderPos < 0){
        shoulderPos = 0;
        shoulder.write(shoulderPos);
      }
      } 
    }

Logged

0
Offline Offline
Tesla Member
***
Karma: 114
Posts: 8919
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

As you don't show all your code (are you using the servo library?), below is some simple servo test code you can try on the servos having issues to see if it could be your code.

Quote
With all other servos unplugged from the Arduino, and the only servos connected to power being the shoulders into the transformer, they still twitch.

So the servos having issues are powered via a "transformer" and the servos powered from the battery work ok? Have you tried powering the twitching servos from the battery to see if they still twitch?

Code:
// zoomkat 10-4-10 serial servo test
// type servo position 0 to 180 in serial monitor
// for writeMicroseconds, use a value like 1500
// for IDE 0019 and later
// Powering a servo from the arduino usually DOES NOT WORK.

String readString;
#include <Servo.h>
Servo myservo;  // create servo object to control a servo

void setup() {
  Serial.begin(9600);
  myservo.writeMicroseconds(2000); //set initial servo position if desired
  myservo.attach(7);  //the pin for the servo control
  Serial.println("servo-test-21"); // so I can keep track of what is loaded
}

void loop() {

  while (Serial.available()) {
    delay(1); 
    if (Serial.available() >0) {
      char c = Serial.read();  //gets one byte from serial buffer
      readString += c; //makes the string readString
    }
  }

  if (readString.length() >0) {
    Serial.println(readString);  //so you can see the captured string
    int n;
    char carray[6]; //converting string to number
    readString.toCharArray(carray, sizeof(carray));
    n = atoi(carray);
    myservo.writeMicroseconds(n); // for microseconds
    //myservo.write(n); //for degees 0-180
    readString="";
  }
}
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the code, i'll try this shortly, the microseconds seem interesting. and Yes, I was using the servo library.

The "transformer" i referred to is the SAME battery powering the Arduino. on 3 of the servos (when they were plugged in, they aren't now), i plugged them in to 5v and ground on the arduino.

on the other 3, I took a small 12v --> 5v converter, and connected that to the same lead acid battery, but regardless of where I plug in the shoulder servos (arduino or transformer), they twitch.

A recent discovery I had though, was if I took an external power supply and connected them, I can power it from 4.7 all the way to about 5.2 and it will not twitch; at 5.2 and above it twitches. a lot. and increasingly so.

What would make these servos so shy of power?

btw. is transformer the right word?

Thanks
Logged

0
Offline Offline
Tesla Member
***
Karma: 114
Posts: 8919
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
The "transformer" i referred to is the SAME battery powering the Arduino.

That really doesn't make any scense. Transformers are usually associated with AC power supplies and are not batterys.
Quote
I took a small 12v --> 5v converter

Can you give the technical details of this converter?

Quote
A recent discovery I had though, was if I took an external power supply and connected them, I can power it from 4.7 all the way to about 5.2 and it will not twitch; at 5.2 and above it twitches. a lot. and increasingly so.

Can you give the technical details of this power supply? What are the numbers refering to? You might want to do some reading at the below link.

http://www.lynxmotion.net/viewforum.php?f=6&sid=100db4e42267b9b2aa4c21c69fc22e31
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16514
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, you are not using good terminology to describe your power method. We will need either proper words, or drawings, or maybe even pictures. It sounds like you are having a power problem, but it's hard to determine what to tell you from your description of what you are using.

Lefty
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK sorry, let me be insanely clear. I ripped this power downscaler from a USB car charger, and it gives off 5.1 volts when connected directly to the same 12v battery as the arduino.

Lynxmotion forum is irrelevant, they are hitec servos and all lynxmotion made was the arm pieces.

I figured out that one of my shoulder servos, and also the base, was a whimp. I replaced them in testing and its all good. The previous, lamesauce servo from the shoulder easily succumbs to pressure and twisting on the arm, causing it to twitch. I don't think its a gear slip, maybe a weak motor. Regardless, I've fixed the issue by replacing the servos. My only question now is how to avoid this deterioration of motors in the future.

Thanks both of you for your help, what's the proper term for what I used?

In terns of limiting strain on the motors, you can see in my code I won't let them go past 180, should that value be 175?

Thanks
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16514
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
In terns of limiting strain on the motors

Strain, (load actually) on a servo motor is all about the mechanical load attached to the servo, is it balanced at the servo axis? If not is the unbalanced torque load within the max torque specification of your specific servo? The power (current draw) consumed by the servo is proportional to the mechanical load placed on the servo and how often and fast you have it move. No load, very little current consumed, lots of load, lots of current consumed. Too much load and motor may stall and draw locked rotor current. A little more servo torque can be had by running them at their max voltage, usually +6vdc, assuming the voltage source can also provide the peak current demand of the servo when turning the load.

I don't expect you to be able to answer all these questions, asked more so you can understand that it's hard for anyone else to answer them also.


Lefty
« Last Edit: June 18, 2011, 01:29:17 am by retrolefty » Logged

nj. usa
Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

having many years in RC vehicles (cars, planes, helis) servo twitch can be from the following problems.

1:
bad signal.
try plugging in another servo to the "shoulder" servo spot if this does not twitch then signal is probably good.

2:binding/loose mechanics.
 if there is a rough spot in the mechanics the servo could be hitting that, "springing" forward then having to reverse direction to center. or a loose joint can cause a "pendulum" effect, bouncing the servo off center.

3:"Bad power"
is this power supply putting out clean DC power or is it not filtered.. try adding a capacitor to the power supply.

4:bad servo
I have had one servo backfeed noise down the line and cause weird problems for the other servos.
try eliminating one servo from the system at a time.
Logged

Pages: [1]   Go Up
Jump to: