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

  • All,

    Has anyone tried the full setup (over wifi) on a flying quad/airplane to see how it handles variations in datarate/dropouts etc?

    Please try and then post your results!! :)

    Regards,
    Saad

  • Hi All,

     

    Just thought I would throw some pictures up of my RPI FPV test bed ;-)...  Hadn’t seen a whole lot on that end so thought it might be helpful or at least of interest to some.. 

     

    I ended up going with my NexNeo quad simply because of available chassis space (compared to my Flip FPV which has almost no space, pic attached for comparison).  This particular quad is equipped with Naza M w/GPS as you can see from the photos (plan to mount my spare APM once I get a little time).  Motors are SunnySky 2216-12 800KV with RC Timer 10 x 4.5 carbon props.  With this setup and my Zippy compact 4000mah 4s packs I can get a solid 10-12 minutes of easy flying. 

     

    You will see I fashioned my RPI tray out of the bottom portion of the case that the RPI was shipped with.  Memory card holder with some foam damping material behind the camera works OK to help reduce vibration, but I’ve got some work left to do on this… 

     

    Following a number of power issues/brown-outs with the RPI while testing various USB devices (primarily Wifi adpaters), I decided to go the rout of a powered hub to save the continued headaches…  I have also moved to the Castle Creations programmable UBEC with an adjustable Vout of 4.8 to 9v and 6amp capacity (works perfect and it’s tiny!), my current 5.1v setting on the UBEC seems to work just about perfect to power the D-Link dhub-4 as well as the RPI, you will not see the UBEC mounted as I have a little bit of wiring left to get done this evening.

     

    I also picked up an ASUS USB N53 adapter over the weekend which I plan to do some range testing with here in the next couple of days (never enough time for my hobbies); I’m still a little concerned with range issues associated with the 5ghz band, so very interested to see what I come up with after some testing.  The other end of my test setup consists of another receiver RPI consistent with the OP’s plan direct connected to my Netgear Nighthawk Router at my ground station.  For a consumer router this thing has amazing range, and will serve my purpose of making a decision on the 2.4ghz or 5ghz band..  I’m trying to avoid going to UHF for my radio gear, but may have to in the end.

     

    Need to get back to work, but wanted to share what I had done to date; enjoy and hope this helps keep the fire lit in a few of you!

    3692874184?profile=original3692874210?profile=original3692874129?profile=original3692874237?profile=original3692874015?profile=original

  • Will initially be a F450 quad just for close range / low altitude 'proof of concept' work. 

    If this is successful then progress to a larger machine such as UAP1 (quad or Y6). 

    If this successful then try for some longer range work with a fixed wing.

  • @Michael

    What platform are you flying? 

  • I think you solve this by running:  modprobe ipv6

  • @Patrick and @Philip : I had exactly the same pb with gstreamer-1.0 

    It's why a used gstreamer 0.10 on Pi for publishing or receiveing

    sudo apt-get install gstreamer-tools gstreamer0.10-plugins-base gstreamer0.10-plugins-good gstreamer0.10-plugins-bad gstreamer0.10-plugins-ugly

    gst-inspect

    normally : 233 plugins, 695 features

    and it s work on Pi. 

  • @ Michael

    Re glying with pi and wifi:

    My plan for powering the Pi: 5V 3A BEC Step-Down Voltage Regulator - Under $12.00 and can accept input voltage of 5-23v, perfect for my 4s quad. 

    http://www.pololu.com/catalog/product/2177

     

    For wifi, Im looking at the upiquiti bullet M5 on the quad out of its case to save weight, this will allow me connect pi via ethernet, allow remote access of the bullet, and allows me to power the bullet via homemade POE adapter that will also pull power from my 4s battery via a 12v 3A step down UBEC.  Trying to power as little as possible from the Pi, and keep battery count/weight down.

     

     

     

     

  • @ Philip

    You might give this a try on the receiver Pi:

    gst-launch-1.0 -v tcpclientsrc host=<Pi-IP> port=5000 ! gdpdepay ! rtph264depay ! h264parse ! omxh264dec ! autovideosink sync=false

     

    For some reason I rember this working, but with very choppy playpack; cant remember though and wont be able to confirm this evening..  Let me know if it works for you!

  • For those of you with experience with 'flying a pi and wifi'   ... I'm interested in seeking advice on powering a pi while it is on the UAV. Also what is the expected duration of operation based on your set-up?

    I have fitted one of these add-on boards to my pi as it will permit a variety of input voltages and most importantly has a fuse. I will be following the advice in this thread regards wifi components after I've proved the concept of my work with some short range flight testing.

    I was intending on using a 2S battery in an attempt to keep the heat down but just wondering what other crew are doing with respect to power supply for Rpi and also duration of operation.

    thanks,

    MJ

  • Developer
    Same problem here, I can't get avdec_h264 to work on the pi....
This reply was deleted.