My servo works in a strange manner.

Hello!

My name is Bryan and I have a problem, and I would like to ask for some help. I would appreciate if you can help me!

The last month I bought a pair of servos for a school project. I have proven it with the example code named "sweep" and something unexpected happened.

When I uploaded the code, the servo started to turn, but the first time I have proven them, the turns are to the same side (clockwise) in both servos. I mean, they turned in clockwise for almost 540 degrees. they stopped during a little bit of time, then they continued turning to the same. The two servos were powered with 4 AA batteries.

I have connected only one servo directly to the gnd and 5v pins of the arduino and the servo started to work almost correctly. It turned first to the right, stopped, and turned to the left.

But the servo turns almost 540 degrees in each sense of turning.

I tried to check what the servo does with the instruction myservo.write(angle) and i´ve discovered that with an angle of 0, the servo turns to one side, and with 180 degrees, the servo turns to the other side. I´ve also tried with 90, 40, 15, but the only thing that changes is the angular speed.

Someone could give me some help with this? I do not understand nothing! Isnt be supposed that the instruction myservo.write(x) controls the position of the servo shaft? Or each servo works in a diffrent way? Please help me, im desperate!

I have a Mega 2560 board, and the servos are mg995.

Thanks in advance and regards!

Bryan Espinoza, Mechatronical engineer student.

Servo problems are usually caused by an inadequate power supply. Are your AA batteries brand new? Check the battery voltage with the servos running.

But the servo turns almost 540 degrees in each sense of turning.

Most servos have internal stops, and the MG995 has a specified rotational range of 180 degrees. I don't understand how you could possibly have 540 degrees.

You should not power a servo from the Arduino 5v pin. It cannot provide enough current and the Arduino might be damaged. Use a separate power supply (perhaps 4 x AA NiMh batteries in a battery holder. Make sure to connect the servo GND to the Arduino GND.

As @jremington has said, 540 deg is very strange.

Have the servos have been modified for continuous rotation?

...R