Shop OBEX P1 Docs P2 Docs Learn Events
how to connect a R/C plane reciever to a BS2 — Parallax Forums

how to connect a R/C plane reciever to a BS2

BOB55BOB55 Posts: 36
edited 2008-04-19 02:04 in BASIC Stamp
Hi
How would you connect a R/C plane reciever to a BS2 so that servos connected to the BS2 would work with an airplane remote control?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
BOB55

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2008-04-13 00:12
    The output of an R/C plane reciever is a TTL pulse (which works with the BS2 directly) pulsing from 1 mSec to 2 mSec wide, repeating every 20 mSec.

    The BS2 can 'read' these signals if you wire them to an I/O pin, and use "PULSIN" to read the pins. I believe the pulses are 'interleaved' on the signal, so they come out first one, then a 1 mSec delay, then the next, then a 1 mSec delay, etc. So, if you read them 'in-order', in the order the R/C reciever is putting them out, you should be able to read an entire sequence of them in 20 mSec. Then use the next 20 mSec to output them to a second set of I/O pins, which are connected to the Servo's.
  • neodd70neodd70 Posts: 3
    edited 2008-04-16 12:03
    Sorry to butt in on your post but I am also trying to read the pulse duration from an RC receiver to a BS2. I tried using the PULSIN command but I was unsuccessful·of getting any readings from the receiver using the DEBUG window. When I had it plugged in it was giving fluxuating numbers with no input from the transmitter. I tried to do a test and plug a servo into a different power sorce then from the receiver and just use the signal wire from the receiver·and got no movement from the servo. However if I touched one of the power wires coming from the receiver on the channel I was using it would·move the servo to a full locked position either clockwise or counterclockwise. My question is, do all 3 wires or at least 2 wires need to be used to receive the pulse from a receiver and if so which one and where would it go or can the BS2 read a pulse from 1 wire only with nothing else touching it like a ground. Any help would be appreciated. Thanks
  • stamptrolstamptrol Posts: 1,731
    edited 2008-04-16 13:05
    You'll be using the signal and ground connections for each servo channel. The Stamp will read it using the PULSIN command. The variable will be a word variable as the number will get bigger than byte-sized.

    Depending on your system, the signal lead may also need a pull-up resistor. In some cases, I've had to feed the servo signal into a mosfet (gate) , which then switches the Stamp input signal. Apparently some of the receiver output lines are very high impedance.

    Cheers,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • Joe FishbackJoe Fishback Posts: 99
    edited 2008-04-16 22:32
    I attached the program I am using to control my Boe-Bot with a RC unit. The way I have the RC control is as follows. The RC receiver is mounted· on the Boe-Bot. Then a wire is connected from the reciever channel 2 (signal) to BOE· pin 6 and reciever channel 1 (signal) to BOE pin 7. The RC reciever sorts out the steam of signals· that comes from the RC tansmitter into the different· channels. The Stamp program on the BOE recieves the signals for each channel and then changes them so you get reverse signals· to send to the two servos driving the Boe-Bot. All this is done under the "RCControl" subrountine of the program. This program also controls the bump sensors on the robot. I hope this will help you. If you have questions, give me a post. I also have programs that interface RC to a Stamp that break the signal from one· control handle on the RC transmitter into controlling more than one thing. As for the three wires going to a servo. one is the control signal and the other two wires are the power to the servo motor. One is +5v and the other is Vss (ground). The ground on the receiver must be connected to the ground on the BOE (stamp board). The Parallax manuals have a good description on how the 3 wires to a servo work.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ······ Joe Fishback

    -Robots are my friends-
  • BOB55BOB55 Posts: 36
    edited 2008-04-17 01:10
    Thank you Joe Fishback, stamptrol, neodd70, and allanlane5 for the info.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    BOB55
  • neodd70neodd70 Posts: 3
    edited 2008-04-17 02:27
    Joe

    I downloaded your source code, thank you it helps a lot to see how it look. One question though. What·is the reason for this code

    R_Target = drive - 1875 + steer
    L_Target = 1875 - drive + steer

    The reason I ask is it might help·me for what I am building. I am building a 4 rotor counter rotating helicopter. I am using 4 brushless outrunner motors with 2 pusher and 2 puller propellors to counteract adverse torque. I want to be able to control all 4 equally with the throttle channel for lift, and also be able to input with the other 3 channels for forward and back, left and right and rotation. Here's the kicker, I also want to have an accelerameter hooked in to help balance the unit with the controls left untouched but then allow me to control it when I want. I have been playing with the accelerameter a little and have a good idea·of how it works. My thoughts on it are that·I would turn the pulse signals into something that I could easily add to, say·like 0-100% or 1 to 255, that way I can use the info from the accelerameter which·I already have code that will give me angle in degrees when the accelrameter is tilted and add it to the appropriate channel on top of whatever my throttle is set at to maintain level. If I'm not on the right track let me know. Sometimes trial and error is the best way to leran. Wasn't it Edison that said he didn't have 100 failures but 100 ways not to make a lightbulb. Sorry off track a little, anyway·if you have any tips that would help me I would greatly appreciate it. Thanks in advance. Mike
  • Joe FishbackJoe Fishback Posts: 99
    edited 2008-04-17 23:36
    neodd70,

    The reason for the ··R_Target = drive - 1875 + steer
    ································ ··L_Target = 1875 - drive + steer”


    is to that a RC servo moves from full CW to full CCW with a signal of 1 to ms. The Stamps measures “PULSIN and PULOUT” in us. Also 1us is not measured as variable value of 1 us ( See Parallax manuals ). Different Stamps have different variable value amounts. 1875 us is mid point from CW and CCW using a BSX Stamp. This part of the program take this value in to account. It also takes the up or down (forward or reverse) on one handle (channel) of the RC transmitter and the right or left of this same handle (different channel) and gives a values to drive the two servos on a robot. The servo on the right side of the robot must rotate opposite that the left servo to move the robot straight.

    This math is not perfectly correct, but runs faster than the exact math and works good enough for RC servos.

    Hope this helps, if not give me a post.·

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ······ Joe Fishback

    -Robots are my friends-
  • neodd70neodd70 Posts: 3
    edited 2008-04-18 02:33
    Joe

    It workstongue.gif Thanks for your help. I have another question for you though. I was doing some tests to see if the response of the servo running through the Stamp is the same as if it is coming straight from the receiver. When I had 2 simple commands just a Pulsin and a Pulsout it was the same response time. As soon as I added another channel just 2 more commands Pulsin and Pulsout the response was horrible. It would take a step and pause then another step and pause until it reached full position. I would have to say that it took 5-10 times as long when I added·the second channel. And the more I add the longer it takes. Is there any way around this, I'm sure there is but I don't know how to do it yet. I was looking at serial servo controllers. would that solve the problem or do I just need to write some code to keep the response time up? Thanks again for your help. I really appreciate it.

    Mike
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-04-18 13:01
    The Servo control signal is a 1 to 2 mSec pulse (depending on desired position) repeated every 20 to 50 mSec.

    So, each time you send a "PULSOUT", you need a 20 mSec delay. Well, that's not completely true. What is true is that for each SET of PULSOUT, you need ONE 20 mSec delay.

    So from the symptom you describe, I'm assuming you have a 20 mSec delay for EACH pulsout you do. The third pulsout then gives you a total delay of 60 mSec, and so the servo's "relax" and move in fits and starts.

    To fix this, update all three servo's with a PULSOUT, and THEN issue a SINGLE 20 mSec delay before updating again. That should fix your problem.
  • Joe FishbackJoe Fishback Posts: 99
    edited 2008-04-19 02:04
    Mike,

    Here are·couple other things to try. First, true you need a·20ms between each PULSOUT to a servo. But if after you send a PULSOUT to a servo you do some thing else with the program before the next PULSOUT to that servo,··you may not need a PAUSE. The reason is that doing something else with the program takes time. This run time gives the pause needed.

    Second, something not often mentioned, is using the Parallax "ServoPAL". Each one can control two different servo. Send one PULSOUT to the ServoPAL and it will keep sending pulses each 20 ms till you tell it to do something else. The ServoPAL greatly smoothes out movements.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ······ Joe Fishback

    -Robots are my friends-
Sign In or Register to comment.