RC Radio
Armored Cars
Posts: 172
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 Williams
Applications Engineer, Parallax
Dallas Office
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.
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.
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 Williams
Applications Engineer, Parallax
Dallas Office
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
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.
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???
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.