Shop OBEX P1 Docs P2 Docs Learn Events
Fluctuating RC readings — Parallax Forums

Fluctuating RC readings

ArchiverArchiver Posts: 46,084
edited 2003-04-24 20:45 in General Discussion
I have a project which involves using a remote controller to control
a platform. The direct pulse-in readings of the basic stamp from the
receiver give very fluctuating values even when the remote
controller lever stick is stationary. I can overcome this problem
using software programming, but I sacrifice resloution. Like to ask
to there is a good solution using hardware to filter off the noise
or other disturbance. I have tried using a simple RC noise filter
but did not really help.

Thank you!

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-04-22 22:00
    Hey,
    I had the exact same problem trying to use pulsin to get the 20ms
    commands from my R/C receiver, no one on here gave me an answer that
    worked, so if you figure it out could you pass on the knowledge please?

    -Mike

    Original Message
    From: juijing [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=hZqkJdBzDmXtt1T6nBx4k97sxjrZHeKAFTdBrDFTj4s1Qlc1Ft3x8zSSNerdqFjQRm7oDS1KW2PniXqy]juijing@y...[/url
    Sent: Tuesday, April 22, 2003 1:27 AM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] Fluctuating RC readings

    I have a project which involves using a remote controller to control
    a platform. The direct pulse-in readings of the basic stamp from the
    receiver give very fluctuating values even when the remote
    controller lever stick is stationary. I can overcome this problem
    using software programming, but I sacrifice resloution. Like to ask
    to there is a good solution using hardware to filter off the noise
    or other disturbance. I have tried using a simple RC noise filter
    but did not really help.

    Thank you!



    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/
  • ArchiverArchiver Posts: 46,084
    edited 2003-04-23 17:51
    Hi, I overcame the problem using programming.I create a "buffer" zone in the
    program with a tolerance range that is greater than the fluctuating range. If
    the pulse-in value is within this range, it means that the remote controller
    lever stick is stationary and I will use the same previous pulse-in value for
    calculation.Hence, my servos will not be jerky. However, I loses resolution due
    to this "buffer" zone. I am quite sure there is a hardware solution to this
    problem. So, if anyone knows, pls help. Thanks in advance!

    Mike Dillon <laxboy687@e...> wrote:Hey,
    I had the exact same problem trying to use pulsin to get the 20ms
    commands from my R/C receiver, no one on here gave me an answer that
    worked, so if you figure it out could you pass on the knowledge please?

    -Mike

    Original Message
    From: juijing [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=gADOi1PdSdEpuMO_OwSgJX_qHCdI4M3-kXlNRyUHlU0RUvoXjZq2jMqGMHdcokKvZ2z62T8O1Wl0eQ]juijing@y...[/url
    Sent: Tuesday, April 22, 2003 1:27 AM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] Fluctuating RC readings

    I have a project which involves using a remote controller to control
    a platform. The direct pulse-in readings of the basic stamp from the
    receiver give very fluctuating values even when the remote
    controller lever stick is stationary. I can overcome this problem
    using software programming, but I sacrifice resloution. Like to ask
    to there is a good solution using hardware to filter off the noise
    or other disturbance. I have tried using a simple RC noise filter
    but did not really help.

    Thank you!



    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/




    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/




    Do you Yahoo!?
    The New Yahoo! Search - Faster. Easier. Bingo.

    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-04-23 18:45
    How far away from the Stamp is your remote controller? It may be
    that the wiring is picking up electrical noise that makes your PULSIN
    or RCtime readings erratic. Consider using a shielded twisted pair
    from the Stamp to the controller.

    In software, a digital lowpass filter or a boxcar average might help.

    -- Tracy


    For filtering,

    >Hi, I overcame the problem using programming.I create a "buffer"
    >zone in the program with a tolerance range that is greater than the
    >fluctuating range. If the pulse-in value is within this range, it
    >means that the remote controller lever stick is stationary and I
    >will use the same previous pulse-in value for calculation.Hence, my
    >servos will not be jerky. However, I loses resolution due to this
    >"buffer" zone. I am quite sure there is a hardware solution to this
    >problem. So, if anyone knows, pls help. Thanks in advance!
    >
    >Mike Dillon <laxboy687@e...> wrote:Hey,
    >I had the exact same problem trying to use pulsin to get the 20ms
    >commands from my R/C receiver, no one on here gave me an answer that
    >worked, so if you figure it out could you pass on the knowledge please?
    >
    >-Mike
    >
    >
    Original Message
    >From: juijing [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=VobU6_Gm1i9XvCBDxZOVXbOqf410HPYua0UMb5TxnLNaUxnIgcNgw417R0ojIttIQwfDOPNP3GUZDR94]juijing@y...[/url
    >Sent: Tuesday, April 22, 2003 1:27 AM
    >To: basicstamps@yahoogroups.com
    >Subject: [noparse][[/noparse]basicstamps] Fluctuating RC readings
    >
    >I have a project which involves using a remote controller to control
    >a platform. The direct pulse-in readings of the basic stamp from the
    >receiver give very fluctuating values even when the remote
    >controller lever stick is stationary. I can overcome this problem
    >using software programming, but I sacrifice resloution. Like to ask
    >to there is a good solution using hardware to filter off the noise
    >or other disturbance. I have tried using a simple RC noise filter
    >but did not really help.
    >
    >Thank you!
    >
    >
    >
    >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/
    >
    >
    >
    >
    >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/
    >
    >
    >
    >
    >
    >Do you Yahoo!?
    >The New Yahoo! Search - Faster. Easier. Bingo.
    >
    >[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/
  • ArchiverArchiver Posts: 46,084
    edited 2003-04-23 22:23
    Tracy's suggestion is right on the mark, as usual. I like to do a
    16-point sliding boxcar average of A/D data at the PIC level, before
    uploading the data to a PC through a serial port. Another tip for
    low-noise A/D data is to sample at a higher rate (I use 5X) than your
    system requires, perform the above boxcar averaging (which is a low-pass
    filter), and then send decimated data (such as every 5th point) to the
    PC for final analysis.

    Dennis

    Original Message
    From: Tracy Allen [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=3TIpOAd8a-hRPh6g12n3MlAr9T5TAjRG9k3gjrRjV7DMRkHI6ENFr3GRBjfWjJihIzz5oKsQuR04dARd]tracy@e...[/url
    Sent: Wednesday, April 23, 2003 10:45 AM
    To: basicstamps@yahoogroups.com
    Subject: RE: [noparse][[/noparse]basicstamps] Fluctuating RC readings


    How far away from the Stamp is your remote controller? It may be
    that the wiring is picking up electrical noise that makes your PULSIN
    or RCtime readings erratic. Consider using a shielded twisted pair
    from the Stamp to the controller.

    In software, a digital lowpass filter or a boxcar average might help.

    -- Tracy


    For filtering,

    >Hi, I overcame the problem using programming.I create a "buffer"
    >zone in the program with a tolerance range that is greater than the
    >fluctuating range. If the pulse-in value is within this range, it
    >means that the remote controller lever stick is stationary and I
    >will use the same previous pulse-in value for calculation.Hence, my
    >servos will not be jerky. However, I loses resolution due to this
    >"buffer" zone. I am quite sure there is a hardware solution to this
    >problem. So, if anyone knows, pls help. Thanks in advance!
    >
    >Mike Dillon <laxboy687@e...> wrote:Hey,
    >I had the exact same problem trying to use pulsin to get the 20ms
    >commands from my R/C receiver, no one on here gave me an answer that
    >worked, so if you figure it out could you pass on the knowledge please?
    >
    >-Mike
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2003-04-24 07:49
    Can you elaborate more on "a boxcar average" ? Thanks!

    Dennis O'Leary <doleary@e...> wrote:Tracy's suggestion is right on the
    mark, as usual. I like to do a
    16-point sliding boxcar average of A/D data at the PIC level, before
    uploading the data to a PC through a serial port. Another tip for
    low-noise A/D data is to sample at a higher rate (I use 5X) than your
    system requires, perform the above boxcar averaging (which is a low-pass
    filter), and then send decimated data (such as every 5th point) to the
    PC for final analysis.

    Dennis

    Original Message
    From: Tracy Allen [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=PR2KpkAkjVGVhy5ZiZjp6wOlpsZmVlIXvqHdaCNPsJ3jay8wfA7GIatlO8Su7EF_S7uq0aG61uX-uA]tracy@e...[/url
    Sent: Wednesday, April 23, 2003 10:45 AM
    To: basicstamps@yahoogroups.com
    Subject: RE: [noparse][[/noparse]basicstamps] Fluctuating RC readings


    How far away from the Stamp is your remote controller? It may be
    that the wiring is picking up electrical noise that makes your PULSIN
    or RCtime readings erratic. Consider using a shielded twisted pair
    from the Stamp to the controller.

    In software, a digital lowpass filter or a boxcar average might help.

    -- Tracy


    For filtering,

    >Hi, I overcame the problem using programming.I create a "buffer"
    >zone in the program with a tolerance range that is greater than the
    >fluctuating range. If the pulse-in value is within this range, it
    >means that the remote controller lever stick is stationary and I
    >will use the same previous pulse-in value for calculation.Hence, my
    >servos will not be jerky. However, I loses resolution due to this
    >"buffer" zone. I am quite sure there is a hardware solution to this
    >problem. So, if anyone knows, pls help. Thanks in advance!
    >
    >Mike Dillon wrote:Hey,
    >I had the exact same problem trying to use pulsin to get the 20ms
    >commands from my R/C receiver, no one on here gave me an answer that
    >worked, so if you figure it out could you pass on the knowledge please?
    >
    >-Mike
    >
    >



    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/




    Do you Yahoo!?
    The New Yahoo! Search - Faster. Easier. Bingo.

    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-04-24 18:24
    A sliding boxcar average:

    1) Every output reading is the average the the past N raw readings.
    Say, N=16. "Boxcar" means that all 16 readings carry equal weight,
    kind of like the profile of a boxcar on a train. Alternative schemes
    give less weight to readings further in the past. "Sliding" or
    "moving" means the average is always the past 16, and output readings
    can be had at the same rate as input readings. That is opposed to a
    fixed average where you might accumulate 16 raw samples, then output
    the average of those, and then take 16 more and output the average of
    those, in which case the output rate is 1/16 of the input rate.

    2) To initiate a boxcar average, you take one raw reading and fill 16
    slots in a buffer with that same reading. The sum is just 16*(raw
    reading). You maintain the sum also in a separate memory location.
    You see, the boxcar is fairly memory intensive, so you probably need
    to use a Stamp with scratchpad RAM.

    3) Each time you take a new raw reading, you put it in the top of the
    buffer, and drop the oldest reading from the bottom of the buffer.
    You subtract the oldest reading from the sum and add the newest
    reading. The output value is the sum divided by 16. The top and
    bottom of the buffer are usually determined by a pointer, rather than
    by actually moving the data.


    An exponential lowpass filter is less memory intensive:

    1) Every new output reading, X, is made by taking the old value of X
    times (N-1)/N, plus the new raw reading times 1/N. By making N
    larger, each new reading contributes less to the total, the effect of
    old readings takes longer to "fade away". In the Stamp, there are
    some tricks necessary to maintain accuracy with integer math. I have
    some info about that on my web site.

    The time constant in either of these schemes is in terms of number of
    samples, not time. To link it to time, you have to consider how
    often you take the samples.

    -- best regards
    Thomas Tracy Allen PhD
    electronically monitored ecosystems
    http://www.emesystems.com
    mailto:tracy@e...





    >Can you elaborate more on "a boxcar average" ? Thanks!
    >
    >Dennis O'Leary <doleary@e...> wrote:Tracy's suggestion is
    >right on the mark, as usual. I like to do a
    >16-point sliding boxcar average of A/D data at the PIC level, before
    >uploading the data to a PC through a serial port. Another tip for
    >low-noise A/D data is to sample at a higher rate (I use 5X) than your
    >system requires, perform the above boxcar averaging (which is a low-pass
    >filter), and then send decimated data (such as every 5th point) to the
    >PC for final analysis.
    >
    >Dennis
    >
    >
    Original Message
    >From: Tracy Allen [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=7aG804eQed_QSzgyICiI443HgkurBas-aXpEYsosYM40k-utLTP1XEAQRg2lQ6_VwuLO5hIoxp6nRg]tracy@e...[/url
    >Sent: Wednesday, April 23, 2003 10:45 AM
    >To: basicstamps@yahoogroups.com
    >Subject: RE: [noparse][[/noparse]basicstamps] Fluctuating RC readings
    >
    >
    >How far away from the Stamp is your remote controller? It may be
    >that the wiring is picking up electrical noise that makes your PULSIN
    >or RCtime readings erratic. Consider using a shielded twisted pair
    >from the Stamp to the controller.
    >
    >In software, a digital lowpass filter or a boxcar average might help.
    >
    >-- Tracy
    >
    >
    >For filtering,
    >
    >>Hi, I overcame the problem using programming.I create a "buffer"
    >>zone in the program with a tolerance range that is greater than the
    >>fluctuating range. If the pulse-in value is within this range, it
    >>means that the remote controller lever stick is stationary and I
    >>will use the same previous pulse-in value for calculation.Hence, my
    >>servos will not be jerky. However, I loses resolution due to this
    >>"buffer" zone. I am quite sure there is a hardware solution to this
    >>problem. So, if anyone knows, pls help. Thanks in advance!
    >>
    >>Mike Dillon wrote:Hey,
    >>I had the exact same problem trying to use pulsin to get the 20ms
    >>commands from my R/C receiver, no one on here gave me an answer that
    >>worked, so if you figure it out could you pass on the knowledge please?
    >>
    >>-Mike
    > >
    >>
    >
  • ArchiverArchiver Posts: 46,084
    edited 2003-04-24 20:45
    Great explanation, Tracy. An additional note for beginners is that use
    of N=16 is arbitrary. As a larger N is used, the data are filtered at a
    lower frequency, which may or may not be a good thing for a particular
    application. Older digital signal processing literature referred to
    these as "smoothing filters" for obvious reasons. A choice of N as a
    power of 2 simplifies the averaging process for Stamp use, by shifting N
    bits to the right in a cumulative sum, as explained on Tracy's website.

    Dennis

    Original Message
    From: Tracy Allen [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=4LsRybcF47vTi_tV-EyUwxYtgdZGEaTkLkzRv9tEtvhr2CkeqchGYJ5WGSbKsGD7qOSrkd4z5JhIKQ]tracy@e...[/url
    Sent: Thursday, April 24, 2003 10:25 AM
    To: basicstamps@yahoogroups.com
    Subject: RE: [noparse][[/noparse]basicstamps] Fluctuating RC readings


    A sliding boxcar average:

    1) Every output reading is the average the the past N raw readings.
    Say, N=16. "Boxcar" means that all 16 readings carry equal weight,
    kind of like the profile of a boxcar on a train. Alternative schemes
    give less weight to readings further in the past. "Sliding" or
    "moving" means the average is always the past 16, and output readings
    can be had at the same rate as input readings. That is opposed to a
    fixed average where you might accumulate 16 raw samples, then output
    the average of those, and then take 16 more and output the average of
    those, in which case the output rate is 1/16 of the input rate.

    2) To initiate a boxcar average, you take one raw reading and fill 16
    slots in a buffer with that same reading. The sum is just 16*(raw
    reading). You maintain the sum also in a separate memory location.
    You see, the boxcar is fairly memory intensive, so you probably need
    to use a Stamp with scratchpad RAM.

    3) Each time you take a new raw reading, you put it in the top of the
    buffer, and drop the oldest reading from the bottom of the buffer.
    You subtract the oldest reading from the sum and add the newest
    reading. The output value is the sum divided by 16. The top and
    bottom of the buffer are usually determined by a pointer, rather than
    by actually moving the data.


    An exponential lowpass filter is less memory intensive:

    1) Every new output reading, X, is made by taking the old value of X
    times (N-1)/N, plus the new raw reading times 1/N. By making N
    larger, each new reading contributes less to the total, the effect of
    old readings takes longer to "fade away". In the Stamp, there are
    some tricks necessary to maintain accuracy with integer math. I have
    some info about that on my web site.

    The time constant in either of these schemes is in terms of number of
    samples, not time. To link it to time, you have to consider how
    often you take the samples.

    -- best regards
    Thomas Tracy Allen PhD
    electronically monitored ecosystems
    http://www.emesystems.com
    mailto:tracy@e...





    >Can you elaborate more on "a boxcar average" ? Thanks!
    >
    >Dennis O'Leary <doleary@e...> wrote:Tracy's suggestion is
    >right on the mark, as usual. I like to do a
    >16-point sliding boxcar average of A/D data at the PIC level, before
    >uploading the data to a PC through a serial port. Another tip for
    >low-noise A/D data is to sample at a higher rate (I use 5X) than your
    >system requires, perform the above boxcar averaging (which is a
    low-pass
    >filter), and then send decimated data (such as every 5th point) to the
    >PC for final analysis.
    >
    >Dennis
    >
    >
    Original Message
    >From: Tracy Allen [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=4LsRybcF47vTi_tV-EyUwxYtgdZGEaTkLkzRv9tEtvhr2CkeqchGYJ5WGSbKsGD7qOSrkd4z5JhIKQ]tracy@e...[/url
    >Sent: Wednesday, April 23, 2003 10:45 AM
    >To: basicstamps@yahoogroups.com
    >Subject: RE: [noparse][[/noparse]basicstamps] Fluctuating RC readings
    >
    >
    >How far away from the Stamp is your remote controller? It may be that
    >the wiring is picking up electrical noise that makes your PULSIN or
    >RCtime readings erratic. Consider using a shielded twisted pair from
    >the Stamp to the controller.
    >
    >In software, a digital lowpass filter or a boxcar average might help.
    >
    >-- Tracy
    >
    >
    >For filtering,
    >
    >>Hi, I overcame the problem using programming.I create a "buffer" zone
    >>in the program with a tolerance range that is greater than the
    >>fluctuating range. If the pulse-in value is within this range, it
    >>means that the remote controller lever stick is stationary and I will
    >>use the same previous pulse-in value for calculation.Hence, my servos
    >>will not be jerky. However, I loses resolution due to this "buffer"
    >>zone. I am quite sure there is a hardware solution to this problem.
    >>So, if anyone knows, pls help. Thanks in advance!
    >>
    >>Mike Dillon wrote:Hey,
    >>I had the exact same problem trying to use pulsin to get the 20ms
    >>commands from my R/C receiver, no one on here gave me an answer that
    >>worked, so if you figure it out could you pass on the knowledge
    >>please?
    >>
    >>-Mike
    > >
    >>
    >

    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/
Sign In or Register to comment.