Two servo motors not rotating, but heating up

claw_degress(myservo1) and arm_degress(myservo2) does not rotate when I press the ir remote buttons, the only servo that works is the base_degress(myservo3)

#include "IR_remote.h"
#include "keymap.h"

IRremote ir(3);

#include <Servo.h>

int base_degress;
int arm_degress;
int claw_degress;

Servo myservo1;
Servo myservo2;
Servo myservo3;



void setup()
{
  IRremote ir(3);

  base_degress = 90;
  arm_degress = 90;
  claw_degress = 90;
  myservo1.attach(9);
  myservo2.attach(10);
  myservo3.attach(11);
  myservo1.write(claw_degress);
  delay(500);
  myservo2.write(arm_degress);
  delay(500);
  myservo3.write(base_degress);
  delay(500);
  Stop();
  pinMode(2, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(6, OUTPUT);
}

void loop(){
  if (ir.getIrKey(ir.getCode(),1) == IR_KEYCODE_UP) {
    Move_Forward(100);
    delay(300);
    Stop();

  } else if (ir.getIrKey(ir.getCode(),1) == IR_KEYCODE_DOWN) {
    Move_Backward(100);
    delay(300);
    Stop();
  } else if (ir.getIrKey(ir.getCode(),1) == IR_KEYCODE_LEFT) {
    Rotate_Left(70);
    delay(300);
    Stop();
  } else if (ir.getIrKey(ir.getCode(),1) == IR_KEYCODE_RIGHT) {
    Rotate_Right(70);
    delay(300);
    Stop();
  } else if (ir.getIrKey(ir.getCode(),1) == IR_KEYCODE_OK) {
    Stop();
  } else if (ir.getIrKey(ir.getCode(),1) == IR_KEYCODE_9) {
    claw_degress = claw_degress - 5;
    if (claw_degress <= 50) {
      claw_degress = 50;

    }
    myservo1.write(claw_degress);
    delay(2);
  } else if (ir.getIrKey(ir.getCode(),1) == IR_KEYCODE_7) {
    claw_degress = claw_degress + 5;
    if (claw_degress >= 180) {
      claw_degress = 180;

    }
    myservo1.write(claw_degress);
    delay(2);
  } else if (ir.getIrKey(ir.getCode(),1) == IR_KEYCODE_2) {
    arm_degress = arm_degress + 5;
    if (arm_degress >= 180) {
      arm_degress = 180;

    }
    myservo2.write(arm_degress);
    delay(2);
  } else if (ir.getIrKey(ir.getCode(),1) == IR_KEYCODE_8) {
    arm_degress = arm_degress - 5;
    if (arm_degress <= 0) {
      arm_degress = 0;

    }
    myservo2.write(arm_degress);
    delay(2);
  } else if (ir.getIrKey(ir.getCode(),1) == IR_KEYCODE_4) {
    base_degress = base_degress + 5;
    if (base_degress >= 180) {
      base_degress = 180;

    }
    myservo3.write(base_degress);
    delay(2);
  } else if (ir.getIrKey(ir.getCode(),1) == IR_KEYCODE_6) {
    base_degress = base_degress - 5;
    if (base_degress <= 0) {
      base_degress = 0;

    }
    myservo3.write(base_degress);
    delay(2);
  }

}




void Move_Backward(int speed) {
  digitalWrite(2,LOW);
  analogWrite(5,speed);
  digitalWrite(4,HIGH);
  analogWrite(6,speed);
}

void Rotate_Right(int speed) {
  digitalWrite(2,HIGH);
  analogWrite(5,speed);
  digitalWrite(4,HIGH);
  analogWrite(6,speed);
}

void Rotate_Left(int speed) {
  digitalWrite(2,LOW);
  analogWrite(5,speed);
  digitalWrite(4,LOW);
  analogWrite(6,speed);
}

void Stop() {
  digitalWrite(2,LOW);
  analogWrite(5,0);
  digitalWrite(4,HIGH);
  analogWrite(6,0);
}

void Move_Forward(int speed) {
  digitalWrite(2,HIGH);
  analogWrite(5,speed);
  digitalWrite(4,LOW);
  analogWrite(6,speed);
}

Please post a wiring diagram (pencil and paper image is preferred), with all pins, parts and connections clearly labeled. Also, post the specifications of the servo power supply.


The servo used are MG90S micro servos, the power supplies are two 18650 batteries

  • Show us good images of your ‘actual’ wiring.

2S li-ion voltage is too high for MG90S

2 Likes


Is this what you meant?

  • Servo power supply voltage is 4.8 to 6v.
2 Likes

Also, use some simple servo example sketch to make them move simultaneously. When that works without hiccups, add your IR code.

Update: I fixed the issue with myservo2, it turns out there something blocking it so it wasn't able to rotate. But, myservo1 still is not fixed.

Issue: The whole robot is working just fine, but when I connect myservo1 to the arduino, the whole thing stops working. The two servos got reset back to their normal degrees, starts stuttering, and can't be controlled using the ir remote

And if you connect that servo just alone?

Verify this servo works alone, without any extra code. Find the "servo sweep" sketch in IDE >> File >> Examples >> Built-In Examples >> (somewhere in there).

The shield looks like the V2 Elegoo shield, used for a different kit. Verify your batteries are charged.

The best thing you can do at this point is post an annotated schematic showing exactly how you have wired your project. Show all connections, power, ground and power sources. Also post links to each of the hardware devices that give technical information.