Shop OBEX P1 Docs P2 Docs Learn Events
RC Radio — Parallax Forums

RC Radio

Armored CarsArmored Cars Posts: 172
edited 2004-10-12 04:51 in BASIC Stamp
I am making an autonomous car and wanted to be able to switch it to RC easily.· Is there a way·I can skip the RC radio entirely and program the BS2 to pick up signals and interpret them for the ESC and servo?

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-09-16 17:59
    No, the BASIC Stamp is a microcontroller, not a radio receiver. You need the RC radio·reciever to decode the RF signals from your transmitter. You can use PULSIN to decode the receiver outputs.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • J. A. StreichJ. A. Streich Posts: 158
    edited 2004-09-16 22:54
    If your RC controller has toggle switches and a joy stick (a la airplane controlers), you can pulse in one of the switches and the radio control for direction. This way, you could check for the switch, and determine each iteration if your doing a programmed set of instructions or if your doing something from the remote. This does mean that you can't interupt the "program" except at the top of each loop....

    psuedo code (C++ style) for what I'm talking about would be

    for(;[noparse];)[/noparse]
    {
    while(switch)
    {
    do(getJoystick());
    }
    f(); //some programed actions
    }

    The PBasic code would be a lot longer, as you'd have to read the "switch" pin (which would probably be a pulsin), decide if the remote is "on" or if the bot should execute coded actions, pulsin the joystick and pulsout the results. I'm currently looking at doing something similar to what is above, I just need the proper connector for the rc remote (female, female three pin (servo style) conectors). Unfortunatly I haven't had time to go to the hobby shop or Radio Shack. keep me updated.
  • Ken GraceyKen Gracey Posts: 7,386
    edited 2004-09-16 23:28
    GameMaster,

    This is exactly what we do with our R/C airplane autopilots. We use the landing gear switch which outputs a 1-2 ms pulse depending on how it is switched. If it is on, then the Stamp reads the 2-axis accelerometer and flies the plane. If it is off, the signals are passed through the Stamp directly to the servos.

    Circuit is the following:

    R/C receiver => BS2-IC => All servos

    but is also this:

    Accelerometer => BS2-IC => All servos

    The primary portion of code that switches between the two types of control is:

    PULSIN Pin, gearInput
    IF gearInput < 1200 THEN autonomous
    IF gearInput > 1200 THEN manual

    The manual section is simply a series of PULSIN and PULSOUT commands. As I recall, it was quite straightforward to read each of the many R/C airplane channels consecutively, either because the pulses were staggerred or missing every other one had minimal consequences.

    It's really just a problem of getting the right connectors. The code is quite minimal.

    By the way, you can see a bit more of our R/C airplane projects including this one at: http://www.parallax.com/html_pages/resources/videolibrary/resources_product_videos.asp - scroll down in the page to the red airplane.

    Ken Gracey
    Parallax, Inc.
  • J. A. StreichJ. A. Streich Posts: 158
    edited 2004-10-09 23:07
    I'm having trouble with this...

    I it seems the pulsin is always giving me zero on the data line... I'm reading using pulsin 10, 1000, joy1

    and joy 1 is always equal to zero. The Black line (-) is tied to Vdd as I was avidesed to in an earlier thread, The red line (+) is not tied to anything and is unused. So, I commected the data line to an led, and the signal appears to never go high (no matter what I do with the stick.

    Any idaes as to why the data line has no plse on it?
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-10-09 23:21
    Your second parameter is wrong -- it should be 1 (for high pulse), not 1000. The BASIC Stamp is probably interpreting your command as 0 since bit zero of that value is not set.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • BeanBean Posts: 8,129
    edited 2004-10-10 13:01
    Doesn't the RED wire need to be connected to power (+) ?

    Terry
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-10-10 14:41
    Terry,

    No -- the receiver has its own power supply; he just needs the pulse pin and a ground reference.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • allanlane5allanlane5 Posts: 3,815
    edited 2004-10-11 13:59
    Terry:

    The 'red' wire is supposed to power a Servo from the RC reciever. Since there is no actual
    servo involved, the BS2 does not need a connection to this wire. It does need the signal
    wire, of course, and the black wire to provide a ground reference for the signal wire.
  • J. A. StreichJ. A. Streich Posts: 158
    edited 2004-10-11 14:07
    I'll try that today, I though the second argument was how long to look... I've never needed to pulsin data before.

    The question then becomes why didn't hooking it to an LED work? I exptected to see it "strob" the pulses from the remote. Maybe I also have a problem with my connection???
  • allanlane5allanlane5 Posts: 3,815
    edited 2004-10-11 18:14
    Since the signal is on-high for 1 mSec to 2 mSec, repeated every 20 to 50 mSec, you aren't going to be able to see an LED flash that short.

    From experiments, you really need a flash of 50 mSec at LEAST to activate the receptors in your eye. I use 100 mSec if I want to see a brief flash. 2 mSec is way below your threshold of sight. A Logic Probe would stretch the pulse so you could see it on the Logic Probe's LED.

    The LED probably is flashing, in reality. If you had a light sensor (probably not a CdS, I think they are too slow, too) looking at the LED, and looked at the output of the cell with an oscilloscope, you'd probably see the signal.
  • J. A. StreichJ. A. Streich Posts: 158
    edited 2004-10-12 04:51
    AHHhhh! Blimy... So, I fixed the code problem and played arround a bit, and it seems my connection isn't very tight but my debug code works. So, I think I need to look for wires with the proper connection at the ends instead of the make-shif juper wire I've kluged together.
Sign In or Register to comment.