Servo motor heating and not rotating

I am using TowerPro SG90 Servo Motor (180° Rotation) with ESP32. I got the motor to work in the desired way and it was okay for some time. Now the servo motor is not working and it is heating very fast. Please guide me with this problem.

Hello fathimaiqbal123

Post your sketch, well formated, with comments and in so called code tags "</>" and schematic to see how we can help.


It is a simple circuit and i am using the example sweep code of esp32

#include <ESP32Servo.h>
//#define RELAY_PIN4 14
Servo myservo;  // create servo object to control a servo
// 16 servo objects can be created on the ESP32

int pos = 0;    // variable to store the servo position
// Recommended PWM GPIO pins on the ESP32 include 2,4,12-19,21-23,25-27,32-33 
// Possible PWM GPIO pins on the ESP32-S2: 0(used by on-board button),1-17,18(used by on-board LED),19-21,26,33-42
//#if defined(ARDUINO_DOIT ESP32 DEVKIT V1)

int servoPin = 13;


void setup() {
	// Allow allocation of all timers
	ESP32PWM::allocateTimer(0);
	ESP32PWM::allocateTimer(1);
	ESP32PWM::allocateTimer(2);
	ESP32PWM::allocateTimer(3);
  //digitalWrite(RELAY_PIN4, HIGH);
    //pinMode(RELAY_PIN4, OUTPUT);
	myservo.setPeriodHertz(50);    // standard 50 hz servo
	myservo.attach(servoPin, 500, 2000); // attaches the servo on pin 18 to the servo object
	// using default min/max of 1000us and 2000us
	// different servos may require different min/max settings
	// for an accurate 0 to 180 sweep
}

void loop() {
//digitalWrite(RELAY_PIN4, LOW); // turn on pump 2
  //delay(6100);//6000
// digitalWrite(RELAY_PIN4, HIGH);  // turn off pump 4 seconds
 // delay(200);
 // if(RELAY_PIN4== LOW){
	for (pos = 0; pos <= 180; pos += 15) { // goes from 0 degrees to 180 degrees
		// in steps of 1 degree
		myservo.write(pos);    // tell servo to go to position in variable 'pos'
		delay(10);             // waits 15ms for the servo to reach the position
	}
  
	for (pos = 180; pos >= 0; pos -= 15) { // goes from 180 degrees to 0 degrees
		myservo.write(pos);    // tell servo to go to position in variable 'pos'
		delay(10);             // waits 15ms for the servo to reach the position
	}
 // }
}
 


From the SG90 datasheet, you'll need to use default min/max of 1000μs and 2000μs.

myservo.attach(servoPin, 1000, 2000); 

but sir, earlier it was working according to the program. But now what will exactly be the reason.

I am just asking out of curiosity.

I'm guessing the incorrect min setting (500μs) caused overheating and it burned out over a period of time. Similar to this issue, except it was the code that was trying to change the servo position beyond its lower limit.

On another servo of same type, I suggest starting with

myservo.attach(servoPin, 1050, 1950);

Which might give 5 to 175 deg range. Then adjust to suit your application, but don't go beyond

myservo.attach(servoPin, 1000, 2000);

as mentioned in the datasheet.

Hello @fathimaiqbal123
If your code is working fine then you have to check your hardware,check the pwm pulses from the esp 32 or just check your servo👍

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.