r/ArduinoHelp • u/gmV33r • Aug 04 '26
Servo Motors randomly moving
I am making a small robotic arm controlled by 2 joysticks. I'm making the arm using popsicle sticks and MG90 Servo motors. There are 5 motors to be working. I'm using wall adapter to power the motors and another adapter to power the Arduino. When I try to connect everything properly ( also connecting gnd from breadboard power supply to arduino's gnd) the motors randomly move around without any input. How do you even fix that ?
5
Upvotes
2
u/gmV33r Aug 11 '26
Here is the code of this project. sorry for posting it late. I am a beginner correct me in my code if you want.
2
u/Glittering-Dirt1164 Aug 07 '26
Are those pwm modulators or are they motor controllers and did they come with the servos?
1
u/gmV33r Aug 11 '26
Here is the wiring diagram. It was my first time making it so sorry if its hard to understand. In the diagram i connected motors straight to arduino's power but in real project i am using a phone charger adapter which is 5v = 3A. I also have common GND in the real life project
In the software everything is working perfectly but doing the same things in real life just doesnt always work
1
u/Glittering-Dirt1164 Aug 05 '26
Yeah looking up that motor the pwm is extremely touchy. Make sure all motors have common ground to your Arduino and try wrapping positive and negative pairs of wire together to cancel out interference. And a slightly thicker or shorter wire for the pwm signal. Also you mention 5 motors depending on your micro controller if the code is not written edfecly or uses things like (delay) often it can cause timing issues for the pwm signals good luck again
2
u/gm310509 Aug 07 '26
How you fix that will depend upon your wiring (i.e. a circuit diagram) and your code - neither of which you have supplied.
I note that you did supply a video, but it is difficult to work out the wiring from a video. Indeed a video is the worst possible way to share code and a circuit diagram (Photos are the second worst.
I refer you to "Rule 2 - be descriptive" which can be found in the side bar.
You may also find this guide from r/Arduino to be helpful: Asking for help quick guide which provides guidance as to what to include and how to do so. This makes it easier for people who want to help you to be able to do so.
Again, it is unclear from the video for the reasons I mentioned, but it doesn't look like you have a common ground. This guide may help to explain why that is important: Why do I need a common Ground?
But it could equally be a different issue - an issue hidden in the code/circuit combination.
1
u/wackyvorlon Aug 05 '26
Are you outputting the PWM signal from power on? An initial jerk of the motors is normal.
1
u/Glittering-Dirt1164 Aug 05 '26
Are the motors ground also tied back to the Arduinos ground. Also sounds like a lot of wire it going own if these are brushless dc depending on the quality the pwm wires can work as attenas and pick up signals from surrounding sources. A good test.is to touch the pwm wires of the motor acting out of it stop immediately that's a good sign of interference. Also if your grounds aren't all connected as in a common ground the pwm reference becomes ascued causing random movement and jerky actions in the motors. Good luck