Shop OBEX P1 Docs P2 Docs Learn Events
Reading pulses from RC receiver — Parallax Forums

Reading pulses from RC receiver

MeistroMeistro Posts: 12
edited 2008-11-17 12:43 in BASIC Stamp
Hey folks,
I'm working on something where I would like to view and record the values that my Futaba receiver is sending my servo as I'm moving it with the radio. Realtime data is what I'm looking for. I messed around with Stamplot but I can't seem to figure it out. I'm using a BS2 and I'm trying to do a learning mode type scenerio to record the data that the servo is recieving.

Thanks
meistro

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-11-17 03:00
    Any R/C receiver produces a stream of pulses, about 50 per second, where the width of the pulse (roughly from 0.5ms to 2.5ms in width) specifies the desired position of the servo. If you're using modified (continuous motion) servos, the pulse width specifies the speed and direction of the servo. When a Stamp is used to control a servo, it substitutes for the R/C receiver and produces the same kind of pulse train.

    To receive such a pulse train, the Stamp can measure the width of the pulses coming in by using a PULSIN statement in a loop (to measure successive pulses). Read the section in the Stamp Basic Manual on PULSIN for details.
  • MeistroMeistro Posts: 12
    edited 2008-11-17 03:57
    Thanks Mike for the prompt reply. I read that again but its not clicking with me. I tried to display the pulses. Hey wait a sec, lol. do I need to ground the black from the reciever pin to the stamp? All I did was connect the white wire.
  • sylvie369sylvie369 Posts: 1,622
    edited 2008-11-17 04:00
    Mike Green said...
    Any R/C receiver produces a stream of pulses, about 50 per second, where the width of the pulse (roughly from 0.5ms to 2.5ms in width) specifies the desired position of the servo.

    Will this remain true with the digital R/C transmitters/receivers?

    I assume that it will, as long as they're controlling the kinds of servos we're already using (though maybe not with those "digital servos"?).
  • MeistroMeistro Posts: 12
    edited 2008-11-17 04:20
    I think I got it now. I wanted to see the 3rd channel dial on a radio. It seems as if its limited from 2066us to 976us of travel. The steering channel centers at 1644us, full right turn= 1374us, full left turn= 1948us.

    My next question is, how can I log this data?
  • Mike GreenMike Green Posts: 23,101
    edited 2008-11-17 04:47
    1) You MUST have a common ground. All voltages are relative to something. In logic circuitry, they're relative to the circuit ground.

    2) Most digital servos still use the same control pulses, they just use digital circuitry rather than analog circuitry to run the servo (and/or the receiver).

    3) What do you actually want to log? The problem is that these pulses are coming in quickly (every 20ms or so) and the Stamp has to be ready to measure the next pulse or it will be missed. If you use a BS2p or BS2pe instead of a BS2, you will easily be able to attach some I2C EEPROMs. You can attach up to 4 of these to a pair of I/O pins (for a total of 512K bytes using a 24LC1025 from Microchip or a 24C1024 from Atmel). They can write in about 5ms leaving enough time for the next R/C pulse to be measured. You can use I2C EEPROMs with a BS2, but the I/O has to be done by subroutine and is much slower than with the BS2p series devices.
  • MeistroMeistro Posts: 12
    edited 2008-11-17 05:51
    To make it short, I want to log arobatic RC helicoptor maneuvers. Then I'm going to attempt to program subroutines, such as "take-off-to-hover", "hover" "land" etc... mixing in the use of GPS, Vision, sensors to monitor fuel level and temp. etc.. I'll most likely not be using the BS2 because I'm aware that it has restrictions and will not process this info fast enough. I understand the Propeller will most likely be the better platform.?
  • SRLMSRLM Posts: 5,045
    edited 2008-11-17 06:15
    Sure, the Propeller is better at pretty much anything except simplicity. Have you actually made sure that your helicopter can carry that much weight? Unless you do a bunch of custom circuitry, I think that the BS2 setup will be much too heavy for the helicopter to handle with any grace. Try just tying your BS2 and a battery to the helicopter, and see how it does.

    Another thing: GPS is accurate in the Y direction to only several meters, so you can't really use it as a ground avoidance mechanism. You'll have to figure out how to see the ground (hint: pretty much laser is the only viable option if you want high speeds.)

    Assuming that the helicopter can carry all the electronics, it would be possible to do all the simple actions (hover, take off, land) relatively simply with respect to actions such as "Do flip" or "Fly to New York".

    If you can get it to hover autonomously, post some pictures! I'd love to see some...
  • MeistroMeistro Posts: 12
    edited 2008-11-17 12:15
    [noparse]:D[/noparse] I used to use it at the pond to retreive RC boats that ran out of gas :P I also used it once to hoist a 6pak of cold ones down the street LOL. It can handle some electronics with ease [noparse]:)[/noparse]
  • MeistroMeistro Posts: 12
    edited 2008-11-17 12:43
    However, I'll be testing my electronics in an RC car first because its very very depressing when I crash and takes a good week to get it back into the air, and a few hundred$$ :|
Sign In or Register to comment.