I just brought home a servo that does full rotation, and I'm having a hard time getting it to behave as expected. I think I've figured out the problem in the course of creating this posting, but I'll continue anyways, as it may save others some of the frustration I've had today.
So, the project I have in mind uses something like an analog clock face. It will have one arm that points to the appropriate condition. For this I bought a servo that moves the full 360 degrees. However, it turns out this servo is a "Continuous rotation" servo (SM-S4303R). I didn't think much about that at the time, but the net result seems to be that it cannot be commanded to go to a particular spot on the dial. Instead, this servo is basically a motor, but with fine grain control over the velocity.
I tried following a number of tutorials, but the results never seem as expected. For example, this code snippet...
Code: Select all
import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setup(17, GPIO.OUT) p = GPIO.PWM(17, 50) p.start(7.5) try: while True: p.ChangeDutyCycle(7.5) time.sleep(1) p.ChangeDutyCycle(12.5) time.sleep(1) p.ChangeDutyCycle(2.5) time.sleep(1) except KeyboardInterrupt: GPIO.cleanup()
If you think I've got this wrong, please let me know. I will go shopping again tomorrow and try for a 360 servo that is not continuous rotation.