Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: nanotechopolis_gr on June 18, 2013, 04:21:24 AM

Title: servo with "parkinson"
Post by: nanotechopolis_gr on June 18, 2013, 04:21:24 AM
hi guys !  i built a robotic arm and at all it seems to be ok but the servo that rotates the whole system suffers from parkinson , you know what i mean when it stop rotating actually is going a lil bit rigth and left!   the problem has to do with the servo or with my code? i have conected it to a digital and analogue exit but nothing happens!  the servo is tower pro sg5010 ! 
Title: Re: servo with "parkinson"
Post by: Pogertt on June 18, 2013, 09:37:42 AM
Smells like the command pulse may be jittering a bit.
Do you have access to an oscilloscope to watch it?

Are you using http://www.arduino.cc/en/Reference/Servo (http://www.arduino.cc/en/Reference/Servo) or did you write your own code?
Title: Re: servo with "parkinson"
Post by: nanotechopolis_gr on June 18, 2013, 10:17:21 AM
thanks for replying   :D  !! no i havent access!

the code isnt  100% by me , only changed some parameters!
i have to mention that the servo is cheap , also i have and a spring servo but everything works ok!
the bad thing is that the" parkinson" servo its difficult to replace it ! what do you suggest?
(sorry for my english )


int servoPin     =  2;   
int minPulse     =  600; 
int maxPulse     =  2400;
int turnRate     =  100;
int refreshTime  =  20;   


int centerServo;       
int pulseWidth;         
int moveServo;           
long lastPulse   = 0;   


void setup() {
  pinMode(servoPin, OUTPUT); 
  centerServo = maxPulse - ((maxPulse - minPulse)/2);
  pulseWidth = centerServo;   
  Serial.begin(9600);
  Serial.println("      Arduino Serial Servo Control");
  Serial.println("Press < or > to move, spacebar to center");
  Serial.println();
}

void loop() {
 
  if (Serial.available() > 0) {
   
    moveServo = Serial.read();

    if (moveServo == 44) { pulseWidth = pulseWidth - turnRate; }
    if (moveServo == 46) { pulseWidth = pulseWidth + turnRate; }
    if (moveServo == 32) { pulseWidth = centerServo; }

   
    if (pulseWidth > maxPulse) { pulseWidth = maxPulse; }
    if (pulseWidth < minPulse) { pulseWidth = minPulse; }

   
  }

  if (millis() - lastPulse >= refreshTime) {
    digitalWrite(servoPin, HIGH);   
    delayMicroseconds(pulseWidth);
    digitalWrite(servoPin, LOW);   
    lastPulse = millis();         
  }
}
Title: Re: servo with "parkinson"
Post by: olivthill on June 18, 2013, 04:54:17 PM
...   
int minPulse     =  600; 
int maxPulse     =  2400;
...
I thought that servos were designed to work in the range 1000-2000, with a margin allowing a wider range, such as 900-2100, or a little more. But 600-2400 looks too much. But, maybe the problem is elsewhere.

I have experienced a problem like that with a small servo. It was shaking when with some pulses, and not shaking with other pulses. Besides, when the servo was shaking, I was able to make it stand still with a little push of my hand. The problem was due to a weak servo, because, when I replaced it with another one, the problem did not occur again.

Title: Re: servo with "parkinson"
Post by: jwatte on June 18, 2013, 06:37:56 PM
Moving servos may draw a lot of power. How strong is your battery or power source? It may be that, while it's moving, the voltage drops because the power source is not sufficient, and that causes the controller or servos to drop out.
Title: Re: servo with "parkinson"
Post by: nanotechopolis_gr on June 20, 2013, 06:04:51 AM
i use 9v battery! maybe the servo is weak , 4.5kg/cm @6volt  maybe has been damaged or something else? but its difficult to replace it!
Title: Re: servo with "parkinson"
Post by: newInRobotics on June 20, 2013, 06:15:42 AM
If it's 9V battery similar to one in the image - they are known for not having much juice. It is a lot better to have 6 regular 1.5V batteries connected in series.

(http://www.buyabattery.co.uk/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/m/n/mn1604procellmedium_3.jpg)

Here's an article for You --> Understanding battery capacity: Ah is not A (http://www.pololu.com/blog/2/understanding-battery-capacity-ah-is-not-a)

And here's short fragment from the article above:
Quote
9V alkaline batteries can be convenient for their high voltage in a small size, but the energy density (watt-hours per given volume or weight) is the same as other batteries with the same chemistry, which means the capacity in amp-hours is low. In approximately the same size as an AA cell, you get six times the voltage, so you also get about six times less in the Ah rating, or about 500 mAh. Given the high losses incurred from discharging in anything under a few hours, 9V batteries are impractical for most motors and therefore for most robots.
Title: Re: servo with "parkinson"
Post by: nanotechopolis_gr on June 20, 2013, 03:27:24 PM
problem solved! thanks you guys! finaly i fixed the pulse range and bought AA batteries and a hold keeper! i know that 9v bats arent good power supply but i didnt expected that!

thanks again!