servo consistency

Hi I am a bit baffled with the servo consistency. I damaged a few servos because I over-shot the range.
I use MG996R servo. These servos to begin with do not have the best quality. I found this code awhile ago:

Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
#define MIN_PULSE_WIDTH 650
#define MAX_PULSE_WIDTH 2350
#define DEFAULT_PULSE_WIDTH 1500
#define FREQUENCY 50
#define DELAY 1000

/* servo PWM function */
int pulseWidth(int angle)
{
    int pulse_wide, analog_value;
    pulse_wide = map(angle, 0, 180, MIN_PULSE_WIDTH, MAX_PULSE_WIDTH);
    analog_value = int(float(pulse_wide) / 1000000 * FREQUENCY * 4096);
    //Serial.println(analog_value);
    return analog_value;
}

in the hope that I can map the range to as close to a full 180 degrees sweep.
Is this the correct apporach to adjust the servos so that they won't crash? Thanks.

If you look at the spec sheet for the servo, it specifically says "120 degrees rotation" ie 60 degrees each direction.

MG996R_Tower-Pro.pdf (98.4 KB)

Hi,
How are you powering the servos?

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom... :slight_smile:

TomGeorge:
Hi,
How are you powering the servos?

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom... :slight_smile:

There isn't much to draw. Basically, I use a 16-channel board to drive each servo. The board itself I use the 5v Arduino power. for the servos I use an external power supply, in order to give the servos higher torque. I gave the servos 6-7v. I read that the MG996R can tolerate as much as 7v. When I use the above code. some of the servos can reach very close to 180. But few of them only reach up to about 160.

I found this code awhile ago:

That code will not even compile, you have to post all your code for it to make any sense. Please read the how to use this forum sticky post, it will tell you how to ask a question.

There isn't much to draw

Yes there is, but if you don’t want help this is the right way to go about not getting any.

But few of them only reach up to about 160.

Pretty impressive for a 120 degree servo!

Maybe if you crank the voltage even higher you could break through the endstops.