Servo Question
Archiver
Posts: 46,084
Hello fellow stampers,
I want to be able to control six servos simutaneously. I have been
able to get close by using for/next loops but there has to be a
better and more efficient way.
Any Ideas????
Thanks.
I want to be able to control six servos simutaneously. I have been
able to get close by using for/next loops but there has to be a
better and more efficient way.
Any Ideas????
Thanks.
Comments
Try this http://www.seetron.com/ssc.htm
Mike
Original Message
From: Dr. Frankenstein [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=Op5-oX8UoGoqBjJA1pBIIZ0-8cTaAN3RmLYsdBpu3riPBpJOLGrVat8igwu2AkQdncTaEslqQro]fwankg@y...[/url
Sent: Tuesday, September 26, 2000 2:02 PM
To: basicstamps@egroups.com
Subject: [noparse][[/noparse]basicstamps] Servo Question
Hello fellow stampers,
I want to be able to control six servos simutaneously. I have been
able to get close by using for/next loops but there has to be a
better and more efficient way.
Any Ideas????
Thanks.
to 8 channels out at once. The project of the month next month will show how
to control servos with the PAK-VIII. You can also read about it in the
online manuals.
The idea is that each of the 8 channels has a set of registers. By writing
registers (using SHIFTOUT) you can set the on time and the off time for each
channel in 10uS intervals. So to center the servo (assuming 1.5mS pulse is
centered) you could set the on time to 150 and the off time to 2000 (20mS).
Now when you want the servo to reposition, you simply change the 150 in the
"on" register to another value.
For more advanced uses, you can set a count of pulses so that you get a
number of pulses out and then the chip stops pulsing that channel (until you
send more commands, of course). You can also change the 10uS time to a
longer time, or to 5uS if you don't enable more than 4 channels of the 8
available. In addition, you can force a channel high, low, or to a hi-z
state. None of this is necessary for basic servo control, however.
Look for the project around the first of the month or check out the manual
in the meantime.
Regards,
Al Williams
AWC
* Floating point math for the Stamp, PIC, SX, or any microcontroller:
http://www.al-williams.com/awce/pak1.htm
>
Original Message
> From: Dr. Frankenstein [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=oXNXCuAWVFwpP7ufQjEOSU3ERHQA1ezDdvIGXqsnRK1MLL85a2Buj66evNDcm78zW1KhkbAw]fwankg@y...[/url
> Sent: Tuesday, September 26, 2000 4:02 PM
> To: basicstamps@egroups.com
> Subject: [noparse][[/noparse]basicstamps] Servo Question
>
>
> Hello fellow stampers,
>
> I want to be able to control six servos simutaneously. I have been
> able to get close by using for/next loops but there has to be a
> better and more efficient way.
>
> Any Ideas????
>
> Thanks.
>
>
>
>Hello fellow stampers,
>
>I want to be able to control six servos simutaneously. I have been
>able to get close by using for/next loops but there has to be a
>better and more efficient way.
>
>Any Ideas????
Most folks use an off-Stamp processor to handle that load, so the Stamp can
do other things. Here are a few of the products -
Packaged ASICS:
SEETRON [noparse][[/noparse] http://www.seetron.com/ssc.htm ]
Al WIlliams [noparse][[/noparse] http://www.al-williams.com/awce/pak8.htm ]
PIC DIY:
Rentron NEW [noparse][[/noparse] http://www.rentron.com/SerialServo.htm ]
OLD [noparse][[/noparse] http://www.rentron.com/servo.htm ]
There are many others as well.
>Thanks.
Sure
Regards,
Bruce
i'm doing my first servo project with a stamp. I understand how a
servo works. I am using a ts-53 tower hobbies servo applying 3 volts
from batteries. i'm sending a loop of 100 to 200 ms pulses to the
signal line. i'm using between 15-30 ms pauses between each pulse.
It it grounded to the stamp and i am sending pulses out of pin 7.
However, the servo moves one time and then just sits there and hums.
it doesn't cycle back through how it's supposed to. plus, i can hear
it clicking every once in awhile like it wants to move- but it won't.
Can anyone help?
Jon
end or the other and stopping. Power off the servo, then manually turn it to
the center position. Power the servo back on and run your code again to see
what happens.
Which Stamp do you have? What value you use on the PULSOUT command depends
on the which Stamp module is used.
Original Message
> i'm doing my first servo project with a stamp. I understand how a
> servo works. I am using a ts-53 tower hobbies servo applying 3 volts
> from batteries. i'm sending a loop of 100 to 200 ms pulses to the
> signal line. i'm using between 15-30 ms pauses between each pulse.
> It it grounded to the stamp and i am sending pulses out of pin 7.
> However, the servo moves one time and then just sits there and hums.
> it doesn't cycle back through how it's supposed to. plus, i can hear
> it clicking every once in awhile like it wants to move- but it won't.
> Can anyone help?
two extremes. 16 ms is typical between pulses, but is not real critical.
Normally, RC servos operate from 5 to 6 volts. Be careful turning servos by
hand. Some of the smaller servos could suffer gear failure.
Good luck,
Ray McArthur
Original Message
From: <jhtoolman2000@y...>
To: <basicstamps@yahoogroups.com>
Sent: Monday, October 08, 2001 8:51 PM
Subject: [noparse][[/noparse]basicstamps] servo question
> hey stampers,
> i'm doing my first servo project with a stamp. I understand how a
> servo works. I am using a ts-53 tower hobbies servo applying 3 volts
> from batteries. i'm sending a loop of 100 to 200 ms pulses to the
> signal line. i'm using between 15-30 ms pauses between each pulse.
> It it grounded to the stamp and i am sending pulses out of pin 7.
> However, the servo moves one time and then just sits there and hums.
> it doesn't cycle back through how it's supposed to. plus, i can hear
> it clicking every once in awhile like it wants to move- but it won't.
> Can anyone help?
> Jon
>
>
> 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/
>
>
I am using the BS2 SX. The code i am using goes like
again:
for b2 = 100 to 200
for b3 = 1 to 5
pulsout 7, b2
pause 15
next
next
goto again
like i said it barely moves then it just sits there and buzzes. I am
using 3 volts from batteries to power it. I'm not sure if this is
your area of expertise but any help would be apprreciated. Also, how
do i know when the servo is centered? Thanks.
JOn
--- In basicstamps@y..., Rodent <daweasel@s...> wrote:
> Sounds to me like you have the wrong values and the servo is going
to one
> end or the other and stopping. Power off the servo, then manually
turn it to
> the center position. Power the servo back on and run your code
again to see
> what happens.
>
> Which Stamp do you have? What value you use on the PULSOUT command
depends
> on the which Stamp module is used.
>
>
Original Message
>
> > i'm doing my first servo project with a stamp. I understand how
a
> > servo works. I am using a ts-53 tower hobbies servo applying 3
volts
> > from batteries. i'm sending a loop of 100 to 200 ms pulses to the
> > signal line. i'm using between 15-30 ms pauses between each
pulse.
> > It it grounded to the stamp and i am sending pulses out of pin 7.
> > However, the servo moves one time and then just sits there and
hums.
> > it doesn't cycle back through how it's supposed to. plus, i can
hear
> > it clicking every once in awhile like it wants to move- but it
won't.
> > Can anyone help?
180 degrees. You may have to juggle these values a bit to get full travel as
there are variations between Stamps. If the servo goes all the way to one
end and buzzes, you are telling it to go too far in one direction.
The BS2SX sends a pulse of 0.8 microseconds per PULSOUT unit, which means if
your neutral value is 1.5 milliseconds, you need to divide 0.0015 by
0.0000008 to get the proper PULSOUT value to move the servo to the middle of
its travel.
Like I've said before, power the servo off and *slowly* and *carefully*
rotate it all the way one direction, then the other. Make a mental note of
where the middle of the travel is. This is approximately where the neutral
position is.
Original Message
> I am using the BS2 SX. The code i am using goes like
>
> again:
> for b2 = 100 to 200
> for b3 = 1 to 5
> pulsout 7, b2
> pause 15
> next
> next
> goto again
>
> like i said it barely moves then it just sits there and buzzes. I am
> using 3 volts from batteries to power it. I'm not sure if this is
> your area of expertise but any help would be apprreciated. Also, how
> do i know when the servo is centered?
>Dear group,
> I am trying to figure out how to control a servo from a model aircraft.
>I have it hooked up to my radio control and it works fine. But i need it to
>be hard wire, not remote control. Can anyone point me in the right direct
>for info. I am also looking for a 1/4 phone jack with at least 4
>conductors. Does anyone know where i could buy one at.
You can use a Stamp to read a pot and generate servo control pulses. You
can also do the same thing with a few 555 timers: 1 as the master clock
(set to about 50 Hz), the others (1 per servo) configured as 1-shot
(monostable) timers set to generate a pulse that varies between 1 ms to 2
ms. Search the net for keywords: RC servo 555 timer and see what pops up.
I'm not aware of any 1/4" 4 circuit phone jacks. I've used 4 circuit 1/8"
(3.5 mm) plugs and jacks but do not consider them to be reliable for long
term use. Your best bet is anything with wiping contacts: miniature audio
connectors (TA4F, TC4M) from Switchcraft are small, relatively inexpensive
and have proven to be reliable over years of use.
dwayne
--
Dwayne Reid <dwayner@p...>
Trinity Electronics Systems Ltd Edmonton, AB, CANADA
(780) 489-3199 voice (780) 487-6397 fax
Celebrating 18 years of Engineering Innovation (1984 - 2002)
.-. .-. .-. .-. .-. .-. .-. .-. .-. .-
`-' `-' `-' `-' `-' `-' `-' `-' `-'
Do NOT send unsolicited commercial email to this email address.
This message neither grants consent to receive unsolicited
commercial email nor is intended to solicit commercial email.
There are a number of different ways to do this, and in part it depends on
the servos. What are the specs on them? How many are you going to control?
Give as many details as possible.
The Nuts and Volts articles on the Parallax site have information on
controlling loads like servos with your Stamp. In general, unless the servos
draw very little, you will need to drive them with something else, like a
transistor. If you are going to run several, there are some convenient
devices like the ULN2003 that have multiple built in transistors to control
a number of servos.
Jonathan
www.madlabs.info
Original Message
From: "Digitalcowboy00" <DigitalCowboy00@s...>
To: <basicstamps@yahoogroups.com>
Sent: Sunday, January 26, 2003 4:46 PM
Subject: [noparse][[/noparse]basicstamps] servo question
> Dear group,
> I am trying to figure out how to control a servo from a model
aircraft.
> I have it hooked up to my radio control and it works fine. But i need it
to
> be hard wire, not remote control. Can anyone point me in the right direct
> for info. I am also looking for a 1/4 phone jack with at least 4
> conductors. Does anyone know where i could buy one at.
>
> thanks Justin
>
> p.s. Any help will be good, no matter how little.
>
>
>
> [noparse][[/noparse]Non-text portions of this message have been removed]
>
>
> 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/
>
>
>
>
Try Aviall, or another aviation supplier at your local airport.Many
Helicopters is a four pin plug for their headset connection. These
connectors are often known as NATO headset plugs. They are a bit dear, but
may be what u r looking for.
Actually, I recall that the two pin telephone style MIC plug connector for
headsets that is standard in fixed wings has four pins on it as well, just
one is unused. These are MUCH cheaper although the NATO connector is
sexxier!!
The socket part number is either JJ033, or JJ034, and the plug part number
MIGHT be PJ068, but you can look them up in the Aviall catalogue if u need
to.
Regards,
Dwain.
Original Message
From: "Dwayne Reid" <dwayner@p...>
To: <basicstamps@yahoogroups.com>
Sent: Monday, January 27, 2003 9:58 AM
Subject: Re: [noparse][[/noparse]basicstamps] servo question
> At 04:46 PM 1/26/03 -0800, Digitalcowboy00 wrote:
> >Dear group,
> > I am trying to figure out how to control a servo from a model
aircraft.
> >I have it hooked up to my radio control and it works fine. But i need it
to
> >be hard wire, not remote control. Can anyone point me in the right
direct
> >for info. I am also looking for a 1/4 phone jack with at least 4
> >conductors. Does anyone know where i could buy one at.
>
> You can use a Stamp to read a pot and generate servo control pulses. You
> can also do the same thing with a few 555 timers: 1 as the master clock
> (set to about 50 Hz), the others (1 per servo) configured as 1-shot
> (monostable) timers set to generate a pulse that varies between 1 ms to 2
> ms. Search the net for keywords: RC servo 555 timer and see what pops up.
>
> I'm not aware of any 1/4" 4 circuit phone jacks. I've used 4 circuit 1/8"
> (3.5 mm) plugs and jacks but do not consider them to be reliable for long
> term use. Your best bet is anything with wiping contacts: miniature audio
> connectors (TA4F, TC4M) from Switchcraft are small, relatively inexpensive
> and have proven to be reliable over years of use.
>
> dwayne
>
> --
> Dwayne Reid <dwayner@p...>
> Trinity Electronics Systems Ltd Edmonton, AB, CANADA
> (780) 489-3199 voice (780) 487-6397 fax
>
> Celebrating 18 years of Engineering Innovation (1984 - 2002)
> .-. .-. .-. .-. .-. .-. .-. .-. .-. .-
> `-' `-' `-' `-' `-' `-' `-' `-' `-'
> Do NOT send unsolicited commercial email to this email address.
> This message neither grants consent to receive unsolicited
> commercial email nor is intended to solicit commercial email.
>
>
> 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/
>
>
>
>
I am trying to figure out how to control a servo from a model aircraft.
I have it hooked up to my radio control and it works fine. But i need it to
be hard wire, not remote control. Can anyone point me in the right direct
for info. I am also looking for a 1/4 phone jack with at least 4
conductors. Does anyone know where i could buy one at.
thanks Justin
p.s. Any help will be good, no matter how little.
[noparse][[/noparse]Non-text portions of this message have been removed]
leds, and 2 servo for the last couple of days. Anyways i've been
look around for some code to try and have come up with the
following:
Main
LED1 = BT1
LED2 = BT2
IF BT2 = 0 THEN Servo_Forward
IF BT1 = 0 THEN Servo_Backwards
PAUSE 20
GOTO Main
Servo_Forward:
PULSOUT 5, 100
RETURN
Servo_Backwards
PULSOUT 5, 900
RETURN
My problem is with the servo, it will spin one way with no problem.
But then with i try to go the other direction it turns 1/8 of a turn
then stop and hums after that. I have tried varying the Duration of
Pulsout. Thanks for any help thats offered.
Tony
pause 20
after the pulsout
--- In basicstamps@yahoogroups.com, "dakota_99_64804"
<dakota_99_64804@y...> wrote:
> Hi, Newbie here... I've been playing with a BS2p24, 2 buttons, 2
> leds, and 2 servo for the last couple of days. Anyways i've been
> look around for some code to try and have come up with the
> following:
>
> Main
> LED1 = BT1
> LED2 = BT2
> IF BT2 = 0 THEN Servo_Forward
> IF BT1 = 0 THEN Servo_Backwards
> PAUSE 20
> GOTO Main
>
> Servo_Forward:
> PULSOUT 5, 100
> RETURN
>
> Servo_Backwards
> PULSOUT 5, 900
> RETURN
>
> My problem is with the servo, it will spin one way with no
problem.
> But then with i try to go the other direction it turns 1/8 of a
turn
> then stop and hums after that. I have tried varying the Duration
of
> Pulsout. Thanks for any help thats offered.
>
> Tony
> Try adding
> pause 20
> after the pulsout
>
> <dakota_99_64804@y...> wrote:
> > Hi, Newbie here...
That is good practice, and you should. However, your intent was sound in
putting a pause after the subroutine calls return to the main line program.
The trouble is your sequence of execution depends on the behavior of the
interpreter when you do something invalid. Specifically, executing a RETURN
with no preceding GOSUB. I suggest changing those tests to read something
like:
IF (0=BT1) THEN
GOSUB Servo_Forward
ENDIF
The other thing I notice, without time to look up a correction, is the pulse
counts you're using. They don't look right for any BS2, but especially a
BS2p. I don't use open-ended servos (the ones modified to turn indefinitely
instead of going to a position determined by the pulse width) but I believe
you want to hit them with a pulse of about 1.1 ms to go one direction and
1.9 ms to go the other. I speak subject to correction on that point, but I'm
pretty sure a pulse that results from a count of 100 on a BS2P is way too
short for any type of servo. This could well cause the behavior you
describe. Check the help file for details on what count to use for a given
pulse duration on the BS2P.
Finally, you spoke of two servos, but you're using the same pin number with
each call. Is this only the code for one of the servos?
Gary
P.S. I just realized that using the subroutine name without a GOSUB may be
treated as an implicit call by the interpreter. Like a function call in
other languages. Is that the case, Jon?
'{$STAMP BS2p}
LED1 VAR OUT0
LED2 VAR OUT1
BT1 VAR IN2
BT2 VAR IN3
OUTPUT 0
OUTPUT 1
INPUT 2
INPUT 3
OUTPUT 4
OUTPUT 5
Main
LED1 = BT1
LED2 = BT2
IF (0=BT1) THEN Servo_Forward
IF (0=BT2) THEN Servo_Backwards
GOTO Main
Servo_Forward:
PULSOUT 5, 200
PAUSE 20
GOTO Main
Servo_Backwards
PULSOUT 5, 3000
PAUSE 20
GOTO Main
I took out the the RETURN and put in GOTO Main instead
of do the following:
> IF (0=BT1) THEN
> GOSUB Servo_Forward
> ENDIF
The GOSUB wont work with the Basic stamp program. I've
varied the duration time of Pulsout from 100 to 3000.
with the way it's coded above I'm able to turn it
forward at a constant speed. When turning backwards it
start out fine until it completes a half of a turn
then it slow down. (Oh, Currently the I'm only using
one servo til I figure this out. Someone asked i
think) The servo is a PC-09 by P&C Sercos if that
helps?
Thanks again for the help.
Tony
--- "Gary W. Sims" <simsgw@c...> wrote:
> From: "gizmo_dude_2000" <harrison_fan@h...>
>
> That is good practice, and you should. However, your
> intent was sound in
> putting a pause after the subroutine calls return to
> the main line program.
> The trouble is your sequence of execution depends on
> the behavior of the
> interpreter when you do something invalid.
> Specifically, executing a RETURN
> with no preceding GOSUB. I suggest changing those
> tests to read something
> like:
>
>
> The other thing I notice, without time to look up a
> correction, is the pulse
> counts you're using. They don't look right for any
> BS2, but especially a
> BS2p. I don't use open-ended servos (the ones
> modified to turn indefinitely
> instead of going to a position determined by the
> pulse width) but I believe
> you want to hit them with a pulse of about 1.1 ms to
> go one direction and
> 1.9 ms to go the other. I speak subject to
> correction on that point, but I'm
> pretty sure a pulse that results from a count of 100
> on a BS2P is way too
> short for any type of servo. This could well cause
> the behavior you
> describe. Check the help file for details on what
> count to use for a given
> pulse duration on the BS2P.
>
> Finally, you spoke of two servos, but you're using
> the same pin number with
> each call. Is this only the code for one of the
> servos?
>
> Gary
> P.S. I just realized that using the subroutine name
> without a GOSUB may be
> treated as an implicit call by the interpreter. Like
> a function call in
> other languages. Is that the case, Jon?
>
__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html
your main loop like this:
Main
LED1 = BT1
LED2 = BT2
IF BT2 = 0 THEN GOSUB Servo_Forward
IF BT1 = 0 THEN GOSUB Servo_Backwards
PAUSE 20
GOTO Main
You need to use the $PBASCI 2.5 directive for this to work.
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: dakota_99_64804 [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=qVxGkczrDpIdPnvpki5cUuO1vZkiWnO1qsIThiMwLmBYyjyCtcNBl9-XVOhMn7BjDpLCYA4tXk7lQ-bAdGQN]dakota_99_64804@y...[/url
Sent: Monday, February 09, 2004 9:48 PM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] servo question
Hi, Newbie here... I've been playing with a BS2p24, 2 buttons, 2
leds, and 2 servo for the last couple of days. Anyways i've been
look around for some code to try and have come up with the
following:
Main
LED1 = BT1
LED2 = BT2
IF BT2 = 0 THEN Servo_Forward
IF BT1 = 0 THEN Servo_Backwards
PAUSE 20
GOTO Main
Servo_Forward:
PULSOUT 5, 100
RETURN
Servo_Backwards
PULSOUT 5, 900
RETURN
My problem is with the servo, it will spin one way with no problem.
But then with i try to go the other direction it turns 1/8 of a turn
then stop and hums after that. I have tried varying the Duration of
Pulsout. Thanks for any help thats offered.
Tony
will usually be restarted -- often with undesirable results. Both GOTO
(implicit or explicit) and GOSUB jump to program labels; the difference
is in the mechanism that gets back to the rest of the code.
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: Gary W. Sims [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=BibTcZVqMwA59jNmJJqdxf0XwfRFkyOU3nURQZqkdg_lIJluO4XF5iIWcAas-BG2sFemP8HbDJKtIg2G]simsgw@c...[/url
Sent: Tuesday, February 10, 2004 12:10 AM
To: basicstamps@yahoogroups.com
Subject: Re: [noparse][[/noparse]basicstamps] Re: servo question
From: "gizmo_dude_2000" <harrison_fan@h...>
> Try adding
> pause 20
> after the pulsout
>
> <dakota_99_64804@y...> wrote:
> > Hi, Newbie here...
That is good practice, and you should. However, your intent was sound in
putting a pause after the subroutine calls return to the main line
program. The trouble is your sequence of execution depends on the
behavior of the interpreter when you do something invalid. Specifically,
executing a RETURN with no preceding GOSUB. I suggest changing those
tests to read something
like:
IF (0=BT1) THEN
GOSUB Servo_Forward
ENDIF
The other thing I notice, without time to look up a correction, is the
pulse counts you're using. They don't look right for any BS2, but
especially a BS2p. I don't use open-ended servos (the ones modified to
turn indefinitely instead of going to a position determined by the pulse
width) but I believe you want to hit them with a pulse of about 1.1 ms
to go one direction and 1.9 ms to go the other. I speak subject to
correction on that point, but I'm pretty sure a pulse that results from
a count of 100 on a BS2P is way too short for any type of servo. This
could well cause the behavior you describe. Check the help file for
details on what count to use for a given pulse duration on the BS2P.
Finally, you spoke of two servos, but you're using the same pin number
with each call. Is this only the code for one of the servos?
Gary
P.S. I just realized that using the subroutine name without a GOSUB may
be treated as an implicit call by the interpreter. Like a function call
in other languages. Is that the case, Jon?
or so -- no matter what is happening with your inputs. Your current
code design does not do this. If, for example, Btn1 handles the right
motor, you could do this:
Main:
Led1 = Btn1
Led2 = Btn2
IF (Btn1 = 0) THEN
GOSUB Servo1_Fwd
ELSE
GOSUB Servo1_Rev
ENDIF
IF (Btn2 = 0) THEN
GOSUB Servo2_Fwd
ELSE
GOSUB Servo2_Rev
ENDIF
PAUSE 20
GOTO Main
Other notes: Making pins inputs at the beginning of a program is just
wasted code -- all pins default to inputs on reset. Make sure you're
using our latest compliler (version 2.1) and have $PBASIC 2.5 enabled.
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: not today [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=V_4pPmcSmoaHzMxGJ89tENuan3jVP8Toei0eJUB97Ab63doVNcSxgxJ9gLByLn6dymyNZDm8amzcUSp0fcs8tZbQhA]dakota_99_64804@y...[/url
Sent: Tuesday, February 10, 2004 7:12 AM
To: basicstamps@yahoogroups.com
Subject: Re: [noparse][[/noparse]basicstamps] Re: servo question
Ok, New code segment:
'{$STAMP BS2p}
LED1 VAR OUT0
LED2 VAR OUT1
BT1 VAR IN2
BT2 VAR IN3
OUTPUT 0
OUTPUT 1
INPUT 2
INPUT 3
OUTPUT 4
OUTPUT 5
Main
LED1 = BT1
LED2 = BT2
IF (0=BT1) THEN Servo_Forward
IF (0=BT2) THEN Servo_Backwards
GOTO Main
Servo_Forward:
PULSOUT 5, 200
PAUSE 20
GOTO Main
Servo_Backwards
PULSOUT 5, 3000
PAUSE 20
GOTO Main
I took out the the RETURN and put in GOTO Main instead
of do the following:
> IF (0=BT1) THEN
> GOSUB Servo_Forward
> ENDIF
The GOSUB wont work with the Basic stamp program. I've
varied the duration time of Pulsout from 100 to 3000.
with the way it's coded above I'm able to turn it
forward at a constant speed. When turning backwards it
start out fine until it completes a half of a turn
then it slow down. (Oh, Currently the I'm only using
one servo til I figure this out. Someone asked i
think) The servo is a PC-09 by P&C Sercos if that
helps?
Thanks again for the help.
Tony
IF...THEN...<GOTO_LABEL>
So, "IF BT2 = 0 THEN Servo_Forwards" is
really a GOTO Servo_Forwards, NOT a
GOSUB Servo_Forwards. The 'RETURN' at
the end of your subroutine is going to
then cause problems.
Secondly, I thought the 'full left'
command was 1 mSec, 'full right' was 2 mSec.
The BS2p24 does 1.18 uSec for each count,
so you're commanding (100 * 1.18 == 118 uSec)
one way, and (900 * 1.18 uS == 1.062 mSec)
the other way.
--- In basicstamps@yahoogroups.com, "dakota_99_64804"
<dakota_99_64804@y...> wrote:
> Hi, Newbie here... I've been playing with a BS2p24, 2 buttons, 2
> leds, and 2 servo for the last couple of days. Anyways i've been
> look around for some code to try and have come up with the
> following:
>
> Main
> LED1 = BT1
> LED2 = BT2
> IF BT2 = 0 THEN Servo_Forward
> IF BT1 = 0 THEN Servo_Backwards
> PAUSE 20
> GOTO Main
>
> Servo_Forward:
> PULSOUT 5, 100
> RETURN
>
> Servo_Backwards
> PULSOUT 5, 900
> RETURN
>
> My problem is with the servo, it will spin one way with no problem.
> But then with i try to go the other direction it turns 1/8 of a
turn
> then stop and hums after that. I have tried varying the Duration of
> Pulsout. Thanks for any help thats offered.
>
> Tony
between the Stamp and the Servo, right?
--- In basicstamps@yahoogroups.com, not today <dakota_99_64804@y...>
wrote:
> Ok, New code segment:
>
> '{$STAMP BS2p}
>
> LED1 VAR OUT0
> LED2 VAR OUT1
> BT1 VAR IN2
> BT2 VAR IN3
>
> OUTPUT 0
> OUTPUT 1
> INPUT 2
> INPUT 3
> OUTPUT 4
> OUTPUT 5
>
> Main
> LED1 = BT1
> LED2 = BT2
> IF (0=BT1) THEN Servo_Forward
> IF (0=BT2) THEN Servo_Backwards
> GOTO Main
>
> Servo_Forward:
> PULSOUT 5, 200
> PAUSE 20
> GOTO Main
>
> Servo_Backwards
> PULSOUT 5, 3000
> PAUSE 20
> GOTO Main
>
> I took out the the RETURN and put in GOTO Main instead
> of do the following:
>
> > IF (0=BT1) THEN
> > GOSUB Servo_Forward
> > ENDIF
>
>
> The GOSUB wont work with the Basic stamp program. I've
> varied the duration time of Pulsout from 100 to 3000.
> with the way it's coded above I'm able to turn it
> forward at a constant speed. When turning backwards it
> start out fine until it completes a half of a turn
> then it slow down. (Oh, Currently the I'm only using
> one servo til I figure this out. Someone asked i
> think) The servo is a PC-09 by P&C Sercos if that
> helps?
>
> Thanks again for the help.
> Tony
>
>
>
> --- "Gary W. Sims" <simsgw@c...> wrote:
> > From: "gizmo_dude_2000" <harrison_fan@h...>
> >
> > That is good practice, and you should. However, your
> > intent was sound in
> > putting a pause after the subroutine calls return to
> > the main line program.
> > The trouble is your sequence of execution depends on
> > the behavior of the
> > interpreter when you do something invalid.
> > Specifically, executing a RETURN
> > with no preceding GOSUB. I suggest changing those
> > tests to read something
> > like:
> >
>
> >
> > The other thing I notice, without time to look up a
> > correction, is the pulse
> > counts you're using. They don't look right for any
> > BS2, but especially a
> > BS2p. I don't use open-ended servos (the ones
> > modified to turn indefinitely
> > instead of going to a position determined by the
> > pulse width) but I believe
> > you want to hit them with a pulse of about 1.1 ms to
> > go one direction and
> > 1.9 ms to go the other. I speak subject to
> > correction on that point, but I'm
> > pretty sure a pulse that results from a count of 100
> > on a BS2P is way too
> > short for any type of servo. This could well cause
> > the behavior you
> > describe. Check the help file for details on what
> > count to use for a given
> > pulse duration on the BS2P.
> >
> > Finally, you spoke of two servos, but you're using
> > the same pin number with
> > each call. Is this only the code for one of the
> > servos?
> >
> > Gary
> > P.S. I just realized that using the subroutine name
> > without a GOSUB may be
> > treated as an implicit call by the interpreter. Like
> > a function call in
> > other languages. Is that the case, Jon?
> >
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Finance: Get your refund fast by filing online.
> http://taxes.yahoo.com/filing.html
IF (condition) THEN Label ' implied GOTO
IF (condition) THEN Instruction ' this is now legal; instruction
could be GOSUB
IF (condition) THEN
' instruction(s)
ELSIF (another_condition) THEN
' instruction(s)
ELSE
' instruction(s)
ENDIF
For those that aren't using our Version 2.1 compiler, please let me
encourage you to do so. It has the latest online help that gives
details on using PBASIC 2.5 features.
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: Allan Lane [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=2T3TTgI8DTBFUjsYXuDfOFkhjKWzGvJZxNXLtFd4fws3M8V7Q5Hj2hGWsDWOJ6MaeTXdnAkadJ95KxBbmPtXIZM75A]allan.lane@h...[/url
Sent: Tuesday, February 10, 2004 8:47 AM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] Re: servo question
In PBasic the IF...THEN is only an
IF...THEN...<GOTO_LABEL>
So, "IF BT2 = 0 THEN Servo_Forwards" is
really a GOTO Servo_Forwards, NOT a
GOSUB Servo_Forwards. The 'RETURN' at
the end of your subroutine is going to
then cause problems.
Secondly, I thought the 'full left'
command was 1 mSec, 'full right' was 2 mSec.
The BS2p24 does 1.18 uSec for each count,
so you're commanding (100 * 1.18 == 118 uSec)
one way, and (900 * 1.18 uS == 1.062 mSec)
the other way.
--- In basicstamps@yahoogroups.com, "dakota_99_64804"
<dakota_99_64804@y...> wrote:
> Hi, Newbie here... I've been playing with a BS2p24, 2 buttons, 2
> leds, and 2 servo for the last couple of days. Anyways i've been
> look around for some code to try and have come up with the
> following:
>
> Main
> LED1 = BT1
> LED2 = BT2
> IF BT2 = 0 THEN Servo_Forward
> IF BT1 = 0 THEN Servo_Backwards
> PAUSE 20
> GOTO Main
>
> Servo_Forward:
> PULSOUT 5, 100
> RETURN
>
> Servo_Backwards
> PULSOUT 5, 900
> RETURN
>
> My problem is with the servo, it will spin one way with no problem.
> But then with i try to go the other direction it turns 1/8 of a
turn
> then stop and hums after that. I have tried varying the Duration of
> Pulsout. Thanks for any help thats offered.
>
> Tony
the stamp. Here's what my code looks like now:
'{$STAMP BS2p}
'{$PBASIC 2.5}
LED1 VAR OUT0
LED2 VAR OUT1
BT1 VAR IN2
BT2 VAR IN3
OUTPUT 0
OUTPUT 1
OUTPUT 4
OUTPUT 5
Main:
LED1 = BT1
LED2 = BT2
IF (0=BT1) THEN GOSUB Servo_Forward
IF (0=BT2) THEN GOSUB Servo_Backwards
PAUSE 20
GOTO Main
Servo_Forward:
PULSOUT 5, 200
PAUSE 20
RETURN
Servo_Backwards:
PULSOUT 5, 3000
PAUSE 20
RETURN
I am using the BASIC Stamp Editor V2.1 1 Beta on an
desktop XP machine(notice the help file tends to lock
up, or crash if i use it for more than one thing, Bug
maybe?)anyways, with the current code i still notice
that Servo_Backwards has a bit of trouble. After a
half of a turn the speed drops?
Thanks again for the help and suggestions,
Tony
__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html
>
> Servo_Forward:
> PULSOUT 5, 200
> PAUSE 20
> RETURN
>
> Servo_Backwards:
> PULSOUT 5, 3000
> PAUSE 20
> RETURN
>
> [noparse][[/noparse]...] with the current code i still notice
> that Servo_Backwards has a bit of trouble.
> After a half of a turn the speed drops?
>
Tony:
Try the spec values first. Send a pulse of 1 ms for one direction, and 2 ms
for the other. Obviously, I can't verify which pulse length will turn the
wheel which way from here, but change those pulsout commands to read:
PULSOUT 5, 1333
and
PULSOUT 5, 2667
Those counts will produce pulses of one and two milliseconds respectively on
a BS2P. (One millisecond is 1000 microseconds. Each count on a BS2P is 0.75
microseconds. Thus, 1000/0.75 is what you want: 1333.
See what happens when you use the nominal values. I'm not sure what your
pulse width of 150 microseconds will do, but it's way outside the nominal
range for RC servos.
Gary
I tried what you suggested and I went from full
rotation to quarter rotation. Why would that be? with
the 200 & 3000, I was making full rotation with a drop
in speed on the reverse rotation half way throught the
spin.
Thanks again
tony
> Tony:
>
> Try the spec values first. Send a pulse of 1 ms for
> one direction, and 2 ms
> for the other. Obviously, I can't verify which pulse
> length will turn the
> wheel which way from here, but change those pulsout
> commands to read:
>
> PULSOUT 5, 1333
>
> and
>
> PULSOUT 5, 2667
>
> Those counts will produce pulses of one and two
> milliseconds respectively on
> a BS2P. (One millisecond is 1000 microseconds. Each
> count on a BS2P is 0.75
> microseconds. Thus, 1000/0.75 is what you want:
> 1333.
>
> See what happens when you use the nominal values.
> I'm not sure what your
> pulse width of 150 microseconds will do, but it's
> way outside the nominal
> range for RC servos.
>
> Gary
>
__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html
>
> I tried what you suggested [noparse][[/noparse]Pulse widths of 1ms and 2ms]
> and I went from full rotation to quarter rotation. Why would
> that be? with the [noparse][[/noparse]Pulse widths of 0.15ms and 2.25 ms] I was
> was making full rotation with a drop in speed on the reverse
> rotation half way throught the spin.
>
Personally, I'm at a loss to explain that Tony. I don't work with the
modified servos so I don't have experience with the various ways that things
go wrong. Now that we have the code sorted out, I'm out of ideas.
Hopefully someone else can chime in with a suggestion, because my only
thought is that the servo was not modified correctly. Did you modify this
one yourself or buy it pre-modified? Do you have a known-good modified servo
from Parallax that you can connect and test with the same program?
Gary
which PWM controls its DC motor. It
has a variable resistor coupled to the
output shaft with gearing. The resistor
modifies a circuit to produce a
variable-width pulse -- from 1 mS to
2 mS. The Servo circuitry compares this
pulse to the input pulse, to know what
position to move the servo to. Then
the output shaft can swing 180 degrees,
from full left to full right. It expects
the input pulse to be refreshed no more
frequently than once every 10 mSec, and
no less frequently than once every 50 mSec,
where 20 mSec is typical.
A 1.5 mS pulse is considered 'centered'.
A modified servo disconnects the variable
resistor, and leaves it at the center
position. It also removes any 'stops'
in the gearing. Then any pulse greater
than 1.5 mSec will tell the Servo
circuitry to drive in one direction
continuously, and less than 1.5 mSec will
tell it to drive in the other direction,
also continuously. I assume that the
magnitude of difference in the input
pulse between the 1.5 mSec will have
SOME effect on the speed.
Now, having said all that, the only
things that I know of that would change
the speed of the servo for a given
input pulse width would be the voltage,
or the internal resistor moving, or
some binding or wear in the gearing, or
some wear on the motor.
Note this 1 mSec and 2 mSec pulse width
is not set in stone. It's what the
Futaba F148 and compatible servo's use,
but other vendors are free to use other
pulse-widths.
I'd check power first, and then insure
the internal resistor doesn't move.
--- In basicstamps@yahoogroups.com, "Gary W. Sims" <simsgw@c...>
wrote:
> From: "not today" <dakota_99_64804@y...>
> >
> > I tried what you suggested [noparse][[/noparse]Pulse widths of 1ms and 2ms]
> > and I went from full rotation to quarter rotation. Why would
> > that be? with the [noparse][[/noparse]Pulse widths of 0.15ms and 2.25 ms] I was
> > was making full rotation with a drop in speed on the reverse
> > rotation half way throught the spin.
> >
> Personally, I'm at a loss to explain that Tony. I don't work with
the
> modified servos so I don't have experience with the various ways
that things
> go wrong. Now that we have the code sorted out, I'm out of ideas.
>
> Hopefully someone else can chime in with a suggestion, because my
only
> thought is that the servo was not modified correctly. Did you
modify this
> one yourself or buy it pre-modified? Do you have a known-good
modified servo
> from Parallax that you can connect and test with the same program?
>
> Gary
the Variable Resistor. I have clipped the gears of the
stop piece, but the POT i didn't mess with. By
disconnecting the POT, are pulling the gear off it or
clipping a lead or two? Would test this but i'm on
vacation and couldn't bring it with me... One of those
airline things... but i will be able to check this
when i get home... Thanks for all the help, tony
--- Allan Lane <allan.lane@h...> wrote:
> A modified servo disconnects the variable
> resistor, and leaves it at the center
> position. It also removes any 'stops'
> in the gearing. Then any pulse greater
> than 1.5 mSec will tell the Servo
> circuitry to drive in one direction
> continuously, and less than 1.5 mSec will
> tell it to drive in the other direction,
> also continuously. I assume that the
> magnitude of difference in the input
> pulse between the 1.5 mSec will have
> SOME effect on the speed.
__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html
To do this, program the Stamp with a simple
program that pulses the output for 1.5 mSec --
like:
OutPin CON 2
LOW OutPin
MAIN:
PULSOUT OutPin, 1500
PAUSE 20
GOTO MAIN
Run this program, with the servo connected.
Rotate the POT until the motor stops moving.
That's the "center position" for the POT. This
should make the forward and reverse speeds
more equal and stable.
Oh, and "Disconnecting" the POT -- the gear
sitting on top of the POT has an insert inside
it. Remove the insert if it is removable.
On older Servo's you may have to drill it out.
If so, use the right size drill bit and rotate
it BY HAND -- the gear plastic is very soft.
--- In basicstamps@yahoogroups.com, not today <dakota_99_64804@y...>
wrote:
> think I know what the problem is... Has to due with
> the Variable Resistor. I have clipped the gears of the
> stop piece, but the POT i didn't mess with. By
> disconnecting the POT, are pulling the gear off it or
> clipping a lead or two? Would test this but i'm on
> vacation and couldn't bring it with me... One of those
> airline things... but i will be able to check this
> when i get home... Thanks for all the help, tony
>
> --- Allan Lane <allan.lane@h...> wrote:
> > A modified servo disconnects the variable
> > resistor, and leaves it at the center
> > position. It also removes any 'stops'
> > in the gearing. Then any pulse greater
> > than 1.5 mSec will tell the Servo
> > circuitry to drive in one direction
> > continuously, and less than 1.5 mSec will
> > tell it to drive in the other direction,
> > also continuously. I assume that the
> > magnitude of difference in the input
> > pulse between the 1.5 mSec will have
> > SOME effect on the speed.
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Finance: Get your refund fast by filing online.
> http://taxes.yahoo.com/filing.html
micros are:
BS1 - 150 (units in 10 uS)
BS2 - 750 (units in 2 uS)
BS2e - 750 (units in 2 uS)
BS2sx - 1875 (units in 0.80 uS)
BS2p - 1875 (units in 0.80 uS) ** update from current manual **
BS2pe - 798 (units in 1.88 uS)
-- Jon Williams
-- Applications Engineer, Parallax
-- Snowy Dallas Office
Original Message
From: Allan Lane [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=38395nLRU8QmDsPgdexg-2kX1MicpqV7bk8VZBpCD8d-gVmwFdIsq7-1h6-xpLA2e9QAGObLB4sa50vMfr7E1Tv3cOryTwg]allan.lane@h...[/url
Sent: Saturday, February 14, 2004 8:56 AM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] Re: servo question
You need to move the POT to the "center position".
To do this, program the Stamp with a simple
program that pulses the output for 1.5 mSec --
like:
OutPin CON 2
LOW OutPin
MAIN:
PULSOUT OutPin, 1500
PAUSE 20
GOTO MAIN
Run this program, with the servo connected.
Rotate the POT until the motor stops moving.
That's the "center position" for the POT. This
should make the forward and reverse speeds
more equal and stable.
Oh, and "Disconnecting" the POT -- the gear
sitting on top of the POT has an insert inside
it. Remove the insert if it is removable.
On older Servo's you may have to drill it out.
If so, use the right size drill bit and rotate
it BY HAND -- the gear plastic is very soft.
--- In basicstamps@yahoogroups.com, not today <dakota_99_64804@y...>
wrote:
> think I know what the problem is... Has to due with
> the Variable Resistor. I have clipped the gears of the
> stop piece, but the POT i didn't mess with. By
> disconnecting the POT, are pulling the gear off it or clipping a lead
> or two? Would test this but i'm on vacation and couldn't bring it with
> me... One of those airline things... but i will be able to check this
> when i get home... Thanks for all the help, tony
>
> --- Allan Lane <allan.lane@h...> wrote:
> > A modified servo disconnects the variable
> > resistor, and leaves it at the center
> > position. It also removes any 'stops'
> > in the gearing. Then any pulse greater
> > than 1.5 mSec will tell the Servo
> > circuitry to drive in one direction
> > continuously, and less than 1.5 mSec will
> > tell it to drive in the other direction,
> > also continuously. I assume that the
> > magnitude of difference in the input
> > pulse between the 1.5 mSec will have
> > SOME effect on the speed.