Welcome to Multi-Rotor UK. Please login or sign up.

Thursday,January 16, 2025, 04:29:41

Login with username, password and session length

Shoutbox

Bad Raven:
12 May 2024 08:13:51
 I have some F1 Abusemark boards going spare,,,,,,,,,,,,,    ;)    :azn
DarkButterfly:
11 May 2024 22:12:29
And with oldskool parts  :D
DarkButterfly:
11 May 2024 22:11:57
I must be the only one doing tricopters right now  :laugh:
DarkButterfly:
11 May 2024 22:09:30
 :D
Gaza07:
11 May 2024 21:15:16
Domain has been renewed closure has been cancelled  :D
Gaza07:
02 May 2024 08:07:52
Who are most people ??? I think the person you are referring to has put in a lot of effort to keep things moving  :rolleyes:
hoverfly:
01 May 2024 10:16:12
Most people I have spoken to are pizzed off with the yellow peril  flooding the forum,go figure. :whistling:
Gaza07:
23 Apr 2024 08:09:45
The Domain expires for the forum in 60 days, I'm not going to renew it this time unless I see any activity  :beer2:
Gaza07:
20 Apr 2024 18:02:50
Is there anyone who would like to see this forum stay open ? :shrug:
hoverfly:
17 Apr 2024 17:15:13
 :rolleyes:
Members
Stats
  • Total Posts: 201,503
  • Total Topics: 20,274
  • Online today: 39
  • Online ever: 530
  • (Tuesday,June 26, 2012, 08:34:46 )
Users Online
Users: 0
Guests: 42
Total: 42

Theme Changer





3d - Printworx

Raspberry PI Camera an alternative to GoPro etc?

Started by atomiclama, Monday,May 12, 2014, 10:49:28

Previous topic - Next topic

atomiclama

Hi all just thought I';d post up my try out of the Raspberry PI camera module, just in case someone else is interested.
I';ll edit this post as things progress.


Got mine from here: -
http://cpc.farnell.com/jsp/bespoke/bespoke7.jsp?bespokepage=cpc/en_CC/makerspace/raspberrypi.html&isRedirect=true



currently weighing in at 48g for board/camera/SD card/WIFI

Downloaded the Raspbian image from here: -
http://www.raspberrypi.org/downloads/

Added the following to /etc/rc.local so that it starts recording for a period at startup

# run the pi camera at startup for 10 min capture.
raspivid -o /media/test.h264 -t 600000&



Wasdale X, Ow that hurt

cosmorogers

I';ve put a Raspberry Pi camera on my hexacopter and took a photo every second. Only problem was the extra battery (usb charger) I had to carry. Went from 8 minutes flight time to 5...

If you want to have the pi on there permanently you';ll probably want to come up with some way of powering it from you lipo :)

Having a programmable computer on there opens up a world of possibilities to :)

atomiclama

I';ve a box full of switching regulators, I';ll solder one of those direct to the PI and run it from the LIPO. Not sure how much juice the PI will take, can';t see it being much though. Haven';t weighed the PI camera yet but don';t expect it to be much either.
Wasdale X, Ow that hurt

atomiclama

Well finally managed to get something recorded, processed and youtube';d first time for all of it so not been quick
Here it is: -

http://www.youtu.be/5gvdMg_AtQc


Lots of jello I know, only one motor balanced nicely the others I just can';t get sorted, props are straight out of the packet HQ from Phil. One motor mount is lose from a heavy crash and the camera is mounted with a bit of electrical tape and a bit of bent plastic, but I just wanted to get something going. Oh yeah and I forgot to take of the protective film from the lens. Anyway happy ish with the picture apart from the jumps whilst rotating, think it might be down to the data rate to the card but not sure.

Ah well it';s a start ::)

Will try a lower data rate fps picture size etc. Don';t think it is noise as the same happened when motors are not running.
Wasdale X, Ow that hurt

Oakie

Just found this thread. I have a number of pi';s. Has anyone made the quad project?


Paul
Only when one looses sight of your toy does FPV become fun and against legislation already in place.

gowen

I';ve been doing quite a bit of testing of the Raspberry Pi camera and can stream the video to my laptop with a 150-160ms latency for a 1280x720 stream at 30fps. So far the flight testing has been done LOS with the Pi mounted on a old powered glider.   I';ve got a tricopter ready for the next lot of testing which should be FPV.  I';ve documented my experiments at http://sparkyflight.wordpress.com

atomiclama

Quote from: Oakie on Friday,July 11, 2014, 23:06:20
Just found this thread. I have a number of pi';s. Has anyone made the quad project?


Paul

Nope not interested in the PI as a FC, just video / stills / FPV usage for me.
Wasdale X, Ow that hurt

atomiclama

Quote from: gowen on Saturday,July 12, 2014, 13:47:08
I';ve been doing quite a bit of testing of the Raspberry Pi camera and can stream the video to my laptop with a 150-160ms latency for a 1280x720 stream at 30fps. So far the flight testing has been done LOS with the Pi mounted on a old powered glider.   I';ve got a tricopter ready for the next lot of testing which should be FPV.  I';ve documented my experiments at http://sparkyflight.wordpress.com

Nice one, I';ll look into what you have done when I get back onto trials.
Wasdale X, Ow that hurt

james

#8
I';m planning on using an RPi + Camera Module for both recorded video and streaming back to a laptop for ';FPV'; style video back from the quad. Similar to gowen';s setup, though my latency appears to be much lower than his by eye - without a true high frame rate camera handy I can';t empirically measure it, though.

I';ve got Arch Linux installed on the Pi and the same on my laptop. I';m making use of GStreamer for low-latency streaming at high frame rates. On the quad, I run:

/opt/vc/bin/raspivid -mm matrix -g 30 -n -awb cloud -vs -drc low -vf -t 99999999 -w 640 -h 480 -fps 60 -b 2500000 -o - | gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=1 pt=96 ! gdppay ! udpsink host=10.0.0.11 port=5000

This gets raspivid to spit out an h264 encoded stream of video at 640x480 @ 60 FPS, with an I-frame every 30 frames, at 2.5Mbps nominal bitrate. There';s some tweaks in there for auto whitebalance and matrix metering, too. That goes into a GStreamer pipeline which parses the h264 stream, payloads it in Real Time Protocol packets with SPS/PPSS insertion every second and a custom payload type, this gets stuffed into Gstreamer data packets and sent over the wire via UDP (which gets us loss tolerance).

On the receiver I run:

gst-launch-1.0 -v udpsrc port=5000  ! gdpdepay !  rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! autovideosink sync=false

This just slurps the UDP stream from the remote site and spits it out into a window on screen. The only requirement is that this starts _before_ the quad does, as the GStreamer pipeline needs port capability information (which has the coding parameters in) sending before video. The streaming link is tolerant of loss and will pick itself up without intervention if the signal is lost.

This runs in reasonably-high-frame-rate (p60) which gives really smooth movement and excellent motion rendition compared to p30, but does run at 640x480 which is pretty low-res. The camera can do full 1080p30 but not 1080p60, so if you want full HD you';re limited to p30 which is still okay. Obviously for recording you';d want 1080p25. The Pis are cheap enough it';s tempting to just buy and mount two, though  :smiley:

atomiclama

Nice one James, forgot all about this, got a bit diverted with other things. :rolleyes:

Restart for a winter project me thinks.

Did you have any problems with the Wifi and TX assuming you are using 2.4Ghz for the TX?

Wasdale X, Ow that hurt

Hands0n

Interesting use of the Raspberry Pi.  That camera quality isn';t at all bad, even through the plastic lens cover   :laugh:

To answer one of the questions above about power draw - the B+ board consumes 600mA vs 750mA on the original model B.  http://cpc.farnell.com/jsp/bespoke/bespoke7.jsp?bespokepage=cpc/en_CC/makerspace/RPi_ModelBplus.html&CMP=HP_RPi

--
Danny
"Its better than bad, its good"

Current FCs: Pixhawk, APM 2.6, Naza M V2, Naze32, Flip32+ CC3D, KK2.1.5
Aircraft: miniMax Hex, DJI 550 (clone) TBS Disco, 450 Firefly, 250 Pro, ZMR250, Hubsan X4, Bixler 2

james

Quote from: atomiclama on Monday,October 20, 2014, 12:03:10 Did you have any problems with the Wifi and TX assuming you are using 2.4Ghz for the TX?

Okay so far but I haven';t stuck it on a quad and tried it in the air yet :-) I have a high gain wifi dongle for the Pi with a small SMA rubber duck antenna, and I';m going to see how that fares talking direct to my laptop; I have a Ubiquiti M2HP access point I can use if I need some more gain, though.

@Hands0n, the quality is really impressive. The p60 smoothness is staggering. And yeah, total power including wifi dongle etc somewhere in the 1A region - nowhere near what the motors are pulling, but nontrivial. I';ve not had much of a think about powering but it might end up with its own power - I have a little 1200mAh li-ion 5V regulated cell (£20 I think) which would certainly do the job for as long as it';s in the air and some time on the ground.

atomiclama

I just hooked mine direct into the PSU from the ESC no problems at all. Didn';t notice any reduced flying time.

Ok one question that I have just started thinking about. How are you doing the networking? Adhoc / infrastructure.
both NICs with a static IP. Details please.

And what Wifi dongle are you using? save me hunting one down.
Wasdale X, Ow that hurt

gowen

I';ve got my Pi setup as a WiFi access point using hostapd and dnsmasq.  This removes the need for a WiFi router.  The laptop connects directly to the Pi.

james

I';ve got this WiFi dongle: http://www.amazon.co.uk/TP-Link-TL-WN722NC-150Mbps-Wireless-Adapter/dp/B003158RHE/ref=pd_sim_ce_11?ie=UTF8&refRID=0YHN20E9JMG70QH47SRR - works out of the box on the Pi without any configuration and it';s got an RP-SMA socket. The included antenna is pretty good, too, for an omni.

atomiclama

Oh I';m liking this GStreamer

Currently have one Pi hooked up to the camera and small monitor.

Using Gstreamer to pipe UDP to lo and then GStreamer from lo to the display. Works well
Can';t get it above 640x480 30fps without the decoding breaking up but at this res it just sits there at 30%
and it still looks better than the smal video camera I have when that goes direct into the display  :smiley:

Started using netem
http://www.linuxfoundation.org/collaborate/workgroups/networking/netem
to introduce some packet loss just to see how it might react in the real world.
Can get to 10% packet loss and still have a usable display.

Right need to find a camera and a stop watch see if I can measure the delay.


Seen that GStreamer has mixing capabilities so should be good for OSD of telemetry data. Getting carried away with myself now. :rolleyes:

Just waiting on some usb wifi and a rebuilt multi big enough to get it in the air.
Wasdale X, Ow that hurt

atomiclama

ARRRGH   !!!!!

Information overload, brain can';t handle it
Wasdale X, Ow that hurt

flybywire

Quote from: atomiclama on Friday,November 07, 2014, 09:39:05
ARRRGH   !!!!!

Information overload, brain can';t handle it

Glad I';m not alone there!  (and I work in IT, the operative word being ';work';) :laugh:
Blog: [url="http://ajwillis303.wix.com/stuff"]http://ajwillis303.wix.com/stuff[/url]
The spiritual home of fpv large
Keep it emax, capiche?
Hardware? sure, I got hardware!

gowen

Quote from: atomiclama on Friday,November 07, 2014, 09:39:05
ARRRGH   !!!!!

Information overload, brain can';t handle it

Been there.  I should stay away from the OSD stuff for now.  It is reasonably simple to record telemetry data, just not transmit and display it in realtime.  The RaspiFPV project is the closest I';ve seen to a working solution.

atomiclama

How did I not find that "RaspiFPV" during my searches  :banghead:  :beer2:.

Anyway it gets harder as I get older for my poor old brain to absorb and understand new stuff.
I';ll just keep throwing info at it, some might sink in.

Wasdale X, Ow that hurt

gowen

I';m with you there.  I could do it if I had some spare time, but the children won';t let me have any. So many fun projects, so little time.

james

RaspiFPV is interesting - just built it on my Arch quadPi and it looks like it should work quite well, though being a C app it';s a faff to tweak/customise.

I';ve got some experience in doing Audio over IP, and Video over IP with GStreamer is very similar; I was planning on writing something using a really dumb pipeline managed by systemd/initv to actually send the video over multicast IP, possibly with some MAVlink integration on the client side (currently flying an OpenPilot CC3D which does _work_ in terms of flying, but doesn';t support telemetry really - but replacing this with a Pixhawk next month, with GPS and telemetry). Having a way to get the MAVlink telemetry alongside video, even if it';s just battery voltage, would be very cool. I think that might be best suited to an addition to QGCS, really - it';s got all the telemetry after all...

Finally got around to building a simple mounting arrangement out of balsa wood for my Pi, a camera board appropriately angled forwards and down, and the Fadecandy board to run my Neopixel RGB LED lighting rig. Hopefully getting the Pi talking to the AP when the Pixhawk arrives, so it can change the lighting rig appropriately for armed/disarmed/flight modes etc as well as handling video over IP...

gowen

I don';t know if you have seen it, but the Raspberry Pi Foundation have just release the Model A+ which is about 25% shorter and uses a micro sd card.

http://www.raspberrypi.org/blog/#raspberry-pi-model-a-plus-on-sale

Also, I purchased, but haven';t had a chance to test yet this add on board for the Pi that contains a  High-Precision Pressure Sensor, Low-power 3D Magnetometer and 3-Axis, Digital Accelerometer.

http://uk.farnell.com/jsp/search/productdetail.jsp?id=2365353&Ntt=2365353

atomiclama

@James, keep us posted on how you get on please.

@ gowen, not seen that A+   ~~  two more things on my wish list. Why did you have to point that out, something else to think about :frantic:
Wasdale X, Ow that hurt

atomiclama

Wasdale X, Ow that hurt


cosmorogers

Quote from: gowen on Monday,November 10, 2014, 16:35:42
Also, I purchased, but haven';t had a chance to test yet this add on board for the Pi that contains a  High-Precision Pressure Sensor, Low-power 3D Magnetometer and 3-Axis, Digital Accelerometer.

http://uk.farnell.com/jsp/search/productdetail.jsp?id=2365353&Ntt=2365353

OOh I';ve got one of them to, although it hasn';t made it out of the box yet... (Father got sent two so gave me one...)

gowen

Quote from: cosmorogers on Tuesday,November 11, 2014, 12:04:58
OOh I';ve got one of them to, although it hasn';t made it out of the box yet... (Father got sent two so gave me one...)
I';ve run mine using the supplied sample python code and everything seemed to be working.  Reading the data from the hardware looks simple enough.  Between the three sensors and a GPS, there is enough information to implement a pretty comprehensive OSD, with compass, heading, artificial horizon, altimeter and variometer.  If there is a voltage/current sensor that could be interfaced to the Pi, you';d have the complete set. 

Ahhh! So much to do, so little time.

james

Hah! I had a bit of a loss of control (still learning - my quad was up reasonably high and I just lost my frame of reference, was pretty windy too - ended up cutting the motors as I lost sight, it landed 1 foot away from a very deep lake in some trees mostly unharmed) earlier this week. But the Pi survived - and was taking video all the time till I recovered it! I have it simply cable-tied (with some foam padding) to a plank of balsa wood which is suspended on rubber vibration isolation balls (with bolts through the middle) from my (also balsa) battery holder, itself cable-tied from the quad';s main plate. I really need to sort the FPV streaming out on the new setup - if I';d had it I';d have been able to see what I was doing when it drifted off. Then again I';m upgrading to a Pixhawk with GPS next week so I can geofence it...  :tongue: it';s a learning process! Still flying, so still practising... at lower heights on quiet days  ;)

The camera is attached with foam mounting tape to an angled pair of balsa supports to get it looking forward and down, about 45 degrees. The foam does a bit of isolation - quite keen to try some gel but the foam worked really quite well.

I was impressed by the video quality; it was my maiden flight with the camera recording on the new Pi Arch image I';d set up and the proper mounting solution, I was shooting 17Mbps 720p25 for starters, but I can bump that to 1080p25 without issue (and stream a resized low-res stream alongside the local recording). Aside from evidently needing a gimbal it worked like a charm. That';s the tricky bit, I think, with that inflexible ribbon, and where the A+ might actually be a really good solution; I';m thinking an A+ on a gimbal with the camera module, the trick would then be to get an ethernet cable light/flexible enough to hop across onto the fixed frame, crossover or a small switch to connect to a B+ or Beaglebone to handle ancillary functions like streaming telemetry etc and exposing it all via multicast on wifi... as you say gowen, too many projects, too little time!

james

Going on from my previous post...

Flew a camera with 1080p30 today, which was (as well as doing the white balance/exposure setup) using two ports off the hardware coder to spit out 1080p30 to the SD card and also spit out 320x240p30 to a FIFO on disk. The fifo was then picked up by GStreamer with fdsrc as input to the stream. I used a wifi dongle on the Pi (using netctl in static mode to avoid DHCP delay on reassociation after loss) and a Mikrotik wifi router to create an access point - this was a hack as my Ubiquiti AP with 8dBi omni was feeling a bit poorly... wifi was a bit intermittent, stream delay using that particular pipeline was in the hundreds of milliseconds range so not that useful, but worse the fifo appeared to block if the wifi failed so I lost a chunk of video to the aether when the streaming failed. Evidently need to add a queue in the gstreamer pipeline and maybe look into setting all of this up with PyGST using the lower-level access to the camera so I can control it all in one script! That or I might try multicasting the 1080p stream, hardware decoding+resizing+reencoding at 320x240 for streaming off the IP stream, and recording the multicast stream to disk on the Pi. Overhead shouldn';t be that bad (using multicast on lo, rather than eth0/wlan0). Neatly decouples everything, then the final copy for streaming gets multicast on wlan0 and bob';s your uncle...

Fun flight, anyway - I had to replace my balsa camera frame after the last flight so was trying some new carbon fibre load tubes/gimbal mount for the first time. Worked alright.