DIY Rasberry PI HD FPV & wifi telemetry Pix hawk

Hello,

My DIY HD FPV project just doing some testing now using wifi 

what trying to accomplish stream real time HD video from a small drone, as well as connect to GCS on the same wifi network. I attempted this last year gave up on the Raspberry PI move to a much faster board, after the release of PI 2 I decided to try one more time;  for an fordable price and lots of man hours in work ;). 

Parts used: 

1. raspberry PI 2 https://www.adafruit.com/products/2358

1. pi camera https://www.adafruit.com/products/1567

1. camera mount https://www.adafruit.com/products/1434 or https://www.adafruit.com/product/1012

1. project box https://www.adafruit.com/products/1998

1. wifi adapter https://www.adafruit.com/products/1030

1. 4 gb SD card 

1. double sided Velcro tape 

1. USB to RC BEC adapter/iphone charger http://mymobilemms.com/OFFTHEGRIDWATER.CA/FPV-Products-Parts/2-6S-L...

1. copter Pixhawk ESC MOTORS from http://offthegridwater.ca

suggest smaller Wifi adapter you must supply 5V 2A to the adapter. both adapters have the same chip set but smaller one works better.

wifi install 

https://learn.adafruit.com/adafruits-raspberry-pi-lesson-3-network-...

camera install

http://www.element14.com/community/servlet/JiveServlet/downloadBody...

Set up Raspberry PI to connect to Pix Hawk, do not auto start services from /etc/init.d/ skip that part .

http://dev.ardupilot.com/wiki/companion-computers/raspberry-pi-via-...

there are some more cavorts to this seal to comport communication need to be set up .

prepare com port of Pix Hawk:

sudo apt-get update 
sudo apt-get upgrade

sudo apt-get install python-dev

sudo usermod -a -G tty pi
sudo usermod -a -G dialout pi

sleep infinity >/dev/ttyAMA0 &

sudo apt-get install ser2net

sudo nano /etc/ser2net.conf

add to the bottom of file so you can connect to Pixhawk/APM over wifi on TCP port 2000

2000:raw:600:/dev/ttyAMA0:57600 8DATABITS NONE 1STOPBIT banner

sudo /etc/init.d/ser2net restart

sudo apt-get install apache2 -y

Check to see if the camera is working " you can add video embedded code to html page here can be viewed here " http://PI.IP.ADDRESS.

raspistill -v  Test the camera is up and running all streaming apps are installed, using raspistill module and VLC to display video on port 8554. Also 8081 8080 should work, recording can be done from the client end VLC. Http server is also running on PI you can access video there if IP changes edit ip on page.

Run Video command: (disable motion from starting at boot id you ar not using this module for FPV)

sudo apt-get install vlc

sudo apt-get install motion

sudo apt-get install libv4l-0

sudo apt-get install uvccapture

dmesg | tail, you should see you camera attached in the output message, if it is connected to your HW

edit /etc/default/motion and set "start_motion_daemon" to no( you do not want to auto start )

edit /etc/motion/motion.conf edit the settings 

set "daemon off"

Start video stream run the following commands: choose with script works for you run it at start up.

raspivid -o - -t 0 -n -w 720 -h 480 -fps 25 | cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/}' :demux=h264

rtsp://${RASPBEERRY_PI_IP:8554/  works in VLC or Quick time

“Motion –n”  “motion”

watch the video stream

raspivid -w 1080 -h 720 -fps 20 -b 10000000 -t 0 -o | gst-launch-1.0 -v fdsrc ! h264parse ! rtph264payconfig-interval=10 pt=96 ! udpsink host=192.168.0.77 port=9000

360 -fps 25 | cvlc -vvv stream:///dev/video0 --sout '#rtp{sdp=rtsp://:8554}' :demux=h264

raspivid -o - -t 0 -n -w 1080 -h 720 -fps 25 | cvlc -vvv stream:///stdin/video0 --sout '#rtp{sdp=rtsp://:8554/}' :demux=h264

raspivid -n -o – -t 9999999 -rot 180 -w 720 -h 480 -b 1000000 -fps 25|tee /home/pi/video-`date +%Y%h%d-%H%M`|nc -l 443

This command to a script by using the following

sudo nano sudo nano raspistill.sh

sudo chmod +x myscript.sh

start the stream automatically:

If you want to start the stream automatically you have to add the script to crontab. To make this work you need to make another script run by cron . try to edit  /etc/rc.local file remove your script there or create an /etc/init.d/ scrip with proper run level to enable at boot run sudo update-rc.d SERVICE-TO-START-AT-BOOT enable . You may need to remove any services you installed from start at boot  (VLC can't be run as sudo so make sure you're in the right cron so not use sudo crontab -e ). You may need to add "nice" at the binning of the command so camera do not crash at start up. for mavproxy use (sudo crontab -e ) because runs as root.

sudo nano raspistill.sh:

#!/bin/bash

/path/to/ raspistill.sh

Then:

sudo chmod +x raspistill.sh

crontab -e

add to crontab file this will run the script file at boot  

@reboot /home/pi/raspivid.sh

Or python script

@reboot python /home/pi/MyScript.py &

 watch the video stream

To watch the video stream, open VLC on a computer on the same network as the raspberry pi you are using for streaming. Press Media -> Open Network stream and paste the following in the field:

rtsp://[IP].[TO].[THE].[PI]:8554/

http://offthegridwater.ca

2 working images available for sale ground control and copter PM me if your interested. 

http://www.mymobilemms.com/index/

Views: 7222


Moderator
Comment by Vladimir "Lazy" Khudyakov on June 8, 2015 at 9:18am

Superb!

Comment by benbojangles on June 8, 2015 at 9:31am

This should save people some days of researching for the various linux packages to make streaming work. Are you using Mission Planner with Qtgstreamerhud?

Comment by v01d on June 8, 2015 at 10:02am

I'm on a similar path and I would like to ask you about how you dealt with RC 2.4GHz interference on the wifi.

Comment by Mark Jacobsen on June 8, 2015 at 12:24pm

Can I ask what kind of range you're getting on the wifi?


Moderator
Comment by Vladimir "Lazy" Khudyakov on June 8, 2015 at 12:31pm

Can I ask 

Connect Ubiquiti PicoStation to ethernet port and fly to 10 km easily...

Comment by Tobias Witting on June 8, 2015 at 1:07pm

sorry, maybe I don't get it, but what is new here? There are already excellent howto's about HDfpv on this site. E.g: http://diydrones.com/profiles/blogs/part-2-how-to-build-a-high-defi...

which one of the 4 video commands are you actually using?

Comment by Andrew Zaborowski on June 8, 2015 at 3:25pm

What's the approx. delay in the actual video seen on the monitor / glasses in your experience?

Comment by OG on June 9, 2015 at 2:19am

delay in the video is from 1 second to 5 seconds depend on how much load the PI is under this set up is about 1 second delay. you can connect a LTE modem to the ethernet port for long range no fidleing with the PI config or USB port more involved. with the dongle onley about 100 feet on the ground .

Comment by Glenn Gregory on June 10, 2015 at 9:46am
@Vladimir have you used the PicoStation on a UAV? What setup were you using and range?

Moderator
Comment by Vladimir "Lazy" Khudyakov on June 10, 2015 at 10:03am

@Glenn

Yes, I do.

Leopard Imaging board with DaVinci processor, Aptina sensor board camera, Picostation - on top.

Notebook with Ubuntu, Bullet, directional antenna with tracker on ground.

>10 km range

Comment

You need to be a member of DIY Drones to add comments!

Join DIY Drones

© 2017   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service