Developer

FPV setup with raspberry Pi

3689553118?profile=original

After much chasing, and testing, I have found this to be an efficient way of getting low latency high quality HD video out of an Aircraft. The latency is around 0.4 seconds at worst which would be OK for an FPV with an APM doing the hard work.

I will continue to search for methods to drop the latency down further, but this is a lot better than the 6-12 seconds I was getting on my first attempts.

Any comment (with useful instructions) would be appreciated.

For the wireless link, I am using two UBIQUITY ROCKET M 900 with Australian ACMA approved firmware, at the base station, I am using a tracking (yet to built the tracker...) 1.5 meter long X and Y polarised Yagi, and on the plane, two RF Design flexible strip antennas, placed at right angles to each other.

but how you do that bit is up to you.....

the critical bit is getting the Raspberry Pi's to chat to each other.

I have tried to make this as user friendly as possible... good luck.

 

Setting up IP video for Raspberry Pi 1080p video (FPV)

 

You will need 2 B model Raspberry Pi's and 1 Pi Camera. (Element 14, or RS components)

Preparing your Raspberry Pi for first boot…

 

Follow the instructions at http://www.raspberrypi.org/wp-content/uploads/2012/04/quick-start-guide-v2_1.pdf

Install the prepared SD card in the Pi and boot.

Setting up your Pi

Connect the Pi to your router with a network cable.

On Start-up it will resize the FAT partition and present you with a menu.

Set your language, and keyboard layout.

Select Raspbian… then click install.

After this has extracted (will take a while….) it will reboot into the configuration screen (again will take a while for this first boot.)

The important things to change here are

  1. Enable the camera
  2. In advance options…..
    1. Set the host name (camera, for the camera end, receiver, for the viewing end)
    2. Memory split, set the memory for the GPU to 256
    3. Enable SSH ( will come in handy later, as you may need to talk to the Pi in the air.....

Then finish and reboot.

First login

Username: pi

Password: raspberry

Setting up the required programs for video streaming

 

Install the dependencies by running the following in a terminal:

sudo apt-get install mplayer netcat

cd /opt/vc/src/hello_pi

make –C libs/ilclient

make –C libs/vgfont

cd /opt/vc/src/hello_pi/hello_video

make

cd ~

Now repeat this for the other Pi….

 

Streaming…

First set up the receiver….

Ensure the receiver is connected to your network and run

ifconfig

after you press enter, you can find your ip Address.  Note this down.

Then run the following.

mkfifo buffer

nc -p 5001 -l > buffer | /opt/vc/src/hello_pi/hello_video/hello_video.bin buffer

the Pi will now wait for the feed.

On the Camera Pi

Ensure camera is connected to the Pi

Ensure Pi is connected to the network (you can confirm this with ifconfig)

(see instructions at http://www.raspberrypi.org/camera for how to connect the camera)

 

 

In the following command, replace the ip address with the one you just noted down.

raspivid -t 0 -fps 15 -o - | nc 192.168.1.85 5001

if all goes well you should be streaming 1080P video at 15fps with less than 0.5seconds of delay..

now add your wireless bridge between the two, and away you go J

This information has come from the Raspberry Pi foundation website, and other sources, tested and proven by myself..

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • I'm at the same stage.

    I asked Patrick the same question via a PM.  Am sure he will not object to me posting his response.

    Q1 - Did you destroy the plastic housing or is there a more humane way to get the case off.
    You do not need to destroy the case; pull the plastic cover off the case, this will expose a small sticker, remove sticker and remove screw.  You will also need to remove the nut from each of the SMA plugs on the end.  Then you will need to separate the two halves of the case.  Just hold on to the top by the SMA connectors and the case will slide open.  Takes a little force so dont be afraid to really pull on it...

     
    Q2- is it possible to power the rocket with <24v (as specified on the product data sheet)?
    The rocket will run on anything from about 10.5v to 24v; mine is powered directly from my 4s pack with no issues.

    I have made my own POE cable.  very straightforward and plenty of YT vids about how to do so.  I will be doing my bench tests using the 240v wall plugs (Australia) and will drop down to LiPo power once the proof-of-concept is demonstrated.

    MJ

  • Cheers Philip - and how're you doing that? Have you wired up your own PoE cable? Is that same cable hooked directly up to the Pi's Ethernet port? Any chance of a photo/etc?

  • Developer

    I am powering my M-900 directly off a 3S LiPo

  • Speaking of power... How are people powering the Ubiquity Rocket M-#?

    I've not messed with Power Over Ethernet before. I'm wondering about grabbing an RJ45 crimping tool and making my own short Ethernet cable with the appropriate (?) lines hooked up to the 12V output from the TBS Core BEC I've got - kinda like this, and plugged between the Pi and the M-900. Bit worried that's gonna fry the Pi's Ethernet port though, as I don't know if it's gonna have those lines over which the power's running hooked up to something.

    Anyone had any experience with that?

  • I was thinking I might do some surgery on a normal micro USB cable, cut it down to size and wire it onto the BEC directly; maybe strip off the outer casing.

  • Im starting to look into how to power my Pi setup when its on the vehicle. Im going to power from the flight batter and add a BEC to power a USB hub. Can someone recommend some short, lightweight USB to USB and USB to micro USB cables?

  • Oh yes, and note the use of UDP instead of TCP – TCP will cause transmission delays and latency in the presence of loss, because it offers guaranteed delivery. That means if you lose a packet, TCP will stop and try again until it gets delivered. That's great for transmitting files, etc, but not for transmitting live video, as it'll cause the video to freeze. With FPV, you definitely prefer a short glitch and then a resumption of the feed.

  • I'm using a second Pi as the base station, @John - but I've got this working on my Mac too, using avdec_h264 rather than omx:

    gst-launch-1.0 -v udpsrc port=9000 caps='application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264' ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink

    I used Homebrew to install this gstreamer distribution (brew install gstreamer gst-libav gst-plugins-ugly gst-plugins-base gst-plugins-bad gst-plugins-good)

  • Hi John, doesn't know if it could help but I've tested this config and it's give me the best result with less latency. 

    (to my opinion). Only gst 0.10 working well.

    On my mountain lion, gst 1.0 working well

    With Dronecell, I've tested, it doesn't work obviously (previous thread) - just telemetry ok.

    on my Pi:

    raspivid -t 999999 -w 1080 -h 720 -fps 25 -hf -b 2000000 -o - | gst-launch-0.10 -v fdsrc ! h264parse ! rtph264pay config-interval=1 pt=96 ! gdppay ! tcpserversink host=192.168.1.24 port=5000

    On my mac (home testing):

    gst-launch-1.0 -v tcpclientsrc host=192.168.1.24 port=5000 ! gdpdepay ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false

  • @Pod

    Are you using OSX as youre base station? How do you install omxplayer on OS X?

This reply was deleted.