Using the stamp to maintain servo position...
Archiver
Posts: 46,084
In a message dated 7/12/2004 12:07:14 PM Eastern Daylight Time,
hangook21@y... writes:
> I'm still looking for a solution to maintain a servo position while
> allowing the stamp to work on other things. Obviously I can
> continually pulse at 20 ms intervals the position that I want, but is
> there either a hardware or software method of positioning a servo so
> that it maintains its position?
>
You can do this with a standard servo that is not modified for continuous
rotation with no problem. If you want to do it with a continuous rotation servo,
it gets a bit tricky. The problem is you only have the 20ms between pulses
to do something else with the Stamp, although the pause between pulses could
probably be increased to 30ms. Something like
standstill:
x = 850
pulsout servo, x
pause 20
pulsout servo, x-1
pause 20
goto standstill
The servo would actually oscillate between 850 and 849, but that's pretty
close to standing still.
Sid
[noparse][[/noparse]Non-text portions of this message have been removed]
hangook21@y... writes:
> I'm still looking for a solution to maintain a servo position while
> allowing the stamp to work on other things. Obviously I can
> continually pulse at 20 ms intervals the position that I want, but is
> there either a hardware or software method of positioning a servo so
> that it maintains its position?
>
You can do this with a standard servo that is not modified for continuous
rotation with no problem. If you want to do it with a continuous rotation servo,
it gets a bit tricky. The problem is you only have the 20ms between pulses
to do something else with the Stamp, although the pause between pulses could
probably be increased to 30ms. Something like
standstill:
x = 850
pulsout servo, x
pause 20
pulsout servo, x-1
pause 20
goto standstill
The servo would actually oscillate between 850 and 849, but that's pretty
close to standing still.
Sid
[noparse][[/noparse]Non-text portions of this message have been removed]
Comments
hangook21@y... writes:
> I'm using standard servos, but I don't understand how this can be
> easily done...ie you need to continue to pulse the servo for it to
> be 'active' in maintaining its position. If you aren't pulsing it,
> and there is a force on the servo, it can 'spin freely'- What I'm
> doing is moving a servo to a position (say center for example) but I
> want it to MANITAIN that position actively (ie the more force on it
> the harder the servo works)- BUT I don't know how to do this 'hands
> free' from the stamp. I've looked at the servo controller on the
> parallax site, but not sure if this will do what I am trying to do...
>
Look at the snippet I sent you. In place of
pause 20
you could write:
gosub read ADC 1 takes about 1ms
serout pin, bauc, [noparse][[/noparse]"ADC is :', dec adc, cr] ' maybe another ms
pause 18
You buy that?
Sid
[noparse][[/noparse]Non-text portions of this message have been removed]
allowing the stamp to work on other things. Obviously I can
continually pulse at 20 ms intervals the position that I want, but is
there either a hardware or software method of positioning a servo so
that it maintains its position?
Thanks.
Ryan
> In a message dated 7/12/2004 12:07:14 PM Eastern Daylight Time,
> hangook21@y... writes:
>
>
> > I'm still looking for a solution to maintain a servo position
while
> > allowing the stamp to work on other things. Obviously I can
> > continually pulse at 20 ms intervals the position that I want,
but is
> > there either a hardware or software method of positioning a servo
so
> > that it maintains its position?
> >
>
> You can do this with a standard servo that is not modified for
continuous
> rotation with no problem. If you want to do it with a continuous
rotation servo,
> it gets a bit tricky. The problem is you only have the 20ms
between pulses
> to do something else with the Stamp, although the pause between
pulses could
> probably be increased to 30ms. Something like
>
> standstill:
> x = 850
> pulsout servo, x
> pause 20
> pulsout servo, x-1
> pause 20
> goto standstill
>
> The servo would actually oscillate between 850 and 849, but that's
pretty
> close to standing still.
>
> Sid
>
>
> [noparse][[/noparse]Non-text portions of this message have been removed]
It may be overkill, but would a PAC-V (pwm output) do this ?
Dave
> You can do this with a standard servo that is not modified for
continuous
> rotation with no problem. > Sid
>
>
I'm using standard servos, but I don't understand how this can be
easily done...ie you need to continue to pulse the servo for it to
be 'active' in maintaining its position. If you aren't pulsing it,
and there is a force on the servo, it can 'spin freely'- What I'm
doing is moving a servo to a position (say center for example) but I
want it to MANITAIN that position actively (ie the more force on it
the harder the servo works)- BUT I don't know how to do this 'hands
free' from the stamp. I've looked at the servo controller on the
parallax site, but not sure if this will do what I am trying to do...
Ryan
>
> Dave
I guess I didn't communicate my original question clearly:
I can pulse a servo to go where I want it to be, but to maintain that
position I have to continue to pulse it with that value. Is there a
way to free the stamp from the chore of continually updating this
pulse for position, yet maintain the position?
Ryan
PBASIC software is possible, but requires some planning. Instead of
using PAUSE 20 between servo refresh pulses you would do active things
here. I've written a SumoBot program that does every task via
subroutines and at the end of those routines is a timer variable that
gets updated based on the length of that routine (I measured using and
extra pin and a scope). When the timer variable hits 20 milliseconds, I
call the servo update.
I have 20+ years of programming experience that includes some assembly,
so I don't find this to tough to deal with. That said, it's fine for a
couple servos, but when you want to control a bunch (like in a robot),
then using a dedicated controller is probably the best way to go. And
if you're not comfortable with timing your program segments, using
hardware will make your life easier.
We designed the PSC to handle a large number of servos (16), and to
allow the host (BASIC Stamp) the ability to sweep servo channels without
much work -- this very useful in walking robots (in fact, our hex
crawler drove the PSC design) and animatronics.
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: LostboY [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=e0wJOFkHELnFauLCkR-ocZL5cha1qZRcSbyJkwDUaQfhn5TlqVnVIYXy-LVBNoSHZdR5LmMGMGV8iQ]hangook21@y...[/url
Sent: Monday, July 12, 2004 11:03 AM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] Using the stamp to maintain servo position...
I'm still looking for a solution to maintain a servo position while
allowing the stamp to work on other things. Obviously I can
continually pulse at 20 ms intervals the position that I want, but is
there either a hardware or software method of positioning a servo so
that it maintains its position?
Thanks.
Ryan
your program so that active portions are run in between servo refresh
pulses (possible, but tricky).
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: LostboY [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=R48onZRCKzCFYNvYQbd8wkOBt3Fjr78M_Lge3vToLwWytv10VpMZeTOYpVtzeNVOHEF3J_6o-trVuoTe]hangook21@y...[/url
Sent: Monday, July 12, 2004 11:28 AM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] Re: Using the stamp to maintain servo position...
> It may be overkill, but would a PAC-V (pwm output) do this ?
>
> Dave
I guess I didn't communicate my original question clearly:
I can pulse a servo to go where I want it to be, but to maintain that
position I have to continue to pulse it with that value. Is there a
way to free the stamp from the chore of continually updating this
pulse for position, yet maintain the position?
Ryan
when I did that I had sheets where I could find the exact number of
clocks needed for a particular instruction. I know that the PBASIC
is 'tokenized' but is there a listing somewhere where I the required
time (clock cycles?) needed for a particular PBASIC command is
listed? (So I could time my subroutines just based on the code,
rather than using a scope)-
Ryan
--- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
wrote:
> The Parallax PSC is a hardware solution, and to maintain servos in
> PBASIC software is possible, but requires some planning. Instead of
> using PAUSE 20 between servo refresh pulses you would do active
things
> here. I've written a SumoBot program that does every task via
> subroutines and at the end of those routines is a timer variable
that
> gets updated based on the length of that routine (I measured using
and
> extra pin and a scope). When the timer variable hits 20
milliseconds, I
> call the servo update.
will wait forever if you don't.
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: Newzed@a... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=qux88HNwvySqu_TbSkvnj4odyal85UFttmhSP8yJlmbVJL6dFklgoYkMMoaUY1SKWs560Da1QhA]Newzed@a...[/url
Sent: Monday, July 12, 2004 11:43 AM
To: basicstamps@yahoogroups.com
Subject: Re: [noparse][[/noparse]basicstamps] Re: Using the stamp to maintain servo
position...
In a message dated 7/12/2004 12:29:41 PM Eastern Daylight Time,
hangook21@y... writes:
> I'm using standard servos, but I don't understand how this can be
> easily done...ie you need to continue to pulse the servo for it to
> be 'active' in maintaining its position. If you aren't pulsing it,
> and there is a force on the servo, it can 'spin freely'- What I'm
> doing is moving a servo to a position (say center for example) but I
> want it to MANITAIN that position actively (ie the more force on it
> the harder the servo works)- BUT I don't know how to do this 'hands
> free' from the stamp. I've looked at the servo controller on the
> parallax site, but not sure if this will do what I am trying to do...
>
Look at the snippet I sent you. In place of
pause 20
you could write:
gosub read ADC 1 takes about 1ms
serout pin, bauc, [noparse][[/noparse]"ADC is :', dec adc, cr] ' maybe another ms
pause 18
You buy that?
Sid
Dave's reply, but I did see it cut in this reply:
> It may be overkill, but would a PAC-V (pwm output) do this ?
>
> Dave
Actually, the PAK-VIII is the correct chip for this. It will position 8
servos with no intervention from the Stamp (other than to set the position,
of course). The chip is actually just a general-purpose pulse output chip.
Many people also use it for high-resolution PWM, or to generate other kinds
of pulses, not just for servos. http://www.awce.com/pak8.htm.
Our PicoPak-VIII is a good solution for just one servo, but it isn't nearly
as flexible for general purpose use.
Regards,
Al Williams
AWC
* Want to save 50% on a PAK? (one day left)
http://www.awce.com/news.htm
instructions. A long time ago I used a second BASIC Stamp to do the
timing for me (when I didn't have a scope handy). On the BS2 it was
something like this:
Measure:
PULSIN PulsePin, 1, time
DEBUG HOME, DEC5 time * 2, " uS"
GOTO Measure
In my other project I would set a spare pin HIGH before calling a
subroutine and LOW at the end of the routine.
Once I had the measurements, I would create a structure something like
this:
Main:
IF (timer > 20) THEN
GOSUB Refresh_Servos
ENDIF
ON task GOSUB Task0, Task1, Task2 ...
GOTO Main
Refresh_Servos:
PUSLOUT Servo1, 1, servo1Time
PUSLOUT Servo2, 1, servo2Time
timer = 0
RETURN
Task0:
' do something
timer = timer + 3
task = task + 1 // NumTasks
RETURN
Notice that I update the task pointer in each task (usually just
pointing to the next) so that the program can be very dynamic, that is,
a given task can redirect program flow if some condition warrants it.
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: LostboY [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=UQMgReeUj2zcLVqz6dA7eEQSv4DiuG3b7dKP7rE_nwX4JWz8HR6tA7ReS6_uXjpldz2NK1M3HHTfkP2x8w]hangook21@y...[/url
Sent: Monday, July 12, 2004 11:45 AM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] Re: Using the stamp to maintain servo position...
Jon, thanks for the reply. I've done a *little* assembly programming-
when I did that I had sheets where I could find the exact number of
clocks needed for a particular instruction. I know that the PBASIC
is 'tokenized' but is there a listing somewhere where I the required
time (clock cycles?) needed for a particular PBASIC command is
listed? (So I could time my subroutines just based on the code,
rather than using a scope)-
Ryan
me.
Jon Williams
Parallax
Original Message
From: Al Williams
Sent: Monday, July 12, 2004 11:52 AM
To: basicstamps@yahoogroups.com
Subject: RE: [noparse][[/noparse]basicstamps] Re: Using the stamp to maintain servo
position...
For some reason, I don't get all the Stamp messages anymore, so I didn't
see Dave's reply, but I did see it cut in this reply:
> It may be overkill, but would a PAC-V (pwm output) do this ?
>
> Dave
Actually, the PAK-VIII is the correct chip for this. It will position 8
servos with no intervention from the Stamp (other than to set the
position, of course). The chip is actually just a general-purpose pulse
output chip. Many people also use it for high-resolution PWM, or to
generate other kinds of pulses, not just for servos.
http://www.awce.com/pak8.htm.
Our PicoPak-VIII is a good solution for just one servo, but it isn't
nearly as flexible for general purpose use.
Regards,
Al Williams
AWC
* Want to save 50% on a PAK? (one day left) http://www.awce.com/news.htm
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.
Yahoo! Groups Links
This message has been scanned by WebShield. Please report SPAM to
abuse@p....
the servos. And, yes they will both continually update the servos to
maintain their position. The servos may or may not stay where you set them
depending on the load you are putting on them. You should refer to the docs
on the servos for that load data.
Shawn
> [noparse][[/noparse]Original Message]
> From: LostboY <hangook21@y...>
> To: <basicstamps@yahoogroups.com>
> Date: 7/12/2004 10:28:38 AM
> Subject: [noparse][[/noparse]basicstamps] Re: Using the stamp to maintain servo position...
>
> > It may be overkill, but would a PAC-V (pwm output) do this ?
> >
> > Dave
>
> I guess I didn't communicate my original question clearly:
>
> I can pulse a servo to go where I want it to be, but to maintain that
> position I have to continue to pulse it with that value. Is there a
> way to free the stamp from the chore of continually updating this
> pulse for position, yet maintain the position?
>
> Ryan
>
>
>
> 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.
>
> Yahoo! Groups Links
>
>
>
>