Increasing servo motor speed

The servo has a physical top speed. The code can slow it down with delays, but can't speed it up beyond the physical speed of the motor.

Maybe you could get more speed out of it by using the maximum voltage that the Servo will take, or switching to a faster servo, but that's a hardware problem.

1 Like

no the speed is same as ++

it's a robotic arm.

exactly it is

Yes I think so. I'm using MG995. Witch servo do you offer?

so try += 10;
+= 20;
+=30;

Why are you not reading advice?

1 Like

The code you posted is written to move the servo slowly. If you want the servo to move at its "catalog" speed, replace the for(pos) {} loop with a HCPCA9685_1.Servo(servoNumber, servoPosition); statement.
New code :

#include <SoftwareSerial.h>
#include <Servo.h>
#include "HCPCA9685.h"

SoftwareSerial BT(13, 12); //RX , TX pins

char state = 0;
/* I2C slave address for the device/module. For the HCMODU0097 the default I2C address
  is 0x40 */
#define I2CAdd_1 0x40
#define I2CAdd_2 0x41

int pos1 = 200;
int pos2 = 220;
int pos3 = 180;
int pos4 = 0;
int pos5 = 130;
int pos6 = 100;
int pos7 = 50;
int pos8 = 260;
int pos9 = 140;
int delay1;
int delay2 = 500;

/* Create an instance of the library */
HCPCA9685 HCPCA9685_1(I2CAdd_1);
HCPCA9685 HCPCA9685_2(I2CAdd_2);

void setup() {
  /* Initialise the library and set it to 'servo mode' */

  // Initialise both modules
  HCPCA9685_1.Init(SERVO_MODE);
  HCPCA9685_2.Init(SERVO_MODE);

  // Wake both devices up
  HCPCA9685_1.Sleep(false);
  HCPCA9685_2.Sleep(false);

  HCPCA9685_1.Servo(2, pos6);
}

void loop() {

}

Each time you see that kind of for(pos) loop, delete the parts crossed out in red and directly place the final position (pos6 here) inside the parentheses.

I can't do this. I have to use for loops how ever I trired your code but the rsult is same.

Please post the full sketch that you tried, using code tags when you do

why don't you try to see if the servo will go fast enough without being delayed by a for loop?

1 Like

One step to the desired position.

for (int Pos = pos4; Pos < pos6; Pos += (Pos - pos6)) ( // one step to the desired position
  HCPCA9685_1.Servo(2, Pos);
}

Hi, @alija22

Why?
Is this a school/college/university project?

Did you try the code without for-loop?
If not then TRY IT and see how fast it is.

It will help to diagnose any problem your system may have.
You are not in programming mode now you are TROUBLESHOOTING MODE...

Can you please tell us your electronics, programming, arduino, hardware experience?

Tom.. :smiley: :+1: :coffee: :australia:

1 Like

This has been a hundred-posts, never-ending, tail-chasing, six-steps-back, ordeal over multiple topics with the same subject. Follow the activities to get the whole story, because answers will never be given when asked for over and over.

I compared servo speed with for loop and with out it. there is no differences betwwen them in speed.

I will try this

there are no differences between servo with for loop or with out it in speed. And I think my experience in electronic or progtamming is not ralated to you. If you have enough experience offer asolution othervise be silent.

And there is part of the problem.

Tom... :smiley: :+1: :coffee: :coffee: :coffee: :australia:

1 Like

As previously requested, please post your sketch showing how you tried to move the servo without using a for loop

1 Like

not cool