Help me, my 1235MG servo is acting weird

Hi folks,
I bought an HD 1235MG ultra-high-torque servo, and i tried running a simple code, to test it out.
The servo turns smoothly when turning towards 0, but when rising towards 180, instead of rising smoothly, it ticks (like a clock) for every step/degree. Can anyone tell me why it does that, and can i fix it? Please help.
Awesomely drawn schematic is attached.

Here’s the code:

#include <Servo.h>
Servo servo;
int servoPin = 5;
int firstLocation = 20;
int secondLocation = 160;
int delayTime = 2000; 


void setup() {
  // put your setup code here, to run once:
  servo.attach(servoPin);
  delay(20);

}

void loop() {
  // put your main code here, to run repeatedly:
  servo.write(firstLocation);
  delay(delayTime);
  servo.write(secondLocation);
  delay(delayTime);

}

Hi massimohansen.

Congratulations, you probably will be added to the Wall of Shame (not by me).

The code you've shown, doesn't exactly do what you described, so it can't lead to the error you are experiencing. It doesn't go to 0 and neither does it go to 180 (there's a reason for that). It does go towards 0 and 180, which is what you said, but it doesn't go all the way. If you are using different code than what you've shown, show the one you are actually using, not the inspiration of it.

That code has delays, see the remark about that in my signoff below.

Lots of people experience weirdnesses when experimenting with servos. Most of the time that is caused by an inappropriate power supply to that servo. Ultra high torque reads as relatively high currents, and currents are quite high when using servos. Have a look at the datasheet (click), and find some :astonished: currents mentioned. Do you reckon your alkaline batteries can handle anything close to that ? Take some measurements.

Powering servos from an Arduino isn't a good idea, period. But your doodle shows you aren't doing that.

Servoweirdness is very rare, most of it is a PEBKaC.