Shop OBEX P1 Docs P2 Docs Learn Events
Servo control with RC receiver... — Parallax Forums

Servo control with RC receiver...

Freddy FFreddy F Posts: 3
edited 2006-08-16 16:44 in BASIC Stamp
I am trying to have my BS2-IC (mounted on the BOE board) read in the signal from an RC receiver to control 4 RC servos. I am using four successive PULSIN commands to capture the receiver signals, followed by four successive PULSOUT commands to the servos. My problem is that the BS2 seems to be missing frames from the receiver in that it captures Channel 1 signal fine, but then misses the corresponding Channel 2 pulse and has to wait until the following Channel 2 pulse (about 20 msec). Once that Ch.2 pulse is captured by PULSIN, the immediately following Ch. 3 pulse is missed and again another 20 ms go by before the next Ch.3 pulse is read. This situation repeats with Ch.4.
Obviously all these missed frames hamper servo performance and preclude real time control through the BS2.
I have tested the code reading in only alternating receiver channels, and that seems to work fine, suggesting that the PULSIN command on the BS2-IC too slow to read in successive receiver channels. Is this correct, or is there another explanation?(wiring, etc...) I unfortunately don't have a scope to confirm what the signal timing is like.
Apologies for the long post, but I searched the forums and did not come across this problem. Thanks for your help!

Federico

Comments

  • dandreaedandreae Posts: 1,375
    edited 2006-08-16 16:15
    Try this sample code (attached)·and see if it works for your project.

    Dave

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Tech Support
    dandreae@parallax.com
    Http://www.parallax.com
  • Beau SchwabeBeau Schwabe Posts: 6,560
    edited 2006-08-16 16:22
    Usually, the signal from the receiver is staggered, but they could be presented all at once and then drop off.
    In your case though I believe the signal is staggered and what you are seeing, or not seeing for that matter, is
    the transition from high to low of one signal, and the transition of low to high of the adjacent signal being virtually
    on-top of one another. In this case there is not enough time for one pulsin to finish before the next pulsin starts.

    As you mentioned, one solution is to read every other signal (1-3 and then 2-4)

    You might get a slight increase of performance if you read 2,4,1, and then 3
    The reason this might work better, is because you start out reading 2, and 4 (staggered)
    then you have a 20mS delay before 1 is ready (effectively staggering again), and then 3
    is ready to go. (staggered once again)

    The net result is that it takes slightly more than 20 mS to read all 4 signals with 1&3 phase delayed by 20mS

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • Freddy FFreddy F Posts: 3
    edited 2006-08-16 16:25
    Thanks for the quick reply Dave. I had already tried your code and was having the same problem with it. In your 2 servo code, if the BS2 reads the pulses from Ch.1 and Ch.2 on the receiver, performance degrades (I believe due to skipped frames). On the other hand, if the BS2 reads the signals from Ch.1 and Ch.3 on the receiver, everything seems to work properly. What is the delay time between two PULSIN commands?
    Thanks very much,

    Federico
  • Freddy FFreddy F Posts: 3
    edited 2006-08-16 16:33
    Thanks Beau! I will also try a different receiver (currently using JR, I've read that other manufacturers have slightly different output phases). I will be getting a BS2px soon anyways, I imagine this will increase the PULSIN command speed?

    Federico
  • dandreaedandreae Posts: 1,375
    edited 2006-08-16 16:44
    Freddy F said...
    Thanks for the quick reply Dave. I had already tried your code and was having the same problem with it. In your 2 servo code, if the BS2 reads the pulses from Ch.1 and Ch.2 on the receiver, performance degrades (I believe due to skipped frames). On the other hand, if the BS2 reads the signals from Ch.1 and Ch.3 on the receiver, everything seems to work properly. What is the delay time between two PULSIN commands?
    Thanks very much,

    Federico
    The units are 2uS between each trigger of the Pulsin.· The difference between two commands would have to be measured on an oscilloscope.

    Dave

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Tech Support
    dandreae@parallax.com
    Http://www.parallax.com



    Post Edited (Dave Andreae (Parallax)) : 8/16/2006 4:50:02 PM GMT
Sign In or Register to comment.