November 17, 2024, 09:43:47 PM

News:

Be sure to checkout our Vixen interfaces in the Library forum -- if you want PC automation at near zero cost, EFX-TEK and Vixen is a great combination of tools.


Parrot Problems

Started by tstamand, May 18, 2008, 06:03:27 PM

Previous topic - Next topic

tstamand

I am trying to simulate a parrots head turning slowly. I am using a Hitec HS-475HB servo connected to a prop-1. The servo has a 0.24 speed and the person I am building the bird for feels that is too fast. Since I have already built the frame and installed the pan and tilt brackets for a standard size servo, I am open to any suggestions on how to do this, without re-engineering the whole thing. It seems that finding faster servos is not a problem, but slower ones in a standard size are.

Thanks,
Tom

JonnyMac

What range of motion are you looking for?  The way to slow a servo is to manually move it to intermediate points along its arc; you can do this with a program loop.
Jon McPhalen
EFX-TEK Hollywood Office

tstamand

I am trying to move the head 45 degrees off rest in both directions.

Tom

JonnyMac

This program demonstrates how I control servo speed: instead of going directly from point a to point b at full speed, it moves to intermediate points along the way (defined in the variable, pos) and can even "hold" at those points briefly.  If you have more iterations in your loop (i.e., more positions along the way to move to) the servo will move more slowly.  If you need to go even slower you can hold at each position more than one time.

' =========================================================================
'
'   File...... Servo_Control.BS1
'   Purpose...
'   Author.... Jon Williams, EFX-TEK (www.efx-tek.com)
'   E-mail.... jwilliams@efx-tek.com
'              Copyright (c) 2008 EFX-TEK
'              Some Rights Reserved
'              see: http://creativecommons.org/licenses/by/3.0/us/
'   Started...
'   Updated... 19 MAY 2008
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

SYMBOL  Servo           = 0


' -----[ Constants ]-------------------------------------------------------

SYMBOL  IsOn            = 1                     ' for active-high in/out
SYMBOL  IsOff           = 0


' -----[ Variables ]-------------------------------------------------------

SYMBOL  pos             = B2
SYMBOL  hold            = B3


' -----[ Initialization ]--------------------------------------------------

Reset:
  LOW Servo


' -----[ Program Code ]----------------------------------------------------

Main:
  DEBUG "100 positions, hold = 0", CR
  FOR pos = 100 TO 200
    hold = 0
    GOSUB Update_Servo
  NEXT

  DEBUG "20 positions, hold = 2", CR
  FOR pos = 200 TO 100 STEP -5
    hold = 2
    GOSUB Update_Servo
  NEXT

  DEBUG "100 positions, hold = 5", CR
  FOR pos = 100 TO 200
    hold = 5
    GOSUB Update_Servo
  NEXT

  DEBUG "50 positions, hold = 2", CR
  FOR pos = 200 TO 100 STEP -2
    hold = 2
    GOSUB Update_Servo
  NEXT

  GOTO Main


' -----[ Subroutines ]-----------------------------------------------------

' Updates servo position; if hold > 0 then servo will remain in this pos-
' ition additional 20 ms cycles.

Update_Servo:
  PULSOUT Servo, pos
  PAUSE 20
  IF hold = 0 THEN Servo_Exit
    hold = hold - 1
    GOTO Update_Servo

Servo_Exit:
  RETURN

' -------------------------------------------------------------------------


' -----[ User Data ]-------------------------------------------------------
Jon McPhalen
EFX-TEK Hollywood Office

tstamand

Thanks, I'll give it a go.

Tom