360 degree servo vs Continuous Rotation


4 posts
by Thommango » Mon Sep 30, 2013 3:02 am
Hi all,

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()


...just causes the servo to spin around in one direction or another, varying speed but never stopping at a given location. If I change the time.sleep duration to 60, it will just spin around for a full minute. This being a servo, my expectation was that the servo would stop at a given orientation.

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.

Cheers,

Thom
Posts: 6
Joined: Sat Mar 02, 2013 2:58 pm
by ame » Mon Sep 30, 2013 4:48 am
You've got it right.

As you know, the pulse width of the RC servo control signal sets the output position of the servo arm. Typically the servo arm has a range of about 180 degrees. A pulse of 1.5ms will move the servo arm to the centre position (say, 90 degrees) and pulse widths of 1ms and 2ms will move the servo to 0 degrees and 180 degrees (approximately).

It is possible to modify a regular RC servo for continuous rotation. You do this by replacing the position potentiometer inside with a voltage divider set to 50%, or disconnect the drive linkage to the potentiometer and set it to the half-way position. In this case, since a pulse of 1.5ms corresponds to the centre position, and the servo always 'thinks' it's in the centre position then the servo won't move. Pulses of less than 1.5ms will cause the motor to run continuously one way, and pulses of greater than 1.5ms will cause it to run the other way, since the servo controller will try to move the motor to return the servo arm to the centre position. This will never happen of course, so the motor keeps running.

The 360 degree servo has a potentiometer that will allow the output arm to turn through 360 degrees. Again, a pulse of 1.5ms will move the servo arm to the centre position (say, 180 degrees) and pulse widths of 1ms and 2ms will move the servo to 0 degrees and 360 degrees (approximately). Obviously this is the same point, but you arrive from a different direction.

There are also multi-turn servos (720 degrees or more), used for RC model boat sail winches.

I think the servo you have is no good for your application. If you can't find a servo with a wider output range then how about a stepper motor? Or try dismantling a regular servo and adding a gear to extend the range of the potentiometer. Or have a regular servo drive a pulley with a 1:2 ratio. I expect your clock face indicator has very little load.

Good luck.
Posts: 919
Joined: Sat Aug 18, 2012 1:21 am
Location: Japan
by Thommango » Tue Oct 01, 2013 2:02 pm
Thanks. I ended up buying a step motor and a daughter board controller. But this project is going to go on my urban lawn and will be subjected to weather, snowballs and curious/nefarious teens, so I want to keep the parts cost down. So, after thinking it through some more (albeit belatedly), I've decided on a cheaper approach:

A simple motor will drive a "clock arm" that includes a magnet. Gearing will ensure that the clock arms move at a gentle pace. Reed switches will be placed at the target stop points. When the correct reed switch is sensed, power to the motor will be cut.

So now I've got to learn about using gears, I guess.
Posts: 6
Joined: Sat Mar 02, 2013 2:58 pm
by Thommango » Tue Oct 01, 2013 2:39 pm
Actually, now I'm noticing that I can get very cheap stepper motors on ebay. So, I'll try that approach.
Posts: 6
Joined: Sat Mar 02, 2013 2:58 pm