I am trying to get a servo motor to work with my raspberry pi for the first time. I have successfully got it to turn when I run a simple python script but was just wondering if this problem is because the servo motor needs to be powered externally by itself? I read online that the current being drawn to move the servo can sometimes be too much for the PI to handle powering from just the board. I also understand that the PWM needs to be setup right according to your servo. I have tried about 5 different scripts and all of them have the same outcome. I followed along a youtube tutorial where they are using the exact same pi and servo motor.
If I do need to power the servo separately can I do so using some AA alkaline batteries in series? I know there are better ways to power the servo using separate 5v power supply boards but would like to know this is the problem before i buy them.
servo: SG90 9g
Video of the servo stopping in a while True continuous loop:
https://www.youtube.com/watch?v=XCAj4k8lu40 (https://www.youtube.com/watch?v=XCAj4k8lu40)
My python script running on the Pi:
from gpiozero import Servo
from time import sleep
myGPIO=4
servo = Servo(myGPIO)
print("Rassberry Pi Servo");
while True:
servo.min()
sleep(0.5)
servo.mid()
sleep(1)
servo.max()
sleep(1)