Servo Motor Buzzing Under Load

I am building a servo motor robot arm. The gripper mechanism lock onto the object (a 3d printed cube), however, it makes a really load buzzing noise. If I change the angle to a lower degree, it doesn’t grip the cube well. Is there a better way to have the motor grip, but not buzzing? Beware… my code is a disaster right now. I have the motion in question separated by ///////////////////. The servo is myservo5. Please go easy on me, I’m an amateur.

#include <Arduino.h>
#include <TM1637Display.h>

#include <Servo.h>

Servo myservo;
Servo myservo2;
Servo myservo3;
Servo myservo4;
Servo myservo5;
Servo myservo6;

// The amount of time (in milliseconds) between tests
#define TEST_DELAY   2000
 
const int ledPin =  13;     
int ledState = LOW;
int pressCount = 0;
int page = 1;
int angle = 50;
int motor1angle = 50;
int motor2angle = 90;
int motor3angle = 140;
int motor4angle = 130;
int motor5angle = 60;
int motor6angle = 50;
int servoValue = map(motor1angle, 0, 270, 0, 180); 
int servo2Value = map(motor2angle, 0, 270, 0, 180); 
int servo3Value = map(motor3angle, 0, 270, 0, 180); 
int servo4Value = map(motor4angle, 0, 270, 0, 180); 
int servo5Value = map(motor5angle, 0, 270, 0, 180); 
int pos = 0;
int actionDelay = 100;
int degreeDelay = 5;

boolean button1State = LOW;
boolean button2State = LOW;
boolean button3State = LOW;
boolean button4State = LOW; 

int pressed=0;

void setup() {
  pinMode(ledPin, OUTPUT);

  Serial.begin(9600);
myservo.attach(8);
myservo2.attach(9);
myservo3.attach(10);
myservo4.attach(11);
myservo5.attach(12);
myservo6.attach(13);
myservo.write(servoValue);
myservo2.write(servo2Value);
myservo3.write(servo3Value);
myservo4.write(servo4Value);
myservo5.write(servo5Value);
myservo6.write(50);
delay(2000);

  int k;
  uint8_t data[] = { 0xff, 0xff, 0xff, 0xff };
  uint8_t blank[] = { 0x00, 0x00, 0x00, 0x00 };
  display.setBrightness(0x0f);
  display1.setBrightness(0x0f);

}

void loop() {

  for (pos = 50; pos <= 234; pos += 1) { 
    int servoValue = map(pos, 0, 270, 0, 180); 
    myservo.write(servoValue);              
    delay(degreeDelay);                       
  }
delay(actionDelay);

  for (pos = 140; pos <= 190; pos += 1) { 
    int servo3Value = map(pos, 0, 270, 0, 180); 
    myservo3.write(servo3Value);              
    delay(degreeDelay);                       
  }
delay(actionDelay);

  for (pos = 130; pos >= 0; pos -= 1) {    
    int servo4Value = map(pos, 0, 270, 0, 180); 
    myservo4.write(servo4Value);              
    delay(degreeDelay);                       
  }
delay(actionDelay);

  for (pos = 60; pos <= 80; pos += 1) { 
    int servo5Value = map(pos, 0, 270, 0, 180); 
    myservo5.write(servo5Value);              
    delay(degreeDelay);                       
  }
delay(actionDelay);

  for (pos = 90; pos >= 28; pos -= 1) { 
    int servo2Value = map(pos, 0, 270, 0, 180); 
    myservo2.write(servo2Value);              
    delay(10);                       
  }
delay(actionDelay);

//////////////////////////////////////////////////////
  for (pos = 80; pos >= 61; pos -= 1) {
    int servo5Value = map(pos, 0, 270, 0, 180); 
    myservo5.write(servo5Value);              
    delay(degreeDelay);                      
  }
delay(actionDelay);
//////////////////////////////////////////////////////


  for (pos = 28; pos <= 90; pos += 1) {    
    int servo2Value = map(pos, 0, 270, 0, 180); 
    myservo2.write(servo2Value);              
    delay(degreeDelay);                       
  }
delay(500000);

}

Most servo problems are caused by an inadequate servo power supply, like trying to power the servo from the Arduino 5V output.

The servo power supply must be able to provide 4.8 to 6V at 1 Ampere per servo for small servos like the SG90 and at least 2.5 Amperes per servo for large ones like the MG996R.

Of course, overloading the servo, or driving the servo arm past its mechanical limit will also cause severe problems.

Please post the details of your setup. Include a wiring diagram and a photo.

Example servo wiring diagram:

These "robot arm" degree movements are not 0 to 180 as you have written. Some are as small as 20 degrees.

Also, you defeat the purpose of map() in your code. The for() loops you have written can act as the degree movement.