Introduction and Features and Specifications
The Raspberry Pi Camera Board has finally landed after many months of anticipation. The module aims to inspire thousands of custom photo and video based projects from makers around the world.
Personally I have been waiting on my module ever since it was first announced. Fortunately being a member of the Element14 blogging team has its advantages and I was able to secure an early release model before ordering a production unit the day they were released.
In the name of full transparency this hands-on review is based on the production model I purchased and not the one sent out to the blogging team.
The Raspberry Pi Camera Module.
The camera module utilizes the dedicated CSi interface, which is located behind the Ethernet port on the Raspberry PI.
Features and Specifications
The Raspberry Pi Camera Module is a 5MP CMOS camera with a fixed focus lens that is capable of capturing still images as well as high definition video. Stills are captured at a resolution of 2592 x 1944, while video is supported at 1080p at 30 FPS, 720p at 60 FPS and 640x480 at 60 or 90 FPS.
The camera module measures in at just 25mm x 20mm x 9mm and weighs a mere 3 grams. This makes it ideal for projects such as hidden security cameras, high altitude balloon experiments, and even an onboard camera for RC car adventures. The camera is supported in the latest version of Raspbian, Raspberry Pi's preferred operating system.
- 1.4 Âµm X 1.4 Âµm pixel with OmniBSI technology for high performance (high sensitivity, low crosstalk, low noise)
- Optical size of 1/4"
- Automatic image control functions:
- Automatic exposure control (AEC)
- Automatic white balance (AWB)
- Automatic band filter (ABF)
- Automatic 50/60 Hz luminace detection
- Automatic black level calibration (ABLC)
- Programmable controls for frame rate , AEC/AGC 16-zone size/position/weight control, mirror and flip, cropping, windowing, and panning
- Digital video port (DVP) parallel output interface
- 32 bytes of embedded one-time programmable (OTP) memory
Getting things up and running
To get the Raspberry Pi Camera Module up and running, we first need to do a few things beginning with making sure the operating system on your Pi is updated to the latest version. To do this simply make sure your Pi is connected to the internet, and then enter the console and run the command listed below.
sudo apt-get update
This should take a few minutes to complete. When it is finished, we need to run the update by entering the command listed below.
sudo apt-get upgrade -y
You will need to enter your root user's password here and the upgrade may take some time to complete. Just sit back and relax while things complete. Once it is finished, we can move on to preparing the Pi for the camera module. This will require running a few more command strings in the console.
The first command we need to run will install the git-core package. Enter the command below to start this action.
sudo apt-get install git-core -y
Now we need to download the "rpi-update" script, which is accomplished by entering the following command.
sudo wget https://raw.github.com/Hexxeh/rpi-update/master/rpi-update -O /usr/bin/rpi-update
When that is finished we will need to change the permissions in the "rpi-update" script so that we can run it. To do this, we need to run a simple chmod command.
sudo chmod +x /usr/bin/rpi-update
Finally we need to execute the "rpi update" script. Enter the command below to start the update process. This will take several minutes to complete, so do not unplug or power down your Pi, as the result would be having to start all over again.
Were almost finished! Now we need to update the boot configuration file by adding the following lines to the bottom of file using the command: sudo nano /boot/config.txt
You will also need to make sure that the GPU memory allocation was set to 128 MB by looking for a line like this below.
If it is not present, add it to the bottom of the file as well. Save the changes and keep the file name exactly as it was.
Now enter the command listed below, select option 5 and enable the camera. Click finish and chose yes when the reboot prompt pops up.
Working with the camera
Now that the Raspberry Pi is finished rebooting, you can login and we can begin taking some video and snapshots using basic commands. Later in this article I will show you how to string together some of these commands to create a time-lapse photography setup that is quite energy efficient and should provide 12 hours of use.
Below is a list of the terminal commands that control the basic functionality of the Camera Module.
raspivid Camera App v1.1
Display camera output to display, and optionally saves an H264 capture at requested bitrate.
Usage: raspivid [options]
Image parameter commands
- -?, --help : This help information
- -w, --width : Set image width size. Default 1920
- -h, --height : Set image height size. Default 1080
- -b, --bitrate : Set bitrate. Use bits per second (e.g. 10MBits/s would be -b 10000000)
- -o, --output : Output filename filename (to write to stdout, use '-o -')
- -v, --verbose : Output verbose information during run
- -t, --timeout : Time (in ms) to capture for. If not specified, set to 5s. Zero to disable
- -d, --demo : Run a demo mode (cycle through range of camera options, no capture)
- -fps, --framerate : Specify the frames per second to record
- -e, --penc : Display preview image *after* encoding (shows compression artifacts)
- -g, --intra : Specify the intra refresh period (key frame rate/GoP size)
- -p, --preview : Preview window settings <'x,y,w,h'>
- -f, --fullscreen : Fullscreen preview mode
- -op, --opacity : Preview window opacity (0-255)
- -n, --nopreview : Do not display a preview window
- -sh, --sharpness : Set image sharpness (-100 to 100)
- -co, --contrast : Set image contrast (-100 to 100)
- -br, --brightness : Set image brightness (0 to 100)
- -sa, --saturation : Set image saturation (-100 to 100)
- -ISO, --ISO : Set capture ISO
- -vs, --vstab : Turn on video stablisation
- -ev, --ev : Set EV compensation
- -ex, --exposure : Set exposure mode (see Notes)
- -awb, --awb : Set AWB mode (see Notes)
- -ifx, --imxfx : Set image effect (see Notes)
- -cfx, --colfx : Set colour effect (U:V)
- -mm, --metering : Set metering mode (see Notes)
- -rot, --rotation : Set image rotation (0-359)
- -hf, --hflip : Set horizontal flip
- -vf, --vflip : Set vertical flip
Preview parameter commands
Image parameter commands
Exposure mode options: off,auto,night,nightpreview,backlight,spotlight,sports,snow,beach,verylong,fixedfps,antishake,fireworks
AWB mode options: off,auto,sun,cloud,shade,tungsten,fluorescent,incandescent,flash,horizon
Image Effect mode options: none,negative,solarise,sketch,denoise,emboss,oilpaint,hatch,gpen,pastel,watercolour,film,blur,saturation,colourswap,washedout,posterise,colourpoint,colourbalance,cartoon
Metering Mode options: average,spot,backlit,matrix
Shooting video and taking photos
Unfortunately at the time of this writing, a GUI app has not been written, so to take actual photos and videos with the Raspberry Pi Camera Module, we must once again enter the terminal to get things working. We are going to start by making sure everything is working correctly. With your camera module connected, type the following command into the terminal.
That should load a demo which you will be able to watch in the terminal window. If nothing happens and you get an error, enter raspi-config as instructed earlier and make sure the camera is enabled. Also check all of the connections. If it does work congratulations and we can move on.
Let's write a short script that will allow us to shoot a 1080p video at 30 frames per second. I have written him following string to help you get started. It should be pretty self explanatory, but I will break it down for you anyway.
raspivid -w 1920 -h 1080 -fps 30 -t 30000 -o video.h264
raspivid - this is what initialized the camera and sets it to video mode.
-w 1920 - h 1080 - this sets the video recording resolution.
-fps 30 - this sets the frames per second to 30.
-t 30000 - this sets the length of the recording time.
-o video.h264 - this is the file output name. For demo purposes we chose to save it to our home directory of /home/pi to save to a different location, you will need to specify the location yourself.
Now if all went well, and you installed everything correctly, you should now be able to run the above command and the end result will be a 30 second full HD video. Below is a longer video I shot of my 3D printer making a TweakTown keychain. I used the same code above and just modified the time code above to last for eight minutes.
That's it, it really is that easy. There are many more attributes and settings you can change or enable by using the commands found on the previous page. Now let's capture a still image using the code below.
raspistill -o picture,jpg
Again this is pretty self-explanatory, but let's break it down component by component.
raspistill - this initializes the camera into still image mode.
-o picture.jpg - this stores the file in the home directory with a title of picture.jpg.
Using the code above, I took a quick snapshot of my favorite development boards. As with the raspivid command, raspistill has a plethora of modifiers, and options to further enhance your imaging experience.
Taking some time lapsed images (in this case the images are 1 second apart)
raspicam -tl 1000 -o file%d.jpg
Note the filename - the %d will be replaced with an integer (creating file1.jpg, file2.jpg etc). This software will continue taking images until you press 'CTRL-C' to terminate the program.
Using the image effects when taking photographs or capturing video. This command will take a picture in 'negative'.
raspicam -ifx negative -o negative_image.jpg
Just to recap - for a full list of image effects when taking photographs type:
For a full list of image effects when recording video type:
Final Thoughts and Giveaway
The Raspberry Pi is no doubt the hottest development board / micro PC on the market today. I personally own five RasPi boards myself. The camera module may have taken a lot longer to arrive than I expected, but I feel that it was worth the wait. The Raspberry Pi Foundation hit the nail on the head with the pricing, and at $25 anyone with a Raspberry Pi can now learn how imaging systems work on the coding level.
This little camera module will revolutionize hobby robotics, as well as maker projects, all over the world. It is simple enough to use for everyone at every coding skill level and I am sure that full featured GUI based apps will begin popping up in the Pi store any day now. There are already custom 3D printable cases to house the Pi and camera on Thingiverse, and one maker has already sent his camera module to the edge of space via a high altitude balloon.
There are a few issues I have with the camera module, though. The cable is painfully too short and whoever decided that a ribbon cable was a good idea, needs to be forced to watch bad reality TV for the rest of their life. I would have much preferred a stranded cable or something a little more flexible. Making the cable 6-inches to 8-inches longer would have been an excellent idea as well. I would have also preferred that the mounting holes be a little larger or at least a single mounting tap placed off to the side of one corner. I do understand that fixing many of these issues would have raised the cost, but let's face it, most of us would pay an extra $5 - $10 for these features.
I am working on several more projects based around the Raspberry Pi, as well as the camera module. If you have a project idea that you would like to see us do, please send me an email (address can be found on my author page). Stay tuned to TweakTown for much more Raspberry Pi goodness!
GIVEAWAY! - I am going to give away one of the cool TweakTown Blue Raspberry Pi cases as pictured above. All you have to do is take your Raspberry Pi and if you have a camera module, take a photo or video and mention TweakTown in it.
Post the video on YouTube / or email me the picture, and then link to it in the comments. I will pick a winner at random and send out the case promptly. The contest will run for 30 days from this posting and I will announce the winner on our Facebook page.