can any one help me to test the Servo motor with Basic Stamp
Hi.
i am working on my graduation project which is about controlling a robot arm to do some kind of spiral rotation,am using the basic stamp2 microcontroller ,i have tried to test whether i can control a servo motor using BS2 SEROUT instruction, but that seems a little bit difficult, the servo does not make any movement.
please if you have any idea, that will help me much.
thank you.
i am working on my graduation project which is about controlling a robot arm to do some kind of spiral rotation,am using the basic stamp2 microcontroller ,i have tried to test whether i can control a servo motor using BS2 SEROUT instruction, but that seems a little bit difficult, the servo does not make any movement.
please if you have any idea, that will help me much.
thank you.
Comments
Connect your servo to pin 14.
' What's a Microcontroller - ServoTest.bs2
' Test the servo at three different position signals.
' {$STAMP BS2}
' {$PBASIC 2.5}
counter VAR Word
main:
DEBUG "Counterclockwise 10 o'clock", CR
FOR counter = 1 TO 150
PULSOUT 14, 500
PAUSE 20
NEXT
DEBUG "Clockwise 2 o'clock", CR
FOR counter = 1 TO 150
PULSOUT 14, 1000
PAUSE 20
NEXT
DEBUG "Center 12 o'clock", CR
FOR counter = 1 TO 150
PULSOUT 14, 750
PAUSE 20
NEXT
DEBUG "All done."
GOTO main
Post Edited (kf4ixm) : 12/25/2009 1:41:39 AM GMT
Here: www.parallax.com/tabid/535/Default.aspx
i was reading a book with the Aric Robot just using the "SEROUT" to control the servo motor, i have seen the PULSEOUT but i did not try it. i will try it and will give u any feedack, whether it works fine or not...
one more thing to ask you is: how can i canvert an angle to a pulse and vice verse, what i mean is that i am just making the kinemetics of the design, i will find angles of the robot arm joints when i am done with the kinemetics and inverse kinemetics, when it comes to programming the basic stamp, it only needs a pulse as an input the move the servo motor to a posotion defined by that angle, so can you think about this...just try it and tell me your findings.
thank you
pulsout 14, 750
if you change the '750' to '1200', you will notice the servo index to the far right, 300 to the far left. i would start with taking the pulse span, 1200-300=900, divide that by 180, (most servos will go to 210 degrees, 180 will be safe), you will come up with 5. therefore if you increase the pulseout command by 5, (eg. pulsout 14, 300; pulsout 14, 305; pulsout 14, 310) this will ROUGHLY give you one degree of motion for each increase of 5. Now i say Roughly because of the fact that most servos will have some kind of 'slop' between the geartrain and the potentiometer inside the servo. age, use, brand of servo·and even temp will have some sort of effect on the actual position also.
http://www.seattlerobotics.org/guide/servos.html
Post Edited (kf4ixm) : 12/25/2009 1:35:32 AM GMT