servo range of motion

Hi;

I am using a HiTEC HS-322HD servo connected to the PWM Out port of the Edu controller.

I wonder if it is possible to make the servo turn more than it turns now.

Right now I am using code like …
pwm08 = 0;
or
pwm08 = 255;
(those being the extremes) and the servo turns a total of about 180 degrees.

I see some sample code in the default code like this …

Example: The following would generate a 40KHz PWM with a 50% duty cycle on the CCP2 pin (PWM OUT 1):
CCP2CON = 0x3C;
PR2 = 0xF9;
CCPR2L = 0x7F;
T2CON = 0;
T2CONbits.TMR2ON = 1;
Setup_PWM_Output_Type(USER_CCP,IFI_PWM,IFI_PWM,IFI_PWM);

but search as I might, I do not see anything telling what this is all about.

Is this type of code used to have better control over servos?

Apparently Setup_PWM_Output_Type() is defined in ifi_library.c which I do not see that file in the distribution.

Any pointers appreciated.

There really isn’t anything you can do beyond what you’re already doing with the pwm outputs. Servo’s only have a certain range (generally around 180degress) and the only way to get them to turn beyond that is to modify the servo itself.

Tux,

Your confusion is based on what a PWM is. For nearly everyone except the radio control crowd, a 50% PWM wave is a square wave. Likewise, a 0% PWM signal is a steady DC signal at the lower rail (usually 0 volts) and 100% is a steady DC signal at the upper rail (usually 5 or 12 volts). I would call this definition “classical”.

In the RC world, a 1 ms pulse every 10 milliseconds is neutral, whereas a 0.5 ms pulse is full reverse and 1.5 ms is full forward.

The default for our PWM signals is the RC type. The code example you cited will allow you to create a “classical” PWM signal.

This classical PWM output will not help you get more rotation out of a servo.

Now, let’s address your problem:

My suggestion is to tandem two servos together. Just align the axis of rotation and attach the dial of the first servo to the back of the second servo (plastic epoxy would work just fine) and connect both servos to the same RC PWM output via a Y cable. This would give you approximately +/- 180 degrees of rotation versus the +/- 90 you get from one servo and would have been legal by this years rules.

Hope this helps…

The HiTEC HS-322HD servo has a range of travel of just about 200 degrees. You can take it apart and physically cut off its internal position feedback to make it act more like a motor, but then it wouldn’t be a servo anymore.

If you want a servo with a greater range of travel, consider using a big gear on the HiTEC connected to a smaller gear on whatever it is you want to move to a specific direction.

This is from the IR beacon code used in last year’s game.

-Kevin

Edit: Actually, it’s early beacon code circa November 2003.