# faulty Mg996r servo stops working after minimal use

#### Killerbee65

Joined May 15, 2017
250
Hello all!

I'm not sure where this topic belongs but I wanted to ask if anyone has any idea whats's going on here? I ordered these motors off of amazon https://www.amazon.com/gp/product/B01GN07I5U/ref=ppx_yo_dt_b_asin_title_o01_s00?ie=UTF8&psc=1 and wanted to use them for a "useless box" project. I will upload the code I used as well (not mine but I did change the PWM values to fit my needs). After 5 minutes of use the motor, no matter which one, would just stop working. Granted some lasted more than others but that is to be expected. I did my own research as well as open one motor up and found nothing out of the ordinary except the potentiometer getting extremely hot which may indicate it is cutting all the power from reaching the motor itself ( I measured voltage across the board and found everything past the resistor had no electricity running through it). I am using an ICR 18350 600mAH 7.4v battery (even tried two in series with no success because I thought maybe the battery ran out too fast due to the motors) and the schematic below for my project. I made sure every connection was secured and the arduino uploaded with the right code. Like I said, I am almost positive it has something to do with hardware of the motor and not software or any other factor i mentioned before. I just want to know how to fix the problem without having to sacrifice too much time and effort for the same outcome (ie replacing ALL the potentoimeters on each motor just for it to degrade again) so an alternative is my goal here. I would also like to know what casues the problem, I would love to use this as a learning lesson for future documentation/ research. If anyone needs for info please do not hesitate to ask, I appreciate all the comments and look forward to reading them!

My code: added led for a purple light instead of a basic one.

Code:
#include <Servo.h>                        //包含舵机库

Servo handServo;                          //定义舵机名称
Servo boxServo;

int switchStatus=0, action=1, vot, randNumber=0;                   //定义基本整形变量用于存储开关状态 电池电压 开关次数和种类
//定义LED引脚
const int frontSwitchPin = 2;
const int handServoPin = 5;
const int boxServoPin = 6;
int red_light_pin= 11;
int green_light_pin = 10;
int blue_light_pin = 9;

void setup()
{
Serial.begin(9600);

pinMode(red_light_pin, OUTPUT);
pinMode(green_light_pin, OUTPUT);
pinMode(blue_light_pin, OUTPUT);

handServo.attach(handServoPin);              //定义舵机信号引脚
boxServo.attach(boxServoPin);
handServo.write(0);                        //舵机复位
boxServo.write(90);

}

void loop()
{
RGB_color(255, 0, 255);

if (switchStatus == LOW){                   //若开关被按下

if (action == 1)
{
Serial.println("Action 1");           //第一种 慢慢抬头看 慢慢关开关
for (int i = 90; i <= 180; i++)
{
boxServo.write(i);
delay(5);
}
for (int i = 0; i >= 110; i--)
{
handServo.write(i);
delay(20);
}
delay(1000);
handServo.write(110);
delay(200);
for (int i = 110; i <=0; i++)
{
handServo.write(i);
delay(20);
}
for (int i = 180; i >= 90; i--)
{
boxServo.write(i);
delay(20);
}
action++;
}

else if (action == 2)
{
Serial.println("Action 2");         //第二种 迅速关开关 事后探头看
for (int i = 90; i <= 180; i++){
boxServo.write(i);
delay(6);
}
delay(550);
handServo.write(110);
delay(550);
handServo.write(0);
delay(550);
boxServo.write(90);
delay(1500);
for (int i = 90; i <= 180; i++){
boxServo.write(i);
delay(6);
}
delay(3000);
boxServo.write(90);
action++;
}

else if (action == 3)
{
Serial.println("Action 3");         //第三种 抬头看一下 然后迅速关开关
for (int i = 90; i <= 180; i++){
boxServo.write(i);
delay(6);
}
delay(1000);
boxServo.write(90);
delay(2000);
for (int i = 90; i <= 180; i++){
boxServo.write(i);
delay(6);
}
handServo.write(110);
delay(550);
handServo.write(0);
delay(500);
boxServo.write(90);
action++;
}

else if (action == 4)
{
Serial.println("Action 4");         //第四种 慢慢抬头看 手碰开关 然后迅速关开关
for (int i = 90; i <= 180; i++)
{
boxServo.write(i);
delay(20);
}
for (int i = 0; i >= 110; i--)
{
handServo.write(i);
delay(20);
}
delay(2000);
handServo.write(110);
delay(200);
handServo.write(0);
delay(400);
boxServo.write(90);
action++;
}

else if (action == 5)
{
Serial.println("Action 5");       //第五种 抬头看然后挥手抗议
for (int i = 90; i <= 180; i++){
boxServo.write(i);
delay(6);
}
delay(2000);
handServo.write(100);
delay(550);
handServo.write(75);
delay(200);
handServo.write(100);
delay(200);
handServo.write(75);
delay(200);
handServo.write(100);
delay(200);
handServo.write(75);
delay(200);
handServo.write(100);
delay(200);
handServo.write(75);
delay(200);
handServo.write(100);
delay(200);
handServo.write(75);
delay(200);
handServo.write(100);
delay(2000);
handServo.write(110);
delay(400);
handServo.write(0);
delay(400);
boxServo.write(90);
action++;
}

else if (action == 6)
{
Serial.println("Action 6");
//第六种 抬头看然后摔盒子 然后关开关 然后探头看
for (int i = 90; i <180; i++)
{
boxServo.write(i);
delay(20);
}
delay(1000);
for (int i = 0; i < 12; i++)
{
for (int j = 90; j <= 180; j++){
boxServo.write(j);
delay(6);
}
delay(200);
}
for (int i = 0; i >= 110; i--)
{
handServo.write(i);
delay(30);
}
handServo.write(110);
delay(400);
handServo.write(0);
delay(400);
boxServo.write(90);
delay(1500);
for (int i = 90; i <= 180; i++){
boxServo.write(i);
delay(6);
}
delay(3000);
boxServo.write(100);
action++;
}

else if (action == 7)
{
Serial.println("Action 7");      //第七种 关上开关然后摔盒子
for (int i = 90; i <= 180; i++){
boxServo.write(i);
delay(6);
}
delay(400);
handServo.write(110);
delay(1000);
for (int i = 0; i < 6; i++)
{
for (int j = 90; j <= 180; j++){
boxServo.write(j);
delay(6);
}
delay(200);
}
delay(500);
handServo.write(0);
delay(400);
boxServo.write(90);
action++;
}

else if (action == 8)
{
Serial.println("Action 8");      //第八种 关上开关然后举手抗议
for (int i = 90; i <= 180; i++){
boxServo.write(i);
delay(6);
}
handServo.write(110);
delay(2000);
for (int i = 0; i < 7; i++)
{
handServo.write(80);
delay(100);
handServo.write(115);
delay(100);
}
delay(500);
handServo.write(0);
delay(1000);
boxServo.write(90);
action++;
}

else if (action == 9)
{
Serial.println("Action 9");      //第九种 露半个头非常生气 慢慢慢慢地关上开关 然后探半个头看
for (int i = 90; i <= 175; i++){
boxServo.write(i);
delay(6);
}
delay(2000);
boxServo.write(180);
for (int i = 0; i >=110; i--)
{
handServo.write(i);
delay(40);
}
delay(500);
handServo.write(110);
delay(200);
for (int i = 110; i <=0; i++)
{
handServo.write(i);
delay(40);
}
boxServo.write(90);
delay(2000);
boxServo.write(150);
delay(3000);
boxServo.write(90);
action++;
}

else if (action == 10)
{
Serial.println("Action 10");      //第十种 慢慢探半个头看 然后摔盒子 然后迅速关开关
for (int i = 90; i <= 170; i++)
{
boxServo.write(i);
delay(100);
}
delay(1000);
for (int i = 0; i < 10; i++)
{
for (int j = 90; j <= 160; j++){
boxServo.write(j);
delay(6);
}
delay(100);
}
boxServo.write(180);
delay(100);
handServo.write(110);
delay(650);
handServo.write(0);
delay(400);
boxServo.write(90);
action++;
}

else if (action == 11)
{
Serial.println("Action 11");      //第十一种 迅速探头关开关 然后慢速举手抗议 然后再探头按住开挂
for (int i = 90; i <= 180; i++){
boxServo.write(i);
delay(6);
}
handServo.write(110);
delay(2000);
for (int i = 0; i < 3; i++)
{
handServo.write(100);
delay(200);
handServo.write(75);
delay(200);
}
delay(1500);
handServo.write(0);
delay(400);
boxServo.write(90);
delay(1500);
for (int i = 90; i <= 180; i++){
boxServo.write(i);
delay(6);
}
handServo.write(110);
delay(3000);
handServo.write(0);
delay(400);
boxServo.write(90);
action++;
}

else if (action == 12)
{
Serial.println("Action 12");      //第十二种 慢慢地露出头 非常生气 慢慢慢慢地关上开关 然后迅速缩回去
for (int i = 90; i <= 180; i++)
{
boxServo.write(i);
delay(50);
}
delay(1000);
for (int i = 0; i >= 110; i--)
{
handServo.write(i);
delay(50);
}
delay(2000);
handServo.write(110);
delay(200);
handServo.write(0);
delay(400);
boxServo.write(90);
action++;
}

else if (action == 13)
{
Serial.println("Action 13");      //第十三种 迅速探头 挥手假装要关开关 然后重复几次 关上开关然后缩回去
for (int i = 90; i <= 180; i++){
boxServo.write(i);
delay(6);
}
delay(2000);
for (int i = 180; i >= 70; i--)
{
handServo.write(i);
delay(40);
}
for (int i = 0; i < 3; i++)
{
handServo.write(115);
delay(200);
handServo.write(95);
delay(800);
}
handServo.write(110);
delay(2000);
handServo.write(0);
delay(500);
boxServo.write(90);
action++;
}

else if (action == 14)
{
Serial.println("Action 14");     //第十四种 很生气 露出半个头盯着你 然后迅速关掉开关 然后继续盯着你
for (int i = 90; i <= 170; i++){
boxServo.write(i);
delay(6);
}
delay(4000);
boxServo.write(180);
handServo.write(110);
delay(650);
handServo.write(0);
delay(500);
boxServo.write(170);
delay(4000);
boxServo.write(90);
action++;
}

else if (action == 15)
{
Serial.println("Action 15");    //第十五种 很生气 露出半个头然后整个头然后又露剩半个头重复 然后慢慢关掉开关
for (int i = 90; i <= 170; i++){
boxServo.write(i);
delay(6);
}
delay(1000);
for (int i = 0; i < 3; i++)
{
for (int j = 90; j <= 170; j++){
boxServo.write(j);
delay(50);
}
for (int j = 170; j >= 90; j--)
{
boxServo.write(j);
delay(50);
}
}
for (int j = 90; j <= 180; j++){
boxServo.write(j);
delay(50);
}
for (int i = 0; i >= 110; i--)
{
handServo.write(i);
delay(40);
}
delay(1000);
handServo.write(110);
delay(400);
handServo.write(0);
delay(400);
boxServo.write(90);
action = 1;
}

}

}

void RGB_color(int red_light_value, int green_light_value, int blue_light_value)
{
analogWrite(red_light_pin, red_light_value);
analogWrite(green_light_pin, green_light_value);
analogWrite(blue_light_pin, blue_light_value);
}

original code:

Code:
#include <Servo.h>                        //包含舵机库

Servo handServo;                          //定义舵机名称
Servo boxServo;

int switchStatus=0, action=1, vot, randNumber=0;                   //定义基本整形变量用于存储开关状态 电池电压 开关次数和种类
const int ledPin = 13;                    //定义LED引脚
const int frontSwitchPin = 2;
const int handServoPin = 5;
const int boxServoPin = 6;

void setup()
{
Serial.begin(9600);

pinMode(ledPin, OUTPUT);                  //定义LED引脚为输出
digitalWrite(ledPin,HIGH);

handServo.attach(handServoPin);              //定义舵机信号引脚
boxServo.attach(boxServoPin);
handServo.write(180);                        //舵机复位
boxServo.write(70);

}

void loop()
{
//action = random(1,16);

if (switchStatus == LOW){                   //若开关被按下

if (action == 1)
{
Serial.println("Action 1");           //第一种 慢慢抬头看 慢慢关开关
for (int i = 70; i <= 110; i++)
{
boxServo.write(i);
delay(20);
}
for (int i = 180; i >= 35; i--)
{
handServo.write(i);
delay(20);
}
delay(1000);
handServo.write(26);
delay(200);
for (int i = 26; i <=180; i++)
{
handServo.write(i);
delay(20);
}
for (int i = 110; i >= 70; i--)
{
boxServo.write(i);
delay(20);
}
action++;
}

else if (action == 2)
{
Serial.println("Action 2");         //第二种 迅速关开关 事后探头看
for (int i = 70; i <= 110; i++){
boxServo.write(i);
delay(6);
}
delay(550);
handServo.write(26);
delay(550);
handServo.write(180);
delay(550);
boxServo.write(70);
delay(1500);
for (int i = 70; i <= 110; i++){
boxServo.write(i);
delay(6);
}
delay(3000);
boxServo.write(70);
action++;
}

else if (action == 3)
{
Serial.println("Action 3");         //第三种 抬头看一下 然后迅速关开关
for (int i = 70; i <= 110; i++){
boxServo.write(i);
delay(6);
}
delay(1000);
boxServo.write(70);
delay(2000);
for (int i = 70; i <= 110; i++){
boxServo.write(i);
delay(6);
}
handServo.write(26);
delay(550);
handServo.write(180);
delay(500);
boxServo.write(70);
action++;
}

else if (action == 4)
{
Serial.println("Action 4");         //第四种 慢慢抬头看 手碰开关 然后迅速关开关
for (int i = 70; i <= 110; i++)
{
boxServo.write(i);
delay(20);
}
for (int i = 180; i >= 35; i--)
{
handServo.write(i);
delay(20);
}
delay(2000);
handServo.write(26);
delay(200);
handServo.write(180);
delay(400);
boxServo.write(70);
action++;
}

else if (action == 5)
{
Serial.println("Action 5");       //第五种 抬头看然后挥手抗议
for (int i = 70; i <= 110; i++){
boxServo.write(i);
delay(6);
}
delay(2000);
handServo.write(65);
delay(550);
handServo.write(40);
delay(200);
handServo.write(65);
delay(200);
handServo.write(40);
delay(200);
handServo.write(65);
delay(200);
handServo.write(40);
delay(200);
handServo.write(65);
delay(200);
handServo.write(40);
delay(200);
handServo.write(65);
delay(200);
handServo.write(40);
delay(200);
handServo.write(65);
delay(2000);
handServo.write(26);
delay(400);
handServo.write(180);
delay(400);
boxServo.write(70);
action++;
}

else if (action == 6)
{
Serial.println("Action 6");
//第六种 抬头看然后摔盒子 然后关开关 然后探头看
for (int i = 70; i <110; i++)
{
boxServo.write(i);
delay(20);
}
delay(1000);
for (int i = 0; i < 12; i++)
{
for (int j = 70; j <= 110; j++){
boxServo.write(j);
delay(6);
}
delay(200);
}
for (int i = 180; i >= 35; i--)
{
handServo.write(i);
delay(30);
}
handServo.write(26);
delay(400);
handServo.write(180);
delay(400);
boxServo.write(70);
delay(1500);
for (int i = 70; i <= 110; i++){
boxServo.write(i);
delay(6);
}
delay(3000);
boxServo.write(80);
action++;
}

else if (action == 7)
{
Serial.println("Action 7");      //第七种 关上开关然后摔盒子
for (int i = 70; i <= 110; i++){
boxServo.write(i);
delay(6);
}
delay(400);
handServo.write(26);
delay(1000);
for (int i = 0; i < 6; i++)
{
for (int j = 70; j <= 110; j++){
boxServo.write(j);
delay(6);
}
delay(200);
}
delay(500);
handServo.write(180);
delay(400);
boxServo.write(70);
action++;
}

else if (action == 8)
{
Serial.println("Action 8");      //第八种 关上开关然后举手抗议
for (int i = 70; i <= 110; i++){
boxServo.write(i);
delay(6);
}
handServo.write(26);
delay(2000);
for (int i = 0; i < 7; i++)
{
handServo.write(75);
delay(100);
handServo.write(40);
delay(100);
}
delay(500);
handServo.write(180);
delay(1000);
boxServo.write(70);
action++;
}

else if (action == 9)
{
Serial.println("Action 9");      //第九种 露半个头非常生气 慢慢慢慢地关上开关 然后探半个头看
for (int i = 70; i <= 105; i++){
boxServo.write(i);
delay(6);
}
delay(2000);
boxServo.write(110);
for (int i = 180; i >=35; i--)
{
handServo.write(i);
delay(40);
}
delay(500);
handServo.write(26);
delay(200);
for (int i = 26; i <=180; i++)
{
handServo.write(i);
delay(40);
}
boxServo.write(70);
delay(2000);
boxServo.write(100);
delay(3000);
boxServo.write(70);
action++;
}

else if (action == 10)
{
Serial.println("Action 10");      //第十种 慢慢探半个头看 然后摔盒子 然后迅速关开关
for (int i = 70; i <= 105; i++)
{
boxServo.write(i);
delay(100);
}
delay(1000);
for (int i = 0; i < 10; i++)
{
for (int j = 70; j <= 100; j++){
boxServo.write(j);
delay(6);
}
delay(100);
}
boxServo.write(110);
delay(100);
handServo.write(26);
delay(650);
handServo.write(180);
delay(400);
boxServo.write(70);
action++;
}

else if (action == 11)
{
Serial.println("Action 11");      //第十一种 迅速探头关开关 然后慢速举手抗议 然后再探头按住开挂
for (int i = 70; i <= 110; i++){
boxServo.write(i);
delay(6);
}
handServo.write(26);
delay(2000);
for (int i = 0; i < 3; i++)
{
handServo.write(65);
delay(200);
handServo.write(40);
delay(200);
}
delay(1500);
handServo.write(180);
delay(400);
boxServo.write(70);
delay(1500);
for (int i = 70; i <= 110; i++){
boxServo.write(i);
delay(6);
}
handServo.write(26);
delay(3000);
handServo.write(180);
delay(400);
boxServo.write(70);
action++;
}

else if (action == 12)
{
Serial.println("Action 12");      //第十二种 慢慢地露出头 非常生气 慢慢慢慢地关上开关 然后迅速缩回去
for (int i = 70; i <= 110; i++)
{
boxServo.write(i);
delay(50);
}
delay(1000);
for (int i = 180; i >= 26; i--)
{
handServo.write(i);
delay(50);
}
delay(2000);
handServo.write(26);
delay(200);
handServo.write(180);
delay(400);
boxServo.write(70);
action++;
}

else if (action == 13)
{
Serial.println("Action 13");      //第十三种 迅速探头 挥手假装要关开关 然后重复几次 关上开关然后缩回去
for (int i = 70; i <= 110; i++){
boxServo.write(i);
delay(6);
}
delay(2000);
for (int i = 180; i >= 60; i--)
{
handServo.write(i);
delay(40);
}
for (int i = 0; i < 3; i++)
{
handServo.write(60);
delay(200);
handServo.write(40);
delay(800);
}
handServo.write(26);
delay(2000);
handServo.write(180);
delay(500);
boxServo.write(70);
action++;
}

else if (action == 14)
{
Serial.println("Action 14");     //第十四种 很生气 露出半个头盯着你 然后迅速关掉开关 然后继续盯着你
for (int i = 70; i <= 105; i++){
boxServo.write(i);
delay(6);
}
delay(4000);
boxServo.write(110);
handServo.write(26);
delay(650);
handServo.write(180);
delay(500);
boxServo.write(100);
delay(4000);
boxServo.write(70);
action++;
}

else if (action == 15)
{
Serial.println("Action 15");    //第十五种 很生气 露出半个头然后整个头然后又露剩半个头重复 然后慢慢关掉开关
for (int i = 70; i <= 105; i++){
boxServo.write(i);
delay(6);
}
delay(1000);
for (int i = 0; i < 3; i++)
{
for (int j = 70; j <= 105; j++){
boxServo.write(j);
delay(50);
}
for (int j = 105; j >= 70; j--)
{
boxServo.write(j);
delay(50);
}
}
for (int j = 70; j <= 110; j++){
boxServo.write(j);
delay(50);
}
for (int i = 180; i >= 35; i--)
{
handServo.write(i);
delay(40);
}
delay(1000);
handServo.write(26);
delay(400);
handServo.write(180);
delay(400);
boxServo.write(70);
action = 1;
}

}

}

#### AlbertHall

Joined Jun 4, 2014
11,952
Can we start by clearing up what battery voltage it was running on when the servos died.
The 18350 is nominally 3.7V (4.0V when fully charged)
Two in series would be nominally 7.4V (8.0V) when fully charged
Your diagram shows a 9V battery connected?

#### Killerbee65

Joined May 15, 2017
250
Can we start by clearing up what battery voltage it was running on when the servos died.
The 18350 is nominally 3.7V (4.0V when fully charged)
Two in series would be nominally 7.4V (8.0V) when fully charged
Your diagram shows a 9V battery connected?
It was running at 7v give or take because the 18350 battery I mentioned is actually two in one unit it looks like the photo below.
As I mentioned in my initial post, the diagram is one I used from an existing project same goes for the code. Both are not my own nor did I design them, simply put I used the battery below instead of the 9v battery.

#### AlbertHall

Joined Jun 4, 2014
11,952
There are some strangeneses in your code but I can't see anything that would upset the servos. Definitely do not operate with two batteries in series (14.8V) that will very likely harm the servos.

#### Killerbee65

Joined May 15, 2017
250
There are some strangeneses in your code but I can't see anything that would upset the servos. Definitely do not operate with two batteries in series (14.8V) that will very likely harm the servos.
Thanks for the warning, I'll be sure to not make the mistake again. The bright side is I tried it as a last-ditch effort to make the already faulty servos run so no harm done over all.

#### LesJones

Joined Jan 8, 2017
3,701
Even 7.4 volts is above the maximum voltage rating of the servos which is 7.2 volts from data I could find online.

Les.

#### AlbertHall

Joined Jun 4, 2014
11,952
Even 7.4 volts is above the maximum voltage rating of the servos which is 7.2 volts from data I could find online.

Les.
And when fully charged that would 8.0V.

#### MisterBill2

Joined Jan 23, 2018
11,556
First, your post talks about "motors", but then the drawing shows model type servos, which is a totally different animal. Hobby servos are quite particular about the voltage that they will work on and so that is a very first potentia cause of failure. Complex devices have voltage limits and exceeding those limits will usually cause problems and often cause failure.

#### Killerbee65

Joined May 15, 2017
250
Even 7.4 volts is above the maximum voltage rating of the servos which is 7.2 volts from data I could find online.

Les.
I DID see that but the datasheet I found made it seem like that was the minimum required to run it. It is most likely my fault for not looking deeper into the matter but in regards to how to prevent the issue, would you guys recommend using a lower volt battery? if so, which one do you recommend for this kind of job? also would using a dc-dc converter to step the voltage down while increasing amps be a better option? I'm looking for efficiency so any advice would be helpful!

#### MisterBill2

Joined Jan 23, 2018
11,556
7.2 volts is what you get from a stack of six of the 1.2 volt nicad batteries. And those would be common in RC equipment.

#### Killerbee65

Joined May 15, 2017
250
7.2 volts is what you get from a stack of six of the 1.2 volt nicad batteries. And those would be common in RC equipment.
would 4 AA batteries be more convenient? Also, they have 2 ish amps hours so wouldn't this make it last powered on longer? One more thing, I want to be able to either recharge or replace the batteries (since this is a gift for someone that isn't knowledgeable in this area).

#### MisterBill2

Joined Jan 23, 2018
11,556
Using 4 AA batteries would work quite well, that is the common non-rechargable battery stack. But a stack of 4AA sized NiCad batterys will deliver 4.8 volts and could be recharged by a cell phone charger. That may drive the servos fast enough for your application. A bit of experimentation will be needed for that case.