Using PWM to control servo
Archiver
Posts: 46,084
Hi all,
Wondering if any of you know how to control the precise degree of
motion for servo motor using Basic Stamp 2.
For duty cycles of 0 to 127, I turn in one direction and from 128 to
255 duty cycles, I turn in another direction. But I do not know how
to control the angle of turning.
How does the number of cycle affect the angle of turning as well as
the speed of turning?
Sample Program
PWM 0, 0, 50 ' 50 cycles of PWM at 0/255 duty
PAUSE 2000
Thanks for the Help
Wondering if any of you know how to control the precise degree of
motion for servo motor using Basic Stamp 2.
For duty cycles of 0 to 127, I turn in one direction and from 128 to
255 duty cycles, I turn in another direction. But I do not know how
to control the angle of turning.
How does the number of cycle affect the angle of turning as well as
the speed of turning?
Sample Program
PWM 0, 0, 50 ' 50 cycles of PWM at 0/255 duty
PAUSE 2000
Thanks for the Help
Comments
If your servo "centers" at 1.5mS, you'd write something like this (on
the BS2 only):
servo:
PULSOUT 0,750 ' center servo
PAUSE 20 ' wait 20mS
GOTO servo
Of course, you could do something for roughly 20mS too. Then to make it
go to a different position, change 750 to a different number. The number
will determine the position.
The PAK-VIII is great at controlling 8 different servos at once
(http://www.al-williams.com/awce/pak8.htm).
Al Williams
AWC
* 8 channels of PWM
http://www.al-williams.com/awce/pak5.htm
>
Original Message
> From: vif@r... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=uwa7ZBNdmoBMci2Cwnpuk2WibUZj0GVw2Bxfh78MOh87UZHYJs3nW-cxvgZSE2Y35c-au1_lq3BQGAof]vif@r...[/url
> Sent: Tuesday, November 13, 2001 3:24 AM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] Using PWM to control servo
>
>
> Hi all,
>
> Wondering if any of you know how to control the precise degree of
> motion for servo motor using Basic Stamp 2.
>
> For duty cycles of 0 to 127, I turn in one direction and from 128 to
> 255 duty cycles, I turn in another direction. But I do not know how
> to control the angle of turning.
>
> How does the number of cycle affect the angle of turning as well as
> the speed of turning?
>
> Sample Program
>
> PWM 0, 0, 50 ' 50 cycles of PWM at 0/255 duty
> PAUSE 2000
>
> Thanks for the Help
>
>
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
> Subject and Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>