I have a Raspberry Pi 3 (Model B). I'm trying to drive a servo motor (Tower Pro MG 995). I am using a 6V power supply (4 AA batteries) connected to power and ground of the servo motor. I attach the battery ground to the GND of the pi and the signal wire to GPIO pin 18 on the Raspberry Pi. I'm running the following code:
# Import GPIO Libraries import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setup(18, GPIO.OUT) p = GPIO.PWM(18, 50) p.start(7.5)
I'm running this from a Jupyter notebook, and when I measure the signal going into the motor signal wire at this point I get this:
The motor does not move at all.
I can then call:
Which changes the pulse width just as one would expect, and the motor does not turn at all.
When I initially plug in the motor to power, it jumps "forward" a certain angle. When I remove and reapply power to the motor it jumps "forward" again the same amount. I can repeatedly do this until it reaches the end of its range.
I've tried three different motors and get no movement at all when setting or changing the input signal.
Any ideas about what I'm missing, or what else I can try?