Servo spins out of control when gyro/accelerometer moves too fast

I have an Arduino Uno with two MG90S tower pro micro servos, a MPU6050 and an external 5v adapter. My servos are controlled by the MPU6050 via signal wire for each servo. The problem is that when the servos get inputs that are too fast they tend to spin unstoppably (beyond 360 degrees). I don't believe there is any problem with the MPU6050 as this problem has occurred before when I used a Joystick to control the servos (although i did not use an external power supply on that project).
The servos are powered by an external 5V power adapter. The servos are directly connected to the positive wire of the external power adapter and the servos are connected to a breadboard connected to the ground pin of the arduino. The ground of the power adapter is connected to the bread board in line with the arduino's ground. The MPU6050 is connected to the arduino GND and 5V.
I plug my arduino uno into my PC and I plug the external adapter. The servos move back in the default position. I start moving the MPU6050, the servos respond just fine. I have a bit of twitching/noise but its not a big deal. What is a big deal however is that when I start moving the MPU6050 back and forth quickly, one of the servos will begin to continuously rotate over 360 degrees uncontrollably and endlessly in one direction. I pull out the USB cable on the arduino, it's still spinning. I pull out the external adapter, it stops spinning. When I pull out the servo power first, it stops but when I plug it again it stops working so I have to replug the arduino's USB cable to get the servos to respond. This problem happens with both servos but it more commonly happens with one at a time.
EDIT: Servo even spins out of control if I slightly shake the MPU6050. it happens more often on one servo than the other but both still do it. If I shake the MPU6050 even a little bit, the suspicious servo responds erraticly. The suspicious servo is notably more loud than the other servo. These servos were never modified AFAIK.
FBNZ04FI194496R.ino (1.5 KB)

As the data sheet for your servo says

  • Rotation : 0°-180°

If it is rotating continuously it is broken.

Never remove power from a system one bit at a time, that is a good way of breaking things.

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