How do I give a radio control car autonomous control


Closed Thread
Results 1 to 40 of 191

Hybrid View

  1. #1
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default The radio receiver PWM signals??

    I am new to Parallax. It comes highly recommended.

    I wish to build a 1/10 scale hobby level radio control car that can also run autonomously. I think they have a PIC that can do the job. The question is how do deal with the Pulse Width Modulated signals that come from the radio receiver. Presently they go directly into the electronic speed control module and the steering servo. I thought that for my design I could use them as inputs to the PIC.

    I hope that I do not have to use PIC code space and compute power to continuously sample the three RC receive channels. Is there some kind of transition detector which can digitize the PWM signals? I assume the PIC input can figure when they change.

    If Parallax does not make an appropriate micro to be the central brains of this operation I can use a DPDT switch under PIC control to steer the PWM signals. There has to be a signal from the radio transmitter telling the car which mode is appropriate. That signal has to be interpreted by the micro somehow.

    Ken

  2. #2
    Join Date
    Feb 2009
    Posts
    36


    Did you find this post helpful? Yes | No

    Default

    The Basic Stamp has a function called PULSIN that will give you the width of a pulse on one of the input pins. You can sample multiple pins (input pulses). You can put these 3 PULSIN functions in a loop to keep sampling the PWM inputs. This can be a call in a larger loop that does other things. It shouldn't take much of the CPU power.

    The way I do it is to route the RX PWMs into the Basic Stamp then let the code decide if it merely duplicates the pulse in software to the appropriate servo (manual mode) thru an output pic, or let the code take over control (auto mode). No relays or switches to route PWMs, the processor does it all in software.

    A note of caution....the Tx/Rx that comes with most (inexpensive) RC cars is not a typical system that you would get if you had a regular RC Tx/Rx system (3 wire standard servo cabling). I ripped all of the truck controls out and replaced with a standard Tx/Rx system (Specktrum DX-7). Not to say you can't make it work, but you better have an oscilloscope and a lot of patience.

    The other advantage of a real system is you have more channels to use for more features. One channel can be to tell the car if you want manual or auto for instance.

    As I mentioned, I migrated to the PIC from the Basic Stamp to get more power and capability...but still think the Stamp is a good place to start.

    John

  3. #3
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default Comment from the Parallax forum

    John,

    I got the following from a Mike Green on the Parallax forum. I think he is agreeing with your decision to migrate up from the Basic Stamp.

    With my 1/10 hobby car came a three channel RC unit. One for the DC drive motor, one for the steering servo, and a spare. I thought I could use the spare for the auto/RC toggle. This car is just an experiment to get a working prototype. Once that is done I might be able to find some money for a "real" prototype. There is quite a bit to consider in selecting the race car/truck itself. What do I want to teach about suspensions? I'm not sure.
    ----------Mike wrote----------
    "There is no mechanism for the Stamp to automatically sample the RC channels. Typically you'd use a sequence of 3 PULSIN statements, one for each channel. The RC receiver normally receives one channel at a time and the PWM signals occur in sequence and repeat about 50 times a second. There's not much time left to do control functions once you account for timing 3 RC receive channels and 3 servo PWM output channels. It's possible to offload the PWM output functions, but I don't know any ready-to-go PWM input processor.

    "I would strongly suggest you look at the Propeller. It can easily do the RC receiver timing and the servo PWM generation with two cogs (processors) and have plenty of processing power to do whatever control functions you need. The Propeller Servo Controller is a compact board that comes pre-programmed with a 16 channel servo controller, but the outputs can also be used as inputs by modifying the control program."

    My next step is to examine the Propeller.

    Thanks again..
    Ken

  4. #4
    Join Date
    Feb 2009
    Posts
    36


    Did you find this post helpful? Yes | No

    Default

    Mike is correct on the sampling times, however I have made things work well for this application at a much lower rate....basically whenever it gets to it. This can lead to some choppy response on the throttle and steering servo, but nothing bad unless you really load down the processor doing other things.

    The Propeller is a better chip, but look carefully at the overall cost of all the cogs and infrastructure compared to a PIC system....might still be cost effective, never used one.

  5. #5
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default Maybe we're back to DPDT switched

    mackrackit suggested that I use a third RC channel to toggle disconnecting the PIC when under RC control. It does sound like the simplest and maybe the least expensive way to go. Trouble is I do not know how to do this.

    Is it as simple as inserting a double pole double throw switch that is controlled by the third channel into the signal line between the RC receiver and the electronic speed control? And another between the receiver and the steering servo?

    Will surges and the like kill the electronics? It would be safest if there were a way to guarantee the motor being off and the servo being neutral when toggling. John, mackrackit, what do you think?

    Ken

  6. #6
    Join Date
    Feb 2009
    Posts
    36


    Did you find this post helpful? Yes | No

    Default

    Personally I would go with what I described....software control. But someone might come up with an elegant solution. I really don't think you have to keep up with the 25ms servo rate. I have done several applications at lower rates and it works fine. So most processor will work just fine in this mode.
    Last edited by John_Mac; - 16th November 2009 at 23:28.

  7. #7
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    John made some good points as to why a hardware solution may not be to your liking.

    On the flip side side, a software solution can also have some draw backs. I am coming from an industrial point of view so maybe something non-critical as a RC car could be looked at differently...

    To go from manual to auto with software at least one ASM interrupt is needed, depending on the application you may want more from different sources. In your case on should be enough. If the operator can not see the car then switch to auto. Using software the code can be cumbersome. Say you are running in manual. Are you still keeping track of the sensors? That can get to be a neat trick, code space and all. If you do a hardware switch, the auto part can keep monitoring the inputs just as it would if it was in control. This way, when auto does take over it is near seamless.

    Good and bad both ways.

    If you do go with the hardware solution and the RC part of the car (manual) is still intact then you are halfway there. Find were the inputs to the MOSFET bank are or the motor controller and that is where the DPDT relay will go. Being the control signal is the only thing that is switching the only surge you will have to worry about is from the relay coil. A flyback diode will take care of that.

    But either way you go, keep us posted. I have some young ones I am also teaching.

    BTW.... I only use windows when I have to...
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. Car radio (Car radio and electronics support forum)
    By freewillover in forum Forum Requests
    Replies: 1
    Last Post: - 1st July 2009, 20:41
  2. Remote Car Starter Safety
    By CocaColaKid in forum General
    Replies: 8
    Last Post: - 22nd November 2005, 10:10

Members who have read this thread : 1

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts