Calibrating a Futaba S3003 servo for continuous rotation
NZ Peter
Posts: 3
Hi, I am very new to the world of programming and the BS2 and I am wanting to find the center position for·a Futaba S3003 servo. I am using this code (bellow) to center them. This code was originally designed for centering a "standard" servo (i.e controlled by a 1-2ms pulse).·Using this code·my futaba servos do not move at all.·Can anyone please show me how to modify this code (or where I can find a better code) for the·servo that I have?
' Calibrate - Find the center/not moving piont for servo
' {$STAMP BS2}
' {$PBASIC 2.50}
' Variables
Servo········ PIN 15
CurrentDelay· VAR Word··· ' Servo Center Point
i············ VAR Byte
' Initialization/Mainline
LOW Servo·········· ' Set Servo pin low
CurrentDelay = 750· ' Start at 1.5 ms
DO
· DEBUG "Current Servo Delay Value = ", DEC CurrentDelay, CR
· FOR i = 0 TO 50·· ' Output servo value for 1 second
··· PULSOUT Servo, CurrentDelay
··· PAUSE 18······· ' 20 msec Cycle Time
· NEXT
· DEBUG "Enter in New Delay Value "
· DEBUGIN DEC CurrentDelay
· DO WHILE (Currentdelay < 500) OR (CurrentDelay > 1,000)
··· DEBUG "Invalid Value, Must be between 500 and 1,000", CR
··· DEBUG "Enter in New Delay Value"
··· DEBUGIN DEC Currentdelay
· LOOP
LOOP
·
' Calibrate - Find the center/not moving piont for servo
' {$STAMP BS2}
' {$PBASIC 2.50}
' Variables
Servo········ PIN 15
CurrentDelay· VAR Word··· ' Servo Center Point
i············ VAR Byte
' Initialization/Mainline
LOW Servo·········· ' Set Servo pin low
CurrentDelay = 750· ' Start at 1.5 ms
DO
· DEBUG "Current Servo Delay Value = ", DEC CurrentDelay, CR
· FOR i = 0 TO 50·· ' Output servo value for 1 second
··· PULSOUT Servo, CurrentDelay
··· PAUSE 18······· ' 20 msec Cycle Time
· NEXT
· DEBUG "Enter in New Delay Value "
· DEBUGIN DEC CurrentDelay
· DO WHILE (Currentdelay < 500) OR (CurrentDelay > 1,000)
··· DEBUG "Invalid Value, Must be between 500 and 1,000", CR
··· DEBUG "Enter in New Delay Value"
··· DEBUGIN DEC Currentdelay
· LOOP
LOOP
·
Comments
I am using a book (123 Robotic experiments for the evil genius) and it says the code needs modification for futaba servos as they are controlled by a 1-1.5ms pulse although I don't really know how to make that modification properly
servo:
pulsout 15, 750 ' center /// full range is 500-1000
pause 20
goto servo
The servo now moves! but it won't stop running despite changing the position of the pot wiper (which is a liltte trimpot that i connected to the bottom of the servo).
Changing the range value causes the servo to pause for about 1 sec as the program gets transfered to the chip, when the servo starts up again it runs in the same direction (clockwise) at the same speed (fast).
If I stop the BS2 (with the 6v external still connected to the servo) the servo stops. Also when I hook the servo up to and RC controller I can stop it and move it backwards and forwards by moving the pot wiper. So it must be something to do with the pulse the bs2 is sending to it.
Ive been reading through the BS2 manual and I came accross a function called PULSIN. are there programs/code that can measure the PWM of the RC Controller so I can sort out what pulse to send my servos?