View Full Version : rc reciever and servo help
11-15-2011, 02:18 PM
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?
Beau Schwabe (Parallax)
11-15-2011, 03:16 PM
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.
11-15-2011, 03:22 PM
You could try a couple of items in the OBEX
A (http://obex.parallax.com/) search for R/C and Radio Control came up with these.
11-15-2011, 03:23 PM
nvale55 there is a rx receiver object in the signal generation and processing section of the OBEX.
11-15-2011, 03:36 PM
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).
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.
11-16-2011, 11:58 PM
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.
11-17-2011, 01:57 AM
Nik - Check out this post:
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.
11-17-2011, 02:57 AM
That's the one I use Nik is Jason's RC_Receiver_6.spin, thanks Jason!
11-17-2011, 03:36 AM
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.
11-17-2011, 04:17 AM
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.
_CLKMODE = XTAL1 + PLL16X
_XINFREQ = 5_000_000
rx : "rc_receiver_6"
Pub main | i
rx.setpins ( % 111111)
a := rx.getrc(channel)
11-17-2011, 04:51 AM
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
11-18-2011, 02:49 AM
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:
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
rx : "rc_receiver_6"
servo : "Servo32v3"
Pub main | val
rx.setpins ( % 111111)
repeat 'constantly grab the receiver value and set the servo value to match
val := rx.getrc( IN_THRO )
servo.set( OUT_THRO , val )