Shop OBEX P1 Docs P2 Docs Learn Events
rc reciever and servo help — Parallax Forums

rc reciever and servo help

nvale55@gmail.comnvale55@gmail.com Posts: 15
edited 2011-11-17 19:49 in Propeller 1
Hi,

I just recieved my propeller platform about a week ago and so far have figured out how to control a servo, my next step is to figure out how to control the servo with an rc reciever and propeller chip (as in connect the reciever to the chip and as i move the joysticks on the remote, i want the servo to move as well). so far i've been unsuccesful in doing so. My question is, can any one point me in the right direction as to figuring out how to accomplish this task?

Nik

Comments

  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2011-11-15 08:16
    Nik,

    a lot is going to depend on what the signal looks like from the receiver... The signal is usually compressed before it is transmitted but not always. i.e a signal on the receiver that varies in pulse width from 300us to 600us might translate to a servo signal ranging from 1ms to 2ms. Unless you have a scope or can find documentation on your particular transmitter/receiver pair, then the next step might be difficult to determine.
  • PublisonPublison Posts: 12,366
    edited 2011-11-15 08:22
    Nik,

    You could try a couple of items in the OBEX

    http://obex.parallax.com/objects/331/

    http://obex.parallax.com/objects/482/

    A
    search for R/C and Radio Control came up with these.
  • ratronicratronic Posts: 1,451
    edited 2011-11-15 08:23
    nvale55 there is a rx receiver object in the signal generation and processing section of the OBEX.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-11-15 08:36
    Beau,

    I think I understand Nik's question differently than you do.

    I think Nik plans on placing the RC receiver with the PP board. This way he just needs to read the signals that would normally go to the servos with the Prop and either send the same signal to the Prop (or a "Y" harness) or a modified signal (using the Prop as a signal mixer).

    Right Nik?

    If you just want to read the pulses being sent to the servos from the receiver, you can use the "PulseIn" method of the BS2_Functions object (it should be in the OBEX).

    If not there are a couple fo ways to tap into the signal on the transmitter side. As Beau points out this part can be a trick. And it does depend on the brand and other details of the RC equipment.

    You can often tap into the compessed signal from the trainer code port. I've done this with Spektrum transmitters and I'm pretty sure someone has an object in the OBEX for do this with some other brands.

    With the help of Google translate and a German RC website, I was able to decode the signal Spektrum DSM2 transmitters use with their little green transmitter boards. I can now fly may helicopters with a Wii Nunchuck (which actually makes flying them more difficult).

    @Nik, tell us a little more about what you want to do and what equipment you're using.

    Edit: I looks like Publison and ratronic bet me to it while I was typing.
  • nvale55@gmail.comnvale55@gmail.com Posts: 15
    edited 2011-11-16 16:58
    Yea duane you are right. What im trying to do is read the pulses sent from the transiever to the reciever using my prop than send the signal to the servo(s). I am using a parkzone 5-AP transmitter and a parkzone 6-channel reciever RE672.

    Nik
  • JasonDorieJasonDorie Posts: 1,930
    edited 2011-11-16 18:57
    Nik - Check out this post:

    http://forums.parallax.com/showthread.php?107239-Propeller-with-propellers

    Inside the "WolfSpyder.zip" file is an object called RC_receiver_6.spin - It read a pulse train and present it as a set of numeric values suitable for moving servos. You can look at the main WolfSpyder.spin file to see how it's used.

    Jason
  • ratronicratronic Posts: 1,451
    edited 2011-11-16 19:57
    That's the one I use Nik is Jason's RC_Receiver_6.spin, thanks Jason!
  • nvale55@gmail.comnvale55@gmail.com Posts: 15
    edited 2011-11-16 20:36
    Thanks Jason, I have one question though. I'm completley new to this language thus this may be obvious and I'm just missing something, how do i get the input from the reciever to the servo through the prop. that program gets me the data and the servo program controls the servo, but im not sure how to connect the two.

    Nik
  • ratronicratronic Posts: 1,451
    edited 2011-11-16 21:17
    Nik after you start the object it will monitor Propeller i/o pins 0-5 for channels 1-6 from your receiver. To get the current value of say the throttle channel(3) you would start the object then call rx.getrc(2) to get channel 3 current value.
    Con                                    
                                           
      _CLKMODE = XTAL1 + PLL16X            
      _XINFREQ = 5_000_000    
                 
                                           
    Var                                    
      long a  
    
                                 
                                           
    Obj                                    
                                           
      rx : "rc_receiver_6"  
                   
                                           
    Pub main | i                           
                                           
      rx.setpins ( % 111111)
      rx.start   
    
                              
                                           
      a := rx.getrc(channel)
    
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-11-16 21:51
    nvale55: I have done this for 4 channels using a Spektrum DX6i. It is based on others code. Here is a link where I published the code. http://forums.parallax.com/showthread.php?133372-Ken-Cluso99-W9GFO-s-QuadCopter-Build-Log-(updated-info-ELEV-8-availability)/page7 post #250
  • JasonDorieJasonDorie Posts: 1,930
    edited 2011-11-17 19:49
    To add a little to Ratronic's post, you'd usually use the receiver and the servo objects together in a repeat loop, like this:
    Con
      IN_THRO = 0     'constant for which input pin is connected to the receiver throttle
      OUT_THRO = 16   'constant for the output pin connected to the throttle servo
    
    Obj                                    
      rx : "rc_receiver_6"
      servo : "Servo32v3"
    
    Pub main | val
    
      rx.setpins ( % 111111)
      rx.start
      servo.Start
    
      repeat   'constantly grab the receiver value and set the servo value to match
        val := rx.getrc( IN_THRO )
        servo.set( OUT_THRO , val )
    
Sign In or Register to comment.