ESP32 Servo not moving in any GPIO pin

I have a ESP32 servo and previously it was able to move my 23kg servo just fine. It was being powered via a wall socket to a 6 volts cable. But out of nowhere it suddently stopped rotating the servo.

I have tried to switch pins from GPIO 13, 15, and 10 and use a weaker servo that can operate at 3.3v but still it hasn't been moved. I am wrondering if this is the ESP32 that has potentially been broken via the voltages or not

For wiring info the ESP32 and 23kg servo was being powered via VIN and GND at 6V. Troubleshooting the ESP32 bluetooth works fine and so does uploading new code. (except now I need to hold the boot button to upload which hasn't occured before.)

Blockquote

`#include <SoftwareSerial.h>
#include <ESP32Servo.h>
#include <BluetoothSerial.h>

BluetoothSerial SerialBT;
Servo myservo;
String password = "1";
const int lockPosition = 180;
const int unlockPosition = 90;

void setup() {
myservo.attach(13);
myservo.write(lockPosition);
Serial.begin(115200);
SerialBT.begin("Lock"); // Name of the device
Serial.println("The device is ready to pair");
}

void loop() {
if (SerialBT.available()) {
String incomingData = SerialBT.readStringUntil('\n');
incomingData.trim();
// remove any leading or trailing white spaces

if (incomingData.equals(password)) {

  myservo.write(unlockPosition);
  SerialBT.println("🎁 Correct password");
  SerialBT.println("🎁[1] Update Password ");
  SerialBT.println("🎁[2] Lock Chesty ");
  String UserChoice = "";
  while (UserChoice == "") {
    if (SerialBT.available()) {
      UserChoice = SerialBT.readStringUntil('\n');
      UserChoice.trim();


      if (UserChoice.equals("2")) {
        Serial.println("entered choice 1");
        myservo.write(lockPosition);
        SerialBT.println("🎁Locked & Logging Out");
        
        SerialBT.println("🎁 Please Enter Your Password To Login:");

      }




     
      if (UserChoice.equals("1")) {

        SerialBT.println("🎁 Enter new password: ");
        String User_typed_password = "";
        while (User_typed_password == "") {
          if (SerialBT.available()) {
            User_typed_password = SerialBT.readStringUntil('\n');
            User_typed_password.trim();
            password = User_typed_password;
            password.trim();
            SerialBT.println("🎁 Password changed successfully!");
            SerialBT.println("🎁 Locking...");
            myservo.write(lockPosition);
            SerialBT.println("🎁 Locked & Logging Out");
            
            SerialBT.println("🎁 Please Enter Your Password To Login:");

            
          }
        }
      }







     



    }
  }
}

}
}`

Not sure what your on board voltage regulator is capable of handling for input.

Usually they can manage 7 to 9v.

6v might be below the minimum for your regulator.

Also, suggest you try a 3V3 to 5v level shifter for feeding the servo input.

With this sketch, see if you can fade an LED on any of 16 different pins. They should all work, and all would be capable controlling the servo signal pin.

Don't know your circuit, but the next simplest connection scheme other than direct signal connect, is to just use one NPN transistor (or N-MOSFET) and a few resistors to interface each servo. For this, the Servo invert option would be enabled.

For direct connect of servo signal, a few more examples ...

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