Rpi Camera Module

From eLinux.org
Revision as of 12:21, 5 June 2013 by Jbeale (Talk | contribs) (Technical Parameters)

Jump to: navigation, search

RaspPi.png Back to the Hub

Hardware & Peripherals:

Hardware - detailed information about the Raspberry Pi boards.

Hardware History - guide to the Raspberry Pi models.

Low-level Peripherals - using the GPIO and other connectors.

Expansion Boards - GPIO plug-in boards providing additional functionality.

Screens - attaching a screen to the Raspberry Pi.

Cases - lots of nice cases to protect the Raspberry Pi.

Other Peripherals - all sorts of peripherals used with the Raspberry Pi.


The Raspberry Pi Camera board was released for sale on 14th May 2013.[1] The initial production of 10k units[2] sold out quickly. The camera contains a 5 MPixel sensor and connects via a ribbon cable to the CSI connector on the board. Subjective video and still image quality is good; it is better than a USB webcam of similar price.

Technical Parameters

  • Sensor size: 3.67 x 2.74 mm
  • Pixel Count: 2592 x 1944
  • Pixel Size: 1.4 x 1.4 um
  • Lens: possibly f=3.6 mm, f/2.0 or f=4 mm, f/3.2 *
  • Angle of View: possibly (54 x 41) or (49 x 37) *
  • Field of View: possibly 2.0 x 1.33 m at 2 m, or 34.75 inches wide at 38 inches *
  • Full-frame SLR lens equivalent: about 35 mm, possbily longer
  • Near Focus: 1.8 m (3 um CoC, blur=2 pixels); 1 m (6 um CoC, blur=4 pixels)

Because the focal length of the lens is roughly the same as the width of the sensor, it is easy to remember the field of view: at x meters away, you can see about x meters horizontally, assuming 4x3 stills mode. Horizontal field of view in 1080p video mode is 75% of that (75% H x 55% V sensor crop for 1:1 pixels at 1920x1080).

References: *Two focal lengths from two user reports: [1],[2] field & angle calculators[3] sensor info[4] f-stop measurement[5]

Sample Programs

Sample programs using the camera for taking stills and video have been developed for the Foundation and the source for these is available on github.

Forum user M1M1 published instructions on compiling the sample programs here

The command line parameters for the programs are as follows:

RaspiVid Camera App   
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) before  takes picture  and  shuts down.   If  not specified,  set to  5s   
‐d,  ‐‐ demo      :  Run  a  demo mode (cycl e  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)   
Preview parameter commands   
‐p,  ‐‐ preview   :  Preview window settings <'x,y,w,h'>  
‐f,  ‐‐ fullscreen:  Fullscreen preview mode  
‐n,  ‐‐ nopreview :  Do not  display  a  preview window  
Image  parameter commands   
‐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 com pensation  
‐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  
Exposure  mode options  :   
AWB mode options :   
Image  Effect mode options :   
none,negative,solarise,sketch,denoise,emboss,oilpaint,h atch,gpen,pastel,watercolour,film,blur,saturation,colourswap,washedout,posterise,colourpoint,colourbalance,cartoon  
Metering Mode options  :   
RaspiStill Camera App  
Runs camera for specific time, and take JPG capture at end if requested 
usage:  RaspiStill  [options]  
Image  parameter commands  
‐?,  ‐‐ help      :  This  help  information  
‐w,  ‐‐ width     :  Set image  width <size>  
‐h,  ‐‐ height    :  Set image  height  <size>  
‐q,  ‐‐ quality   :  Set jpeg  quality  <0 to  100> 
‐r,  ‐‐ raw       :  Add  raw  bayer data  to  jpeg  metadata 
‐o,  ‐‐ output    :  Output  filename  <filename>  (to write to  stdout,  use '‐o  ‐ ').  If  not specified,  no file is  saved 
‐v,  ‐‐ verbose   :  Output   verbose information  during  run  
‐t,  ‐‐ timeout   :  Time (in ms) before  takes picture  and  shuts down (if  not specified,  set to  5s) 
‐th, ‐‐ thumb     :  Set thumbnail parameters  (x:y:quality)  
‐d,  ‐‐ demo      :  Run  a  demo mode (cycle  through range of  camera options, no capture)  
‐e,  ‐‐ encoding  :  Encoding  to  use for output  file (jpg,  bmp, gif, png)  
‐x,  ‐‐ exif      :  EXIF  tag to   apply to  captures  (forma t as  'key=value')  
‐tl,  ‐‐ timelapse:   Timelapse mode. Takes a  picture  every <t>ms  
Preview parameter commands  
‐p,  ‐‐ preview   :  Preview window settings <'x,y,w,h'> 
‐f,  ‐‐ fullscreen:  Fullscreen preview mode 
‐n,  ‐‐ nopreview :  Do not  display  a  preview window 
Image  parameter commands  
‐sh, ‐‐ sharpness :  Set image  sharpness ( ‐100  to  100)  
‐co, ‐‐ contrast  :  Set imag e  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 com pensation 
‐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 
Exposure  mode options  :  
AWB mode options :  
Image  Effect mode options :  
none,negative,solarise,sketch,denoise,emboss,oilpaint,h atch,gpen,pastel,watercolour,film,blur,saturation,colourswap,washedout,posterise,colourpoint,colourbalance,cartoon 
Metering Mode options  :  

The raspivid utility saves .h264 format files. Some programs need this in a .mp4 wrapper to use, which you can do in several ways. One is to use "MP4Box" which is in the 'gpac' package.

sudo apt-get update
sudo apt-get install gpac

MP4Box -add filename.h264 filename.mp4

Known Issues

  • Still captures did not use the full sensor, until the firmware update on 24 May 2013.
  • Images were 'flipped' (mirror image) by default, until the firmware update on 24 May 2013. (-hf and -vf options provide horizontal and vertical flips)
  • The -? (--help) did not work, until update on 24 May 2013.
  • The -n (--nopreview) command-line options currently don't work, but should be fixed in a future release of the camera apps. Try -p '0,0,0,0' as a workaround while -n doesn't work.
  • Correct EXIF data (including user supplied tags) are not being written to the output files.

This forum post summarizes the issues as at 24th May 2013


Camera not working at all

Make sure the flex cable is inserted the correct way on both ends, and each connector has the locking tab engaged. The RPi + camera draws about 260 mA more current when recording video, than without the camera. The Model B is about 550 mA by itself, so camera use pushes it over 800 mA. Some power supplies, cables, and polyfuses may not maintain 5V onboard at this current load well enough for reliable operation. You can check this with a voltmeter across TP1 and TP2.[3][4]

In some cases, the micro-connector from the camera module to the camera board PCB has been loose, causing mis-operation. This has been fixed by removing and re-seating the small (tiny!) yellow flex cable connector labelled "P5V04A SUNNY" on the camera board.[5]

Colored Banding or Flickering on video

This can be caused by a poor power supply, or bad power cable. Several people have fixed this by replacing the power supply, or the microUSB power cable.[6][7]


Changing the ribbon cable

The ribbon cable that connects the camera board to the Pi is 15-core 1mm pitch ribbon cable. In the UK they can be sourced from http://www.toby.co.uk/content/catalogue/products.aspx?series=FFCx-xx-A-xx-xx where the required type is FFC1-15-B150105160MM[8]. Other suppliers have been noted on eBay.

The Foundation has noted that the camera only passed EMI emissions testing with ribbon cable lengths of 15cm, although longer cables may also work.[9]

Adjusting Lens Focus

The camera is fixed-focus (at infinity) as delivered. The thread-locking glue dots can be scraped off[10] allowing manual lens focus, as close as 6 cm, or complete removal of the lens[11] allowing other optical systems. The lens thread size may be 6 mm x 0.5 (not certain).

Macro, Wide, Tele lenses

The near focus point of the camera is about 1 meter as delivered. Without modification to the camera itself, it is possible to put a simple external lens in front such as reading glasses, SLR diopter ("close-up filter") or loupe to enable closer focus. For best results, put the additional lens very close to the camera lens.

Macro, Wide-Angle, and Telephoto adapter lenses designed for the iPhone 4/4s and similar devices will also work on the R-Pi camera. Depending on your configuration, properly mounting the accessory lens in front of the camera module may require some ingenuity. Focus becomes critical with a telephoto adapter, so success there may also require the manual focus modification.

Removing IR Filter

The IR filter is rigid and glued to the bottom inside of the black plastic lens housing, requiring complete disassembly to remove. Two early attempts by RPi forum users M33P[12] and scorp[13] were initially successful, but in both cases the camera died soon afterwards from blunt trauma to the fragile bond wires on the die.[14]

A RPi blog post (27 May 2013) has more description of this process with a video of the modification, and video from the resulting IR-enabled camera.[15]


To help building your own enclosure, a hand-measured mechanical drawing[16] of the camera module is available, thanks to Gert van Loo. There is another drawing[17] from raspberrypi-spy.


  1. http://www.raspberrypi.org/archives/3890
  2. http://www.raspberrypi.org/phpBB3/viewtopic.php?f=43&t=32605&start=350#p358580
  3. http://elinux.org/R-Pi_Troubleshooting#Troubleshooting_power_problems
  4. http://www.raspberrypi.org/phpBB3/viewtopic.php?f=43&t=43998#p350528
  5. http://www.raspberrypi.org/phpBB3/viewtopic.php?f=43&t=39996&start=100#p355172
  6. http://www.raspberrypi.org/phpBB3/viewtopic.php?f=43&t=44863
  7. http://www.raspberrypi.org/phpBB3/viewtopic.php?f=43&t=43982
  8. http://www.raspberrypi.org/phpBB3/viewtopic.php?f=43&t=43737#p352401
  9. http://www.raspberrypi.org/phpBB3/viewtopic.php?f=43&t=43737#p348917
  10. http://www.raspberrypi.org/phpBB3/viewtopic.php?f=43&t=32605&start=225#p346170
  11. http://www.raspberrypi.org/phpBB3/viewtopic.php?f=43&t=32605&start=325#p352613
  12. http://www.raspberrypi.org/phpBB3/viewtopic.php?f=43&t=44339#p352586
  13. http://www.raspberrypi.org/phpBB3/viewtopic.php?f=43&t=44339#p352902
  14. http://www.raspberrypi.org/phpBB3/viewtopic.php?f=43&t=44339
  15. http://www.raspberrypi.org/archives/4088
  16. http://www.raspberrypi.org/phpBB3/viewtopic.php?f=43&t=44466
  17. http://www.raspberrypi-spy.co.uk/2013/05/pi-camera-module-mechanical-dimensions/