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

  • The choice between M5 and M900 will not change the latency. The experiments I have done with the  PI show <100ms latency using the Raspberry PI -> Windows PC configuration, either with a direct Ethernet link, or using wireless. My results from PI - to -PI were not so good as the receiving PI has trouble keeping up when decoding the video stream, even when directly connected via a cat5 cable. The bit rate can be as low as 1Mbs and still get pretty good results using a Windows PC (or higher power linux box), so latency vs. bandwidth should not be an issue, with either the M5 or M900.    For the M5 setup I am using, I have two small RHCP mushroom-stlye antennas that are very compact, and give good performance, and on the receiving end, a 16 dbi, spiral RHCP on an antenna tracker.  I think it 'could' (under optimum conditions), go to 10km by upgrading to a parabolic on the receiver. I would need to beef up the antenna tracker to mount a dish, so if I were designing a longer range system, I would opt for the smaller antennas, and use a high-gain configuration with a tracker, rather than going to 900mhz, but I like to keep things small.

  • Andrew, If you don't need FPV, you can just record the flight using a go-pro or other camera. Otherwise, what is the purpose of the video link? 

  • Developer
    Theoretically, yes, but it will depend on your antenna systems, etc and the environment.
  • I picked the M5 because it keeps the antenna size small. I am using an antenna tracker with my setup but I don't have a 'maximum' range tested yet, but I expect it will go 5Km+. What kind of range are you looking to get? 

  • Update - using the Rocket M5 / Nano M5 with the Raspberry PI camera and gstreamer-1.0 on Windows and on the PI. 

    On the PI, gstreamer command is :

    raspivid -t 0 -w 1280 -h 720 -fps 30 -b 2000000 -hf -vf -o - | gst-launch-1.0 -v fdsrc ! h264parse config-interval=1 ! rtph264pay ! udpsink host='your PC's host name' port=9000

    On Windows:

    gst-launch-1.0 udpsrc port=9000 ! application/x-rtp,encoding-name=H264, payload=96 ! rtph264depay ! avdec_h264 ! video_convert ! autovideosink

    Using the Ubiquiti Rocket M2/Nano M5 as the transmitter / receiver combination, I experienced zero latency that was noticeable.  Even works good using a tablet PC like the Dell Venue 8 with an Atom processor. Bit rate is around 2 to 3 mbs.  

    Next - will try in UAV and post a video.

  • I got this to work with the help of gst-rpicamsrc.  Using this package seemed to clear up a lot of the delays and jitter I was experiencing using  raspivid directly.

    1. build gst-rpicamsrc from https://github.com/thaytan/gst-rpicamsrc

    on Pi use: 
    sudo gst-launch-1.0 -e -vvv rpicamsrc bitrate=1000000 ! h264parse ! rtph264pay pt=96 config-interval=5 ! udpsink host=192.168.0.1 port=9000

    on windows use:
    gst-launch-1.0 udpsrc port=5000 ! application/x-rtp, payload=96 ! rtpjitterbuffer ! rtph264depay ! avdec_h264 ! fpsdisplaysink sync=false text-overlay=false

    The 'host' parameter on the Pi is the IP address of the windows (or other PC) that is the target of the stream. 

    I am waiting on trying this with a 5.8ghz wirless link MIMO/TDMA setup using Ubiquiti hardware in the UAV and a home-made antenna tracker I built before. Will post the results later.

    thaytan/gst-rpicamsrc
    GStreamer element for the Raspberry Pi camera module - thaytan/gst-rpicamsrc
  • as I look at this setup the data transport is agnostic, or now with new protocols the ability to join two data sources, I have a few parts from some of our other mobile project and will see if I can configure the fall back data to be a HSPA+ mobile network. We have latency at less than .5 sec now in mobile video teleconf systems... 

    seeing the above shows a very low number, and exciting... 

    is it a requirement to have a ras pi on the other side (basestation?) could the computer just decode the signal being set to a ip addy and port? (VLC, XBMC) has anyone tried to use different cameras?  I remember the Logitech listed had a a constant bit rate no matter the resolution .. has this changed in the software update? 

    seems like a do loop needs to be written do cover the change in signal strength that would change the bit rate, then keeping the fps up...

    Trying to make a fall back position to revert to a google earth interface when it falls below a legible video picture...

    this thread has helped allot!

  • somehow I missed this thread.. looks like I need to try the Odroid out, 

    so if MP was recompiled to allow for a hud screen to be on a second monitor now both video and telem are coming over the same freq correct?

  • Interesting

  • Hello,

     I can´t see any gui with the video in the receiver. I need to write something more than: nc -p 5001 -l > buffer | /opt/vc/src/hello_pi/hello_video/hello_video.bin buffer

    Thanks

This reply was deleted.