simple servo setup wont work

Hello,

I just dont know what i am doing wrong this setup of mine is actually realy simple. Everything works when i connect the servos directly to 5v and Vin and ground on the arduino for testing purposes, but when i try to do it like in the picture where i just ground everything with the 2 5V adapters and then connect each servo to the +5V output on the adapter the servo doesnt move at all. I still power the arduino with USB.

Servos: red=+5V, brown=ground, orange=signal

Arduino: jellow= ground

Adapter1: white= ground, black = +5V
Adapter2: purple= ground, grey= +5V

This is my code but that is probably not the problem, it is just for testing:

#include <Servo.h>

Servo sX;
Servo sY;

void setup()
{
// put your setup code here, to run once:
sX.attach(9);
sY.attach(10);
delay(2);
}

void loop()
{
// put your main code here, to run repeatedly:
sX.write(0);
sY.write(0);
delay(1500);
sX.write(180);
sY.write(180);
delay(1500);
}

OPs pics

I cannot make heads or tails out of what is connected to where from your pics.
I DO see a wire from ground on the Uno to the breadboard. Just a note, I try to use a black wire for the ground to make easier to identify.
Also, if you are going to plug the ground wire in to the power bus on a breadboard, use the - rather than the +
I guess (cannot really tell) that you are misinterpreting how the breadboard works.
Power bus (red + and blue -) on each side share contacts along the entire length of the breadboard.
However, the contacts in the middle are grouped into sets of 5 that go across the width.
1a, 1b, 1c, 1d and 1e are all joined.
1f, 1g, 1h, 1i and 1j are all joined.
Those 2 sets are not joined to each other.

It I were to wire this, I would put a ground from the power adapter to the blue ground bus (-) on the breadboard and put the grounds for all your servos on that same (-) bus.
Also put a ground from the arduino to the ground bus (-).
I would put the 5v from the power adapter to the red positive bus (+)on the breadboard and put the 5v from all the servos on that same (+) bus.

Then the signal wires like you have them now.

A good place to start is to acquire the Arduino cookbook by Michael Margolis and read it. You will find on line many videos etc showing the Arduino and how to do what you want. This additional information will go a long way in getting your problem solved. That would be a good point to start on the hardware design and write your software.

Could be wiring/connection issues or a power supply issue. Those look like fairly large servos. Below is a typical servo wiring setup.

servo power.jpg

servo power.jpg

First of all thanks for trying to decipher what i have done from my not so optimal pictures. I never worked with Arduino before but i dont plug random wires in the breadboard, so i know how it is wired. That my ground line is + is maybe a bit confusing but i mean it doesnt realy change anything, still should have put it in - so it would have been easier for you guys to understand.

vinceherman:"It I were to wire this, I would put a ground from the power adapter to the blue ground bus (-) on the breadboard and put the grounds for all your servos on that same (-) bus.
Also put a ground from the arduino to the ground bus (-).
I would put the 5v from the power adapter to the red positive bus (+)on the breadboard and put the 5v from all the servos on that same (+) bus."

Yeah, this is pretty mutch exactly what i did here. The only difference is i have a seperate 5V Adaper for each servo.

gilshultz:"A good place to start is to acquire the Arduino cookbook by Michael Margolis and read it."

Thank you for the advice gilshultz, i might look into that if i got enough time.

Zoomkat, i think this is exactly what vinceherman described. Only thing here: Is there any reason to pick D2,D9,D12 over the other pins ?

So from what i have read i think my circuit should be wired correctly. I tested the power supplies, they work. I tested the code, it works. And the servos also work. Maybe it has to do with the inner workings of my Arduino (but as stated before it also works but only if i directly use the power from the USB to power the servo) or i just missed something more obvious. If anyone got a differet idea, i would be glad to hear it.

I can't see from that picture but if you have BOTH "5V adapter" negatives, both servo negatives and the Arduino GND all connected then your circuit looks reasonable.

I also can't see exactly what servos you're using but they look fairly big and breadboards are notoriously bad at handling the sort of relatively high currents that servos need on startup. The connections get loose and high resistance. It might be worth just trying some different positions for the connections.

Also what is the current capability of your "5V adapters"?

Steve

These are my servos: https://www.electronicoscaldas.com/datasheet/MG996R_Tower-Pro.pdf,
and my power supplys got an Output of 5V 1000mA.

Your 5V power supply is totally inadequate for those servos.

The MG996R servos EACH draw the start/stall current of 2.5 Amperes (2500 mA) every time they start moving.

If you have two of them, you need a 5-6V, 5 Ampere servo power supply.

Do NOT use a breadboard for servo power as the tracks will burn. Instead, use a servo power distribution board, or solder the power connections. Don't forget to connect all the grounds.

If you really had both of those servos working normally from the Arduino 5V pin then I'm amazed. USB and that pin can't provide anywhere near the current needed for 2 x MG996Rs.

Try it with a better power supply and no breadboard.

Steve