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

  • Developer
    Same problem here, I can't get avdec_h264 to work on the pi....
  • Hi bebo rebozo,

    PI CAMERA STREAMING
    I nearly the same setup as your for PICamera Streaming:
    but on my Pi (my local ip of raspberry 192.168.1.24) , only gst-0.10 work (not 1.0)

    On 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
    (you need ta adjust baud rate : here 200000 is for testing : not 3G !
    SD Low: -w 480 -h 260 -fps 25 -b 800000
    SD Medium: -w 640 -h 360 -fps 25 -b 1200000
    SD High: -w 960 -h 540 -fps 25 -b 1800000
    HD Ready: -w 1280 -h 720 -fps 25 -b 2500000
    Full HD: -w 1920 -h 1080 -fps 25 -b 5000000
    source : http://blog.nicolargo.com/2013/05/streaming-depuis-la-raspberry-cam... )

    On my mac (Maverick), with gst-1.0 :
    gst-launch-1.0 -v tcpclientsrc host=192.168.1.24 port=5000 ! gdpdepay ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false

    IMPORTANT: you need to launch on the Pi First Then on your Mac

    And its work very well ! few lantency than Phil config's with "raspivid -t 0 -fps 15 -o - | nc 192.168.1.85 5001"
    Morevor, if connection 3G stop, tou must be able to receive stream again.

    I think Tommy Larsen and Soren Kuala are my Mentor Inspiration !
    I ve well tested my dronecell on arduplane 2.68 and works very good but not video !(from Soren Kuuala) Great thanks to him !
    BUT it s was not enough for me.

    3G SETUP

    Moreover, Pi act as a server, so on raspberry which is on cellular connection (3G)
    1/ Set PPP interface
    apt-get install wvdial

    2/ Add the ppp0 interface
    sudo nano etc/network/interfaces:
    #special configuration for tbs Caipirinha :
    auto ppp0
    iface ppp0 inet wvdial
    provider Caipirinha (Caipirinha is my flying pet")

    2/ Add start PPP conection file for your "flying Pet"
    sudo nano /etc/wvdial.conf

    [Dialer Defaults]
    Phone =
    Username =
    Password =
    New PPPD = yes

    [Dialer Caipirinha]
    Modem = /dev/ttyACM0 (depend on your modem - here a Nokia N95 old phone - sud0 apt-get install hwinfo // hwinfo to find your and check if he is "on" / else sudo modprob n95)
    ;Phone=*99#
    ;Username=blabla
    ;Password=blabla
    Init2=AT+CGDCONT=1,"IP","mms.bouygtel.com" (your APN - mine is mms.bouygtel.com)
    ISDN=0
    Auto Reconnect=on
    Stupid Mode=off
    Idle Seconds=0
    Auto DNS=on

    3/ start ppp0 interface
    ifup ppp0
    Stop ppp0 interface
    ifdown ppp0

    NB: The “auto” keyword in /etc/network/interfaces will do a “ifup” automatically at each boot of raspberry.

    4/ I ve found à script .sh which is registered in Crontab of Raspberry to check every second connection is up (in case of faillure)
    I need to had the PiCamera server streaming to restart in case of failure to.
    Another script to had to Crontab
    (In developpment)
    I will publish when it will be ok.

    To be continued...

    (Sorry everyone for my poor English ! )

  • I wonder if this has any future in this kind of project

    http://www.kickstarter.com/projects/sparkdevices/spark-core-wi-fi-f...

  • Developer

    @Saad I have found the lag on windows as the base to be horrible.  just get another Pi :) 

  • Developer

    @pat.  what wifi system are you using? is it a point to point bridge?

  • Gary, thanks for your reply.

    Can you briefly explain what all you did to install gstreamer on windows? The issue is, i don't have the option to install linux on my laptop at the moment (being my office-laptop)
    Thanks,Saad

  • I've found gstreamer to be quite flakey on my pc under windows.  Looking at a ground station that is linux only - linux runs apm with mono apparently - so will load up 12.04 on a nuc I have that a client didn't like. I'll let you know how it goes.

  • Guys,

    I was using a Mac on the receiving side at home, but now i'm away from home (for the next few weeks) and only have a windows machine with me. gstreamer doesn't seem to work on my windows machine that well. Doesn't recognize many command-line arguments. If anyone got gstreamer pilelines working on windows, would you please help me with that?
    Basically if i cant get it to work on my windows machine, i can't do any more experimentation for the next 5 weeks :(

    Regards,

    Saad

  • Also make sure port 5001 is not blocked otherwise it will not go thru.

  • Run on computer: nc -lu 5001 | mplayer -fps 31 -cache 1024 -
    Run on pi: raspivid -t 999999 -o - | nc -u [insert the IP address of the client] 5001

     

    http://www.raspberrypi.org/camera

     

    On windows 7 I used mplayer

    http://www.mplayerhq.hu/design7/dload.html

This reply was deleted.