Servo motor twitching

Hi!

I just received my first servo motor, but I’m having difficult time making it work smoothly.
It seems that it twitches like crazy, draws up to 1.5 amps and gets hot pretty quickly.
I have it connected to 4xAA batteries.

Video:

Arduino code:

#include <Servo.h>
 
int servoPin = 9;
Servo servo;

void setup() {
  servo.attach(servoPin);
}
void loop() {
  for (int i = 0; i < 180; i++) {
    servo.write(i);
    delay(15);
  }
  
  for (int i = 180; i > 0; i--) {
    servo.write(i);
    delay(15);
  }
}

1.5A under no load? If so I'd suspect a mechanical problem inside the servo, jamming it maybe?

That said, can you confirm the wiring please- bit tricky to see in that video.

And also, are those batteries charged?- you may be on the bottom of its 4.8 and I see that model can be powered at 7.2V. Maybe try a higher voltage....

I have servo's power and ground connected to the battery, signal wire to pin 9 on my Arduino. Also Arduino's ground to battery's negative, for common ground.

Just tried connecting servo to 6V AC/DC adapter, but still nothing, except now when I measure the current, making a gap between servo's ground cable and battery's negative, if thats correct (sorry, im a rookie still), it sometimes jumps even up to 2 amps and the servo still twitches like crazy.

Try an even simpler program - and change the angle in the code and try again

#include <Servo.h>
 
int servoPin = 9;
Servo servo;

void setup() {
  servo.attach(servoPin);
  servo.write(90);
}
void loop() {
}

You have said how the servo is powered, but how is the Arduino powered?

What does the servo do if you apply power when the signal pin is not connected to anything?

Buy a second cheap servo for comparison - in case there is a fault with the first one.

…R

Robin2:
Try an even simpler program - and change the angle in the code and try again

You have said how the servo is powered, but how is the Arduino powered?

What does the servo do if you apply power when the signal pin is not connected to anything?

Buy a second cheap servo for comparison - in case there is a fault with the first one.

  1. Arduino is powered through USB.
  2. With this program, the servo moves to specified position pretty nicely and then just shakes and twitches all over when idle.
  3. When the signal pin is not connected to anything, servo stops twitching.

I have another mini servo coming this week..

SarunasK:
the servo moves to specified position pretty nicely and then just shakes and twitches all over when idle.

It sounds like there is a problem with the servo's internal position keeping system.

Does it twitch regardless of what position it is commanded to? (Maybe it is better at 100deg rather than 90deg etc)

I don't think there is much to do until you try the second servo.

...R

Twitching definitely begins when servo is idle. It vibrates hard and twitches from 0-90 degrees, then twitching picks up even more and continues like that till 180 degrees. Wish I could do something to try and fix it. Such a shame, i was hoping to do some cool stuff with it.

SarunasK:
Twitching definitely begins when servo is idle. It vibrates hard and twitches from 0-90 degrees, then twitching picks up even more and continues like that till 180 degrees. Wish I could do something to try and fix it. Such a shame, i was hoping to do some cool stuff with it.

Sorry, but I can't relate your answer to my question.

What do you mean by idle - normally a servo is never idle. It should sit at the position it was commanded to go to and should resist any attempt to move it.

Do you mean that a single twitch can move the servo arm from 0 to 90 deg? Or do you mean that it makes little twiches (vibrations) when it is commanded to any angle between 0 and 90 - for example 10deg or 47deg?

If there are large movements from 0 to 90 (say) I would suspect a poor connection in the signal cable. But if the cable is OK I can't think of anything else apart from trying another servo.

...R

Robin2:
Do you mean that a single twitch can move the servo arm from 0 to 90 deg? Or do you mean that it makes little twiches (vibrations) when it is commanded to any angle between 0 and 90 - for example 10deg or 47deg?

Pretty much it acts like this: if i plug the servo to my arduino, it twitches and vibrates. If i tell it to rotate, it turns pretty smoothly, but right after it stops rotating, it starts making twitches and vibrations again.

I didnt mean that a single twitch moves servo arm from 0 to 90 degrees, i meant vibration and small twitching. Sorry for confusion.

I am looking forward to trying out 9g micro servo in few days, hopefully gonna have better luck with it. This MG996R is a cheap chinese Towardpro servo FWIW.

I have seen alot of servo jitter with Arduino, and I really don't know what is causing them. My solution is usually to to a servo detach between movements.

SarunasK:
I didnt mean that a single twitch moves servo arm from 0 to 90 degrees, i meant vibration and small twitching. Sorry for confusion.

Try connecting a 4,700 ohm resistor from the servo signal wire to GND.

I found that this keeps the servo quiet in the time between power-up and the Arduino taking control. It may or may not help you.

...R

Tobbera:
My solution is usually to to a servo detach between movements.

Potential problem there though, is that if there's a load on your servo like say on a servo arm holding an object in mid-air, the servo might not hold position. An attached servo gets a repeating pulse every 20ms and that stops when it's detached.

In fact, maybe in your case the load is trying to move the servo from the commanded position, and the servo is doing its best to get back. In that case it's not an Arduino problem, it's a mechanical thing and the servo's only trying to do its job.

Robin2:
Try connecting a 4,700 ohm resistor from the servo signal wire to GND.

The resistor didn't seem to change anything.

Here's how it looks now. I'm controlling the angle through serial.
It also gets pretty warm/hot after a minute or so.

Looks to me like a mechanical issue after all. Or is twitching like that somewhat normal?

EDITED: Received my 9g micro servo and it works great with no twitching at all.

Cool... so at least you know it's not an Arduino hardware or coding thing.

was that 1.5A you mentioned before, under no load? If so, as I said, that would point to a jam or something. That current would be associated with a stall, which would be consistent with a jam, and the heat.

SarunasK:
The resistor didn't seem to change anything.

I'm not surprised - it was just a wild shot

Received my 9g micro servo and it works great with no twitching at all.

Good news

...R

JimboZA:
was that 1.5A you mentioned before, under no load?

Yes, even up to 2A without any load.

Gonna try and get a swap for a new one.

Thanks everyone

I know this is a little late, but I came here with a similar issue, so perhaps others may as well. When powering the servo with a separate power supply, I got horrible twitching until I connected the ground from the power supply to the ground on the arduino.