Trouble with Servo Motor Rotation Speed

Recently I bought a servo motor and I would like to be able to allow it to rotate much faster than it currently is. However I notice that, compared to the video that I bought the servo motor, mine doesn't turn as fast as I wish it would. Here is the code I am using currently to turn the servo motor:

#include <Servo.h>

Servo myServo;  // Create a Servo object
int servoPin = 9;  // Pin where the servo signal is connected
int angle = 0;     // Variable to store the angle

// Define the pulse width range for 0–270 degrees (adjust as needed)
const int minPulseWidth = 500;  // Pulse width for 0 degrees (ESC range)
const int maxPulseWidth = 2500;  // Pulse width for 270 degrees (ESC range)

void setup() {
  Serial.begin(9600);   // Start serial communication
  myServo.attach(servoPin);  // Attach the servo to the specified pin
  Serial.println("Enter an angle between 0 and 270:");
}

void loop() {
  if (Serial.available() > 0) {
    String input = Serial.readStringUntil('\n');  // Read input until newline
    angle = input.toInt();  // Convert the input to an integer

    // Validate the angle range
    if (angle >= 0 && angle <= 270) {
      // Map the angle to the corresponding pulse width
      int pulseWidth = map(angle, 0, 270, minPulseWidth, maxPulseWidth);
      
      // Send pulse width to the servo (or ESC)
      myServo.writeMicroseconds(pulseWidth);  // Control the servo using pulse width

      Serial.print("Servo moved to: ");
      Serial.print(angle);
      Serial.println(" degrees");
      Serial.print("Pulse width: ");
      Serial.println(pulseWidth);
    } else {
      Serial.println("Invalid angle. Please enter a value between 0 and 270.");
    }
  }
}

If there is any way that I can try to control the servo's speed to go faster using Arduino code, please let me know what I should do. Otherwise, if it is a hardware issue or something else that I need in order to help it go faster that would be a great help. Thanks and feel free to ask any questions.

Can your servo actually move to 270 degrees ? If so, it would be unusual. How is the servo powered ?

Please post a link to where you got the servo

Yes the servo can move 270 degrees, its one of those 25 kg servos that you can find on amazon pretty easily. It's advertised that it can move 0.13 seconds / 60 degrees using 4.8 volts but it feels noticeably slower when I actually try to have it turn when using it. I'm simply connecting my pins to GND and 5 V outputs as well as pin 9. If you're curious I'm trying to use it to have faster turning for an rc car.

Don't power it that way. The Arduino (which do you have ?) is not designed to be used as a power supply and you may have already damaged it

How much current does the servo take when stalled or starting to move ?

You need to use an external power supply for the servo such as 4 AA batteries or probably something that can supply even more current at the required voltage

1 Like

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