Raspberry Pi Camera Adventures

Raspberry Pi Camera @ http://Mikronauts.com

(Click on image for larger version)

I know. The Raspberry Pi Camera has been around for a long time. I just have not had a chance to start using mine until now :-(

I decided to write this article to chronicle my experiences with the Pi camera, and list the resources I found to be the most useful for using the Pi Camera.

Basic Specifications

Getting Started

The Raspberry Pi Foundation has a couple of pages of very helpful information for installing & using the Pi Camera, so there was no reason for me to regurgitate it here.

Using the latest Raspbian, and following the posted information, I am happy to say that the camera just worked.

The camera module setup page even has a video to show you how to connect your camera!

DesignSpark also has a great step-by-step installation and configuration tutorial, with a lot of screen shots:

The advantage of the DesignSpark tutorial is that you can use it on an existing Raspbian installation, as it walks you through updating it, whereas the README pretty much assumes a recent Raspbian install.

Raspberry Pi Camera @ http://Mikronauts.com

(Click on image for larger version)

Taking Still Photos

Once you have updated your Raspbian and have your camera installed, it is extremely easy to take still photographs.

raspistill -o photo.jpg

Yep, it is that easy. There are many options for raspistill for controlling how the still shot is taken, the http://elinux.org/Rpi_Camera_Module wiki shows you all the options.

Capturing Video

Recording video is just as easy as taking still photos!

 raspivid -w 1280 -h 720 -fps 60 -t 10000 -o test720p60.h264

As you might suspect,  the http://elinux.org/Rpi_Camera_Module wiki shows you all the raspivid  options as well.

Streaming Video

Unfortunately streaming video is a different ball of wax.

There are MANY ways of streaming video – mjpeg, h.264, and flash among others. Choosing which method is the most appropriate for you is not particularly easy, as it depends on a number of factors:

  1. available light
  2. desired image resolution
  3. desired frames rate
  4. available network bandwidth
  5. desired client (web browser? custom app?

I tried using mjpeg to stream 1/4 resolution images… and I did not like how the system behaved. The Pi had a load average of 2.54, and kept freezing – I think it simply could not encode it fast enough, which makes me suspect that hardware encoding was not being used.

Some googling pointed me to V4L drivers for the Pi Camera, and I am about to try those – not to mention that the picamera Python library is very tempting.

Pi Camera Streaming Threads & Links

Pi V4L / Webcam Streaming Threads

I will be exploring the V4L interface to the RPi, as I think it has great potential – and some compatibility with other V4L devices.

Pi Camera Adventures

(Click on image for larger version)

picamera Python Interface

David Huges has released a BSD licenced nicely documented interface to the Pi Camera at

picamera supports Python 2.7 and Python 3.2, has great documentation, quick start tutorial, and even test suites!

David provides Python code for

  • “Basic Recepies” cover everything from capturing images, capturing video, capturing time lapse, streaming video to the network and much more.
  • “Advanced Recepies” cover YUV/RGB/raw capture, rapid capture&processing, custom output and much more.

LinuxUser magazine had an article on using a Raspberry Pi camera and picamera for motion detection:

I will be using picamera in my experiments – good thing I have Python 2.7 & 3.2 interfaces for RoboPi !

I have to emphasize what an extensive & nice piece of work picamera appears to be. I’ll update this article with more about picamera as I gain experience with it.

Motion Detection

Motion detection with “Motion”:

One of the main reasons we would want motion detection would be for a home-brew security camera setup.

Zoneminder  is a popular Linux security camera software package. Here are the links I collected for my future experiments:

Object Recognition

OpenCV is an open source package for image processing and recognition. Here are some interesting links that I found for it:

Using the Raspberry Pi Camera with Robots

I’ll be adding a Raspberry Pi Camera to Elf as soon as time allows me to fabricate a camera mount for it.

Based on my early experiments with a Pi camera (not on a robot) I don’t believe that 1080p streaming will be viable – the only hope is h.264 streaming at 25fps or less. 720p streaming at say 24fps may be viable, but it took far too much cpu when streaming it as mjpeg’s. 640×480 and lower should work, with the capability of occasional 5Mp snapshots.

I started a forum for the Raspberry Pi Camera Adventures – and I’d love to hear from you!

I welcome suggestions for links to add to any of the sections above – or even suggestions for new sections.

If you liked this article, please help us grow! "Like" us and let your friends know with the Twitter and Facebook buttons at the top left - We appreciate your support!