R/C Receiver - BS2 Input Connection
Archiver
Posts: 46,084
Hello Everyone
I am attempting a small BS2 project where I would like to control BS2
inputs with the output of a simple R/C reciever. The R/C control used
is a toggle switch on the transmitter. When the switch is one way it
drives the servo to one extreme (CW) and when the switch is toggled
in the direction, it drives the servo to the other (CCW). I assume
the receiver is outputting a 1.0 ms pulse in one state and a 1.5ms
pulse in the other. I would like to know which position the switch is
in so I can run separate servo sequences. I tried using the following
code with the PULSIN command:
pulse var word
main:
pulsin 0, 0, pulse
debug "Pulse = ", dec pulse, cr
If Pulse > 750 then other
debug "pulse is greater than 750"
other:
debug "pulse is less than 750"
pause 450
goto main
I tried to move the pot on the transmitter to see the change in debug
to no avail - all I got was randem values for 'pulse'
The things I am not sure on are: 1/if connecting the signal line
directly to the stamp is the right thing to do and 2/what the best
command is to read the PWM signal from the receiver so I can follow
through to get the stamp to do one thing or another.
If someone could shed some light, it would be appreciated.
Thanks
Kim
I am attempting a small BS2 project where I would like to control BS2
inputs with the output of a simple R/C reciever. The R/C control used
is a toggle switch on the transmitter. When the switch is one way it
drives the servo to one extreme (CW) and when the switch is toggled
in the direction, it drives the servo to the other (CCW). I assume
the receiver is outputting a 1.0 ms pulse in one state and a 1.5ms
pulse in the other. I would like to know which position the switch is
in so I can run separate servo sequences. I tried using the following
code with the PULSIN command:
pulse var word
main:
pulsin 0, 0, pulse
debug "Pulse = ", dec pulse, cr
If Pulse > 750 then other
debug "pulse is greater than 750"
other:
debug "pulse is less than 750"
pause 450
goto main
I tried to move the pot on the transmitter to see the change in debug
to no avail - all I got was randem values for 'pulse'
The things I am not sure on are: 1/if connecting the signal line
directly to the stamp is the right thing to do and 2/what the best
command is to read the PWM signal from the receiver so I can follow
through to get the stamp to do one thing or another.
If someone could shed some light, it would be appreciated.
Thanks
Kim
Comments
First of all, the range of most R/C servos is a positive going pulse going
from 1.0 to 2.0 ms with 1.5 ms being the servo center position. The pulse
from the R/C reciever is repeated at a rate of 50 times per second.
Your pulsin command shoud be as follows:
pulsin 0,1, pulse 'The one indicates a positive going pulse (ie: 0
to 1)
You didn't specify which chip you are using (it matters) so I don't know if
your values are correct for the "if then" statement.
The other problem I see in your code is the delay. The loop must be
checked in less than 20 ms (1 divided by 50) assuming you want to constantly
check the pulse in order to "see" each pulse. To see if the switch is
thrown simply check for pulse width of greater than say 1.5 ms. You can
adjust these numbers to make it catch the switch position every time.
I am using 8 channels of servo control in a R/C project and have had
great sucess with the Stamps and servos. If you need anymore help let me
know.
Clear as mud now? <g>
MIke B.
Original Message
From: "krcnz" <krcnz@y...>
To: <basicstamps@yahoogroups.com>
Sent: Saturday, October 19, 2002 5:25 AM
Subject: [noparse][[/noparse]basicstamps] R/C Receiver - BS2 Input Connection
> Hello Everyone
>
> I am attempting a small BS2 project where I would like to control BS2
> inputs with the output of a simple R/C reciever. The R/C control used
> is a toggle switch on the transmitter. When the switch is one way it
> drives the servo to one extreme (CW) and when the switch is toggled
> in the direction, it drives the servo to the other (CCW). I assume
> the receiver is outputting a 1.0 ms pulse in one state and a 1.5ms
> pulse in the other. I would like to know which position the switch is
> in so I can run separate servo sequences. I tried using the following
> code with the PULSIN command:
>
> pulse var word
>
> main:
>
> pulsin 0, 0, pulse
> debug "Pulse = ", dec pulse, cr
> If Pulse > 750 then other
> debug "pulse is greater than 750"
>
> other:
> debug "pulse is less than 750"
> pause 450
>
> goto main
>
> I tried to move the pot on the transmitter to see the change in debug
> to no avail - all I got was randem values for 'pulse'
>
> The things I am not sure on are: 1/if connecting the signal line
> directly to the stamp is the right thing to do and 2/what the best
> command is to read the PWM signal from the receiver so I can follow
> through to get the stamp to do one thing or another.
>
> If someone could shed some light, it would be appreciated.
>
> Thanks
>
> Kim
>
>
>
>
> 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/
>
>
statement to this:
PULSIN 0, 1, pWidth
pWidth = pWidth * 2
DEBUG DEC (pWidth / 1000), ".", DEC3 pWidth, " milliseconds"
The PULSIN function returns a value in 2 microsecond (1/1000 of a
millisecond) units, so you need to multiply by 2 to get microseconds. The
DEBUG line will make a nice output so, when centered, you should see
something like this:
1.500 milliseconds
Leave the PAUSE 450 out since the DEBUG causes a small delay and the receiver
should be sending updates every 20 milliseconds or so.
-- Jon Williams
-- Parallax
In a message dated 10/19/02 7:26:09 AM Central Daylight Time,
krcnz@y... writes:
> Hello Everyone
>
> I am attempting a small BS2 project where I would like to control BS2
> inputs with the output of a simple R/C receiver. The R/C control used
> is a toggle switch on the transmitter. When the switch is one way it
> drives the servo to one extreme (CW) and when the switch is toggled
> in the direction, it drives the servo to the other (CCW). I assume
> the receiver is outputting a 1.0 ms pulse in one state and a 1.5ms
> pulse in the other. I would like to know which position the switch is
> in so I can run separate servo sequences. I tried using the following
> code with the PULSIN command:
>
> pulse var word
>
> main:
>
> pulsin 0, 0, pulse
> debug "Pulse = ", dec pulse, cr
> If Pulse > 750 then other
> debug "pulse is greater than 750"
>
> other:
> debug "pulse is less than 750"
> pause 450
>
> goto main
>
> I tried to move the pot on the transmitter to see the change in debug
> to no avail - all I got was randem values for 'pulse'
>
> The things I am not sure on are: 1/if connecting the signal line
> directly to the stamp is the right thing to do and 2/what the best
> command is to read the PWM signal from the receiver so I can follow
> through to get the stamp to do one thing or another.
>
> If someone could shed some light, it would be appreciated.
>
> Thanks
>
>
[noparse][[/noparse]Non-text portions of this message have been removed]
Thank you both for your help. I can see where some of my fundamentals
are wrong. I have tried Jon's code as my inital task is to get the
R/C receiver talking and BS2 Stamp listening. Unfortunately I got
debug results that I could not make heads nor tails of.
In any position I got alot of 0.002, 0.004 readings and every once in
a while (somewhere between the 10th and 30th sample) I got a 1.544
(in centre), 1.228 (one direction) and 1.852 (other direction). So
this is something, but immediately after the samples with the numbers
I expected, I get a sample of 13.500 or thereabouts - always over
13.000. This happens in any position, so I'm not sure what to look
for next. The receiver is a JR 2 Channel AM unit, I'm not sure if JR
have a propriety signal system??? To check normal operation I ran a
servo in parallel with the single signal wire going to my input port
and the servo worked fine with movement of the transmitter. I also
unplugged the input wire to check that the numbers were coming from
the receiver and not just random off the stamp (for whatever reason)
and all of the smaples went to zero.
Any further ideas?? (This is only my second week with using the
stamp - or any kind of microcontroller and I'm a little perplexed as
to which way to jump next)
Thank you in advanced
Kim
--- In basicstamps@y..., jonwms@a... wrote:
> Since the RC receiver outputs a high-going pulse, change your
PULSIN
> statement to this:
>
> PULSIN 0, 1, pWidth
> pWidth = pWidth * 2
> DEBUG DEC (pWidth / 1000), ".", DEC3 pWidth, " milliseconds"
>
> The PULSIN function returns a value in 2 microsecond (1/1000 of a
> millisecond) units, so you need to multiply by 2 to get
microseconds. The
> DEBUG line will make a nice output so, when centered, you should
see
> something like this:
>
> 1.500 milliseconds
>
> Leave the PAUSE 450 out since the DEBUG causes a small delay and
the receiver
> should be sending updates every 20 milliseconds or so.
>
> -- Jon Williams
> -- Parallax
>
> In a message dated 10/19/02 7:26:09 AM Central Daylight Time,
> krcnz@y... writes:
>
>
> > Hello Everyone
> >
> > I am attempting a small BS2 project where I would like to control
BS2
> > inputs with the output of a simple R/C receiver. The R/C control
used
> > is a toggle switch on the transmitter. When the switch is one way
it
> > drives the servo to one extreme (CW) and when the switch is
toggled
> > in the direction, it drives the servo to the other (CCW). I
assume
> > the receiver is outputting a 1.0 ms pulse in one state and a
1.5ms
> > pulse in the other. I would like to know which position the
switch is
> > in so I can run separate servo sequences. I tried using the
following
> > code with the PULSIN command:
> >
> > pulse var word
> >
> > main:
> >
> > pulsin 0, 0, pulse
> > debug "Pulse = ", dec pulse, cr
> > If Pulse > 750 then other
> > debug "pulse is greater than 750"
> >
> > other:
> > debug "pulse is less than 750"
> > pause 450
> >
> > goto main
> >
> > I tried to move the pot on the transmitter to see the change in
debug
> > to no avail - all I got was randem values for 'pulse'
> >
> > The things I am not sure on are: 1/if connecting the signal line
> > directly to the stamp is the right thing to do and 2/what the
best
> > command is to read the PWM signal from the receiver so I can
follow
> > through to get the stamp to do one thing or another.
> >
> > If someone could shed some light, it would be appreciated.
> >
> > Thanks
> >
> >
>
>
>
>
> [noparse][[/noparse]Non-text portions of this message have been removed]
Mike B.
Original Message
From: "krcnz" <krcnz@y...>
To: <basicstamps@yahoogroups.com>
Sent: Saturday, October 19, 2002 4:27 PM
Subject: [noparse][[/noparse]basicstamps] Re: R/C Receiver - BS2 Input Connection
> Hello Jon and Mike
>
> Thank you both for your help. I can see where some of my fundamentals
> are wrong. I have tried Jon's code as my inital task is to get the
> R/C receiver talking and BS2 Stamp listening. Unfortunately I got
> debug results that I could not make heads nor tails of.
> In any position I got alot of 0.002, 0.004 readings and every once in
> a while (somewhere between the 10th and 30th sample) I got a 1.544
> (in centre), 1.228 (one direction) and 1.852 (other direction). So
> this is something, but immediately after the samples with the numbers
> I expected, I get a sample of 13.500 or thereabouts - always over
> 13.000. This happens in any position, so I'm not sure what to look
> for next. The receiver is a JR 2 Channel AM unit, I'm not sure if JR
> have a propriety signal system??? To check normal operation I ran a
> servo in parallel with the single signal wire going to my input port
> and the servo worked fine with movement of the transmitter. I also
> unplugged the input wire to check that the numbers were coming from
> the receiver and not just random off the stamp (for whatever reason)
> and all of the smaples went to zero.
>
> Any further ideas?? (This is only my second week with using the
> stamp - or any kind of microcontroller and I'm a little perplexed as
> to which way to jump next)
>
> Thank you in advanced
>
> Kim
>
>
>
>
> --- In basicstamps@y..., jonwms@a... wrote:
> > Since the RC receiver outputs a high-going pulse, change your
> PULSIN
> > statement to this:
> >
> > PULSIN 0, 1, pWidth
> > pWidth = pWidth * 2
> > DEBUG DEC (pWidth / 1000), ".", DEC3 pWidth, " milliseconds"
> >
> > The PULSIN function returns a value in 2 microsecond (1/1000 of a
> > millisecond) units, so you need to multiply by 2 to get
> microseconds. The
> > DEBUG line will make a nice output so, when centered, you should
> see
> > something like this:
> >
> > 1.500 milliseconds
> >
> > Leave the PAUSE 450 out since the DEBUG causes a small delay and
> the receiver
> > should be sending updates every 20 milliseconds or so.
> >
> > -- Jon Williams
> > -- Parallax
> >
> > In a message dated 10/19/02 7:26:09 AM Central Daylight Time,
> > krcnz@y... writes:
> >
> >
> > > Hello Everyone
> > >
> > > I am attempting a small BS2 project where I would like to control
> BS2
> > > inputs with the output of a simple R/C receiver. The R/C control
> used
> > > is a toggle switch on the transmitter. When the switch is one way
> it
> > > drives the servo to one extreme (CW) and when the switch is
> toggled
> > > in the direction, it drives the servo to the other (CCW). I
> assume
> > > the receiver is outputting a 1.0 ms pulse in one state and a
> 1.5ms
> > > pulse in the other. I would like to know which position the
> switch is
> > > in so I can run separate servo sequences. I tried using the
> following
> > > code with the PULSIN command:
> > >
> > > pulse var word
> > >
> > > main:
> > >
> > > pulsin 0, 0, pulse
> > > debug "Pulse = ", dec pulse, cr
> > > If Pulse > 750 then other
> > > debug "pulse is greater than 750"
> > >
> > > other:
> > > debug "pulse is less than 750"
> > > pause 450
> > >
> > > goto main
> > >
> > > I tried to move the pot on the transmitter to see the change in
> debug
> > > to no avail - all I got was randem values for 'pulse'
> > >
> > > The things I am not sure on are: 1/if connecting the signal line
> > > directly to the stamp is the right thing to do and 2/what the
> best
> > > command is to read the PWM signal from the receiver so I can
> follow
> > > through to get the stamp to do one thing or another.
> > >
> > > If someone could shed some light, it would be appreciated.
> > >
> > > Thanks
> > >
> > >
> >
> >
> >
> >
> > [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/
>
>
look at it with?
-- Jon Williams
-- Parallax
In a message dated 10/19/02 6:27:07 PM Central Daylight Time,
krcnz@y... writes:
> Hello Jon and Mike
>
> Thank you both for your help. I can see where some of my fundamentals
> are wrong. I have tried Jon's code as my inital task is to get the
> R/C receiver talking and BS2 Stamp listening. Unfortunately I got
> debug results that I could not make heads nor tails of.
> In any position I got alot of 0.002, 0.004 readings and every once in
> a while (somewhere between the 10th and 30th sample) I got a 1.544
> (in centre), 1.228 (one direction) and 1.852 (other direction). So
> this is something, but immediately after the samples with the numbers
> I expected, I get a sample of 13.500 or thereabouts - always over
> 13.000. This happens in any position, so I'm not sure what to look
> for next. The receiver is a JR 2 Channel AM unit, I'm not sure if JR
> have a propriety signal system??? To check normal operation I ran a
> servo in parallel with the single signal wire going to my input port
> and the servo worked fine with movement of the transmitter. I also
> unplugged the input wire to check that the numbers were coming from
> the receiver and not just random off the stamp (for whatever reason)
> and all of the smaples went to zero.
>
> Any further ideas?? (This is only my second week with using the
> stamp - or any kind of microcontroller and I'm a little perplexed as
> to which way to jump next)
>
[noparse][[/noparse]Non-text portions of this message have been removed]
connected to it is stable and responds as expected. I will set out
over the next couple of days to if I can get another receiver to have
a look at. From what you and Mike have replied to, everything should
have worked honky dorey.
I'll let you both know how I get on.
Thank you
Kim
--- In basicstamps@y..., jonwms@a... wrote:
> Perhaps you've got a bad output from your receiver. Do you have a
scope to
> look at it with?
>
> -- Jon Williams
> -- Parallax
>
> In a message dated 10/19/02 6:27:07 PM Central Daylight Time,
> krcnz@y... writes:
>
>
> > Hello Jon and Mike
> >
> > Thank you both for your help. I can see where some of my
fundamentals
> > are wrong. I have tried Jon's code as my inital task is to get
the
> > R/C receiver talking and BS2 Stamp listening. Unfortunately I got
> > debug results that I could not make heads nor tails of.
> > In any position I got alot of 0.002, 0.004 readings and every
once in
> > a while (somewhere between the 10th and 30th sample) I got a
1.544
> > (in centre), 1.228 (one direction) and 1.852 (other direction).
So
> > this is something, but immediately after the samples with the
numbers
> > I expected, I get a sample of 13.500 or thereabouts - always over
> > 13.000. This happens in any position, so I'm not sure what to
look
> > for next. The receiver is a JR 2 Channel AM unit, I'm not sure if
JR
> > have a propriety signal system??? To check normal operation I ran
a
> > servo in parallel with the single signal wire going to my input
port
> > and the servo worked fine with movement of the transmitter. I
also
> > unplugged the input wire to check that the numbers were coming
from
> > the receiver and not just random off the stamp (for whatever
reason)
> > and all of the smaples went to zero.
> >
> > Any further ideas?? (This is only my second week with using the
> > stamp - or any kind of microcontroller and I'm a little perplexed
as
> > to which way to jump next)
> >
>
>
>
>
> [noparse][[/noparse]Non-text portions of this message have been removed]
>The things I am not sure on are: 1/if connecting the signal line
>directly to the stamp is the right thing to do and 2/what the best
>command is to read the PWM signal from the receiver so I can follow
>through to get the stamp to do one thing or another.
I recently hooked up a rate gyro to a BOE (and then connected that to
the IFI robot controller). You can find commented code at:
http://www.madoverlord.com/Robots/PWM.t
that should give you the clues you need. Even has a pic of the setup.
R
of nonsense data. I'm not an RC guy, so I don't have the equipment to test
this myself. Perhaps another list member can assist.
-- Jon Williams
-- Parallax
In a message dated 10/19/02 8:23:18 PM Central Daylight Time,
krcnz@y... writes:
> No I dont have a scope. I thought the same myself, but a servo
> connected to it is stable and responds as expected. I will set out
> over the next couple of days to if I can get another receiver to have
> a look at. From what you and Mike have replied to, everything should
> have worked honky dorey.
>
> I'll let you both know how I get on.
>
> Thank you
>
> Kim
>
[noparse][[/noparse]Non-text portions of this message have been removed]
More importantly whose rate gyro did you use, and where did you get the
thing?
Gregg C Levine hansolofalcon@w...
"The Force will be with you...Always." Obi-Wan Kenobi
"Use the Force, Luke."· Obi-Wan Kenobi
(This company dedicates this E-Mail to General Obi-Wan Kenobi )
(This company dedicates this E-Mail to Master Yoda )
>
Original Message
> From: Robert Woodhead [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=qdhl6S6MWU2FoCX-pMnVdw6qU6vc71Nn2R54Iwlmti44xN7Y_CAQEampd6Y6yU5ZV1LmgWt8e5_g_A]trebor@a...[/url
> Sent: Saturday, October 19, 2002 9:20 PM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] Re: R/C Receiver - BS2 Input Connection
>
> At 12:13 AM +0000 10/20/02, basicstamps@yahoogroups.com wrote:
> >The things I am not sure on are: 1/if connecting the signal line
> >directly to the stamp is the right thing to do and 2/what the best
> >command is to read the PWM signal from the receiver so I can follow
> >through to get the stamp to do one thing or another.
>
> I recently hooked up a rate gyro to a BOE (and then connected that to
> the IFI robot controller). You can find commented code at:
>
> http://www.madoverlord.com/Robots/PWM.t
>
> that should give you the clues you need. Even has a pic of the setup.
>
> R
>
>
> 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/
>