Servo pushed to 0 position when using external power

Hello,

I’ve been having some trouble with my servo (SM-S2309S), where when it is supposed to move counterclockwise (and only counterclockwise), instead of going to the correct position, it would kind of just go a little in that direction, then about halfway back, then just shake a lot. I wasn’t really sure what the issue could be, but since I was powering it using the Arduino, and I read that can lead to issues, I bought a 4x AAA container, which should be 6V, as far as I know. The issue is when I plug the servo into it, it just jumps to the zero position, and won’t move from it, no matter what my potentiometer is at. Am I overpowering the servo or something?

To connect the servo to the box, I took out the two orange cables that connect the +/- lines in the picture and plugged the box in instead.

#include <Servo.h>
Servo myservo;


int x;
int angle;


void setup() {
myservo.attach(10);
Serial.begin(9600);

}

void loop() {
  x = analogRead(A1);
  //Serial.println(x);
  angle = map(x,0,1023,0,179);
  Serial.println(angle);
  myservo.write(angle);
  
}

You musn’t provide anything outside the Arduino supply range to its pins, which means the potentiometer
must not be connected to the servo supply at all, that risks burning out the Arduino pin, or the whole
chip.

So Arduino GND, 5V, analog pin to potentiometer,

servo supply GND , 6V to servo.

servo control signal and ground to arduino.

MarkT:
You musn't provide anything outside the Arduino supply range to its pins, which means the potentiometer
must not be connected to the servo supply at all, that risks burning out the Arduino pin, or the whole
chip.

So Arduino GND, 5V, analog pin to potentiometer,

servo supply GND , 6V to servo.

servo control signal and ground to arduino.

Sorry, I may be misunderstanding, but I do have the potentiometer power connected to the 5V, and the servo connected to the 6V (added new picture, must not have explained what I did well). Does that look right?

You don't have the battery -ve connected to the Arduino GND. That's why it's not responding to any signals.

But why do you expect the servo only to move in one direction? That doesn't make much sense.

Steve

slipstick:
You don't have the battery -ve connected to the Arduino GND. That's why it's not responding to any signals.

But why do you expect the servo only to move in one direction? That doesn't make much sense.

Steve

Huh, that did it, thanks. I clearly don't have the slightest clue how these things work, lol.

I don't want it to just move one direction, I just meant the issue of the servo not moving and just fidgeting in place only happens when I'm trying to get it to move counterclockwise (towards zero position) for some reason. It's not happening with my current circuit, so I guess I'll just hope it doesn't happen again