Servo not working with breadboard power supply

So, I got these breadboard power supplies, and tried connecting the 5V of a SG90 Servo to the 5V and the GND of it to the Gnd of the power supply. Then, I put the other pin to digital pin 9 on the Uno, and used the USK guide code #8 for the servo code. I connected a 9V battery to the DC-IN part of the power supply, and uploaded the code. When I turned the power supply on, the servo spun around really fast to the 180 degree position, so I unplugged it. When I connected the entire servo, GND and 5V and all, it worked with the code perfectly fine. I can't figure out why the Servo is not working with the power supply. Any help is appreciated!

Thanks in advance, Danny.

I can't figure out why the Servo is not working with the power supply. Any help is appreciated!

If the 9v battery is one of the square ones, it might power a servo a minute or so before being depleted. Also the arduino ground and servo grounds need to be connected together along with the external power supply ground.

I connected a 9V battery to the DC-IN part of the power supply, and uploaded the code. When I turned the power supply on, the servo spun around really fast to the 180 degree position, so I unplugged it. When I connected the entire servo, GND and 5V and all, it worked

this sentence is a bit ambiguous to me, what exactly did you change? specifically “when i connected the entire servo”. This implies that it was only partially connected in your other test?

Your configuration is confusing. i cant tell if you connected arduino via usb AND the power supply at the same time and thats why you got the rotation at upload or the code was a sweeping code and thats what it does. Sweeps. nonetheless,

check that you are indeed using 5v and not 3v3. there is usually a switch or jumper to modify the output voltage of the breadboard power supply

check to see if your breadboard power rails are receiving the 5v and ultimately to your arduino.

A common practice that i use is to upload sketches without anything connected to arduino just the USB. Especially motors and servos. debugging code after initial upload is simple if you use a protoshield and utilize the reset button.

this might be redundant but I am assuming you are powering the arduino by breadboard power supply and have both 5v and gnd connected to arduino, that all grounds ie. power supply board, servo, etc are connected.

And by your previously pointed out "ambiguous" admittance

When I connected the entire servo, GND and 5V and all, it worked with the code perfectly fine

the problem does indeed lie within your breadboard power supply.

I've got some cheap ebay breadboards anf jumpers, and they often do not make good connections. That would be significant if routing a motor power supply thru the bread board. Jiggle the wires and look for a bad connection.

Servo's need an amp or more, this is more than breadboards can handle reliably and way beyond the ability of a small 9V battery. Quality rechargable AA's are normally the wise choice.