The code burn the servo

hi forum. i build quadruped arduino robot and modified the code from this link, i use 12 mg966r servo, the power is 2s lipo 5200mah 30c and 20A stepdown module, i set the voltage to 5,6V. during the build time a have 3 times servo errors (unable to controlled ) the 1st error is with right back leg femur, 2nd error is with left back leg coax servo. for the 1st and 2nd error i could not see clearly what is wrong, the things i remember is i try to increase and reduce the parameter value within x.write(); from 1st and 2nd errors. the 3rd servo errors is with left front leg femur i clearly see and notice that there is smoke come out from the servo and the servo get hot when i run following code

#include <Servo.h>
Servo sc1;  // right front coax servo //create servo object to control a servo
Servo sf1; // right front femur
Servo st1; // right front tibia
Servo sc2;  // right back coax
Servo sf2; // right back femur
Servo st2; // right back tibia
Servo sc3;  // left front coax
Servo sf3; // left front femur
Servo st3; // left front tibia 
Servo sc4;  // left back coax
Servo sf4; // left back femur
Servo st4; // left back tibia

int i1L1 = 0;
int i2L1 = 0;
int i3L1 = 0;
int i4L1 = 0;

int i1L2 = 0;
int i2L2 = 0;
int i3L2 = 0;
int i4L2 = 0;

int i1L3 = 0;
int i2L3 = 0;
int i3L3 = 0;
int i4L3 = 0;

int i1L4 = 0;
int i2L4 = 0;
int i3L4 = 0;
int i4L4 = 0;


boolean l1status = LOW;
boolean l2status = LOW;
boolean l3status = LOW;
boolean l4status = LOW;

int speedV = 40;

void setup() {

 Serial.begin(9600);

sc1.attach(37);  
sf1.attach(38);
st1.attach(39);
sc2.attach(40);
sf2.attach(41);
st2.attach(42);
sc3.attach(33);
sf3.attach(32);
st3.attach(31);
sc4.attach(30);
sf4.attach(29);
st4.attach(28);

sc1.write(85);
sf1.write(116);
st1.write(103);

sc2.write(95);
sf2.write(108);
st2.write(104);

sc3.write(115);
sf3.write(65);
st3.write(65);

sc4.write(98);
sf4.write(78);
st4.write(60);

  delay(4000);
}
void loop() {

  moveLeg3();

    delay(speedV);
}


void moveLeg3() { 

 if (i1L3 <= 10) {
    st3.write(63 + i1L3 * 2);
    sf3.write(75 + i1L3 * 3);
    i1L3++;
  }
  
  if (i2L3 <= 30) {
    sc3.write(100 - i2L3); //when 115 the femur get hot
   i2L3++;
           if (i2L3 == 15){
    l2status = HIGH;
    }
  }
  
  if (i2L3 > 20 & i3L3 <= 10) {
    st3.write(90 - i3L3 * 2);
    sf3.write(100 - i3L3 * 3);
     i3L3++;
  }
  
  if (i2L3 >= 30) {
    sc3.write(70 + i4L3);// 99 the femur get hot
    i4L3++;
  
  }
  
  if (i4L3 >= 30) {
    i1L3 = 0;
    i2L3 = 0;
    i3L3 = 0;
    i4L3 = 0;
  }
  }

thank you

Are you sure that this compiles at all?

How many cells in your Li-Po?
What voltage are you stepping it down to?

i delet some comment maybe its left there

2 cells

i set the voltage to 5,6v

Overheating servos could be due to several things,

  • overvoltage
  • physical overload (too much continuous torque)
  • hitting the endstop (which is a special case of physical overload).

Most small cheap servos have no thermal protection and will cook themselves this way if
taken beyond their design capability.

Note that hobby servos torque rating is not a continuous rating.

Since you use nonsense names for everything with no comments I have no idea which servos are causing the problems. E.g. there is no mention of "left front leg femur" in the program.

Usually the easiest way to burn out a servo is trying to drive it past the point that it can physically move to i.e. stalling it.

Steve

brother i edited the post. its occured three times already