Page 1 of 1

RC Radio Reciver to RPi

Posted: Mon Jul 08, 2013 8:06 am
by Brookesa05
Hello, i have made a raspberry pi quad-copter that i now need to find a way of controlling it. I would like to link it up to a rc receiver and link it to my python code to control the motors etc. Has anyone done this before or know if it is possible and how i should go about doing this. http://www.hobbyking.com/hobbyking/stor ... tAodQhcAGw

This is what I've done so far - sorry for bad video but i had some trouble with the storage space on my camera.
http://www.youtube.com/watch?v=N9JsVfR0IYA


Thanks,
Brookesa05

Re: RC Radio Reciver to RPi

Posted: Mon Jul 08, 2013 8:36 am
by PiGraham
Brookesa05 wrote:Hello, i have made a raspberry pi quad-copter that i now need to find a way of controlling it. I would like to link it up to a rc receiver and link it to my python code to control the motors etc. Has anyone done this before or know if it is possible and how i should go about doing this. http://www.hobbyking.com/hobbyking/stor ... tAodQhcAGw


Thanks,
Brookesa05
The reciever outputs pulses of controlled width, so you need to measure the time from rising edge to falling edge of those pulses.
j
You may be able to do that using state change callbacks and high precision time values.
User Joan on this forum has posted about measuring pulse width and can probably tell you if it's practical to measure 8 channels of PWM. (or however many channels you need the Pi to read).
best performance use 'C' code.
For

Re: RC Radio Reciver to RPi

Posted: Mon Jul 08, 2013 8:41 am
by Brookesa05
Okay thankyou for your input, i'll try and message joan

Re: RC Radio Reciver to RPi

Posted: Mon Jul 08, 2013 11:42 am
by joan
I'm afraid I know nothing about the radio transmitter/receivers used in quadcopters.

I assume the intention is to link the receiver into the Pi? Do you know what the receiver output looks like? e.g. if the receiver does output pulses of a varying width similar to servo pulses (1ms - 2ms in length) then they could be measured at the Pi.

Re: RC Radio Reciver to RPi

Posted: Mon Jul 08, 2013 11:52 am
by PiGraham
I was making some assumptions there Joan.
In particular that the referenced RC receiver with PWM outputs is typical rc servo PWM.
Reading pulse widths would be one way to remote control the Pi as it controls the servos (perhaps an "autopilot" that can take the controls). The simplest case would be read n channels from the receiver and output those same value to PWM.

If, as you seem to be saying, the Pi can read multiple pulse PWM widths 1-2ms, and also output multiple channels of similar PWM, then you have answered that point.

Re: RC Radio Reciver to RPi

Posted: Wed Jul 10, 2013 1:28 pm
by guzunty
We have just created an experimental core for the Guzunty programmable IO board which does what you want, I think.

You can learn more about Guzunty here:
https://github.com/Guzunty/Pi/wiki

The new core is not yet linked into the main site, but you can find the resources here:
https://github.com/Guzunty/Pi/tree/master/src/gz_ppm

The programmed hardware reads a ppm stream from a radio receiver and provides an interrupt to the RPi to alert the software that a channel has been decoded. The current value for the channel is then read as a 16 bit word from the SPI interface. The pulse widths are measured in hardware, so there is no latency or other source of inaccuracy. The bit accuracy is as good as the highest resolution from the Turnegy radio linked to above,

It also echoes the ppm stream out as decoded separate PWM signals for each channel, in case you wish to pass any channels out without processing them in the Pi. For outputting processed PWM streams, you can use the Servo Blaster software. Your adafruit servo controller will also work fine for this purpose of course.

I stress that this core is experimental at this time. Please do not buy a Guzunty board expecting this to work out of the box just yet. If you want to be an early adopter and help validate the core, you would be most welcome. If enough people are interested in this core, we can justify buying some radio gear to test against so that we can provide support, so please either add a note to your order indicating you want to use the ppm core or else visit:
https://github.com/Guzunty/Pi/issues/14
and leave a comment indicating your interest (no purchase necessary this way of course :-) ).

As can be seen from the scope images in the issue thread, the core simulates fine, but we are awaiting feedback from a community member as to whether it works with real world receivers.

HTH,

Derek

Re: RC Radio Reciver to RPi

Posted: Thu Aug 13, 2015 7:44 am
by Psychi
I have a similar idea as you, though your further along having already integrated the pi to a frame and initializing startup. I just bought a Blade F 350 QX2 and intend attach the pi to it replacing the flight controller(which you have done) I can't provide a solution for direct controller interaction but I've been working on a separate method using a web based interface for python script activation/control for sending a pwm signal to a single esc/motor through pin 17 on a b+. If you intend to be running indoor flight the web method seems to be incredibly fast(as fast as ssh activating python if your running on a wifi lan you've setup. I haven't progressed to the point of trying to send pwm output to multiple esc's. I have read about using an H-bridge but I am under the impression that you can not send separate controls to each controlled esc. I am curious what pins you used in the esc/motor activation and do you have the ability to vary to speed? Made much progress?

~ Leo

Re: RC Radio Reciver to RPi

Posted: Sat Jan 30, 2016 9:08 pm
by Fidgit
Hi, I've been working on a similar project. It's been in my head for years, but i've only recently started working on it in Ernest.
My original plan was to use interrupts to handle timing the input pulses from the R/C receiver. the problem is that the Raspian kernel doesn't do a very good job of passing hardware interrupts to "user application land".

I recently found this post which offers an interesting alternative. (assuming that you are using a DSM transmitter)
viewtopic.php?f=91&t=90028

allegedly, the Pi can read the serial link directly from a DSM antenna. I have yet to really dig into this, but it looks promising.

Cheers!