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

  • So the display on the PI freezes or the PC? It could be that your version of GStreamer is different than mine on the PI.  My version on Windows is just the latest one on the Gstreamer website. I did a complete rebuild of the latest version of Gstreamer source on the PI, which could explain the difference, but from my testing, I also ran the version that I downloaded from the web and it worked. I'll double-check this later, just to make sure.

  • Sorry, I mean the commands on the Pi. The first works fine, the second (where raspivid is piped in), doesn't - only the first frame is shown.

  • Ok, I thought it might have been a change between versions and you were using an older version.

  • Try it without the underscore. Let me know if it works. I'll double check the command line and post back later.

  • what version of gstreamer are you using? video_convert didn't exist, but videoconvert did.

    Cheers,
    Si.

  • You mean this one:  gst-launch-1.0 udpsrc port=9000 ! application/x-rtp,encoding-name=H264, payload=96 ! rtph264depay ! avdec_h264 ! video_convert ! autovideosink

    The difference between the two is the 'video_convert ! autovideosink'  and 'fspdisplaysink'.   On my PC the second version was considerably faster.  I didn't see any lockups or freezes on my system. I have tried a Dell Venue 8 tablet pc and my desktop running windows 7 and both seem to work fine. You might try the 'gst-inspect' command on your display sinks and see what you have on your system.  If there are errors loading any of the pipes, you may see that using the 'inspect' command.

  • Patrick - I'm struggling to get your second set of settings to work. The first settings work fine. However the second set of settings just freezes on the pc. Did you get any similar issues?

  • From the Ubiquity Website: "The Rocket M5 from Ubiquiti Networks is a 5GHz Hi Power 2x2 MIMO AirMax TDMA Basestation."   TDMA stands for "Time Domain, Multiple Access" which means clients connected to the access point 'share time-slots', but in your case, you will only have one client - the UAV. MIMO stands for 'Multiple-input-multiple-output).  Most folks doing FPV use SISO (single input, single output), or a single wireless connection and two antennas - one on the UAV and one for the ground station. The M5 uses a two-antenna MIMO I believe the M900 is the same. It's similar technology to LTE in the cellular world. The advantage of using two antennas on each client is that you get two channels (operating at the same frequency), and one antenna a is called the 'diversity' antenna. With some fancy DSPs (built into the M5 and M900), you can double the throughput and increase the SNR. In a normal setup, you would have two parabolic antennas, each with two antennas oriented horizontally and vertically. The 'diversity' between the two antennas allows the DSP to distinguish between two independent channels talking on the same frequency. You need to have BOTH antennas configured for the Ubiquity products to work properly. I am using the Nano-M5 for the ground station, and it has a dual patch antenna built in. For the UAV, (Rocket M5), you need to supply the antennas. Using a circularly polarized dual-antenna system, you won't get the same performance as a parabolic with two normally polarized dipoles. There is  a 3db loss, minus the antenna gain difference, but for a UAV this is not too bad, as it's not practical to mount a parabolic on the model. You won't get the full range that Ubiquity advertises (40km), but you may get 10km, depending on how good your UAV's antenna efficiency is. I am using the 'mushroom' style because they are omni-directional, and they have a circular-polarization, which is very good at rejecting interference at the 5ghz range. Many satellite system use this same type of antenna for the same reason.    The most difficult part of setting this up is getting the video stream working.   Connecting the Rocket M5 to the Nano M5 is easy. Just a few mouse clicks, and it's done. I hope this helps.

  • I agree with you on antennas. My model is FPV Raptor V2. What do you mean, when saying two antennas? (sorry I'm not a tech guru with ubiquiti :) )

  • It depends on the antennas you are using and the conditions. The longer wavelengths will have less interactions with obstacles, but require larger antennas, which generally are more expensive - and harder to mount effectively on a UAV. The question is not which one will give you more range, but which one will suit your needs at the lowest cost and smallest antenna configuration. How big is your model?  Also consider that for a MIMO setup, you will need two antennas. 

This reply was deleted.