Introduction

Raspberry Pi Camera Module

The Raspberry Pi camera board contains a 5 MPixel sensor, and connects via a ribbon cable to the CSI connector on the Raspberry Pi. A User's Guide describes setup and use. The video and still image quality is better than a USB webcam of similar price.

The camera was released for sale on the 14th of May 2013 and the initial production of 10k camera boards[1] sold out after several days. By mid-July 2013 stock was available again.

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).

Motion

There is a version of the security cam / motion-detection program 'motion' adapted for the R-Pi camera (motion-MMAL), written by user 'dozencrows'.[3] Motion detection with still and video capture at a resolution of 1024x576 at 1 fps is possible, and several fps at lower resolutions. There is a blog post explaining how to set it up.[4]

Video4Linux2

There is an unofficial Userspace Video4Linux2 (V4L2) driver.[5][6][7] This allows use of the R-Pi camera with many standard Linux applications developed for USB webcams. Due to the Pi's ARMv6 cpu, lower resolutions and framerates are typical when compared with a modern desktop system.

RAW images

The raspistill --raw option will append RAW data to the JPEG. The RAW data contains the image direct from the sensor, before debayer and color processing. A simple tool called raspi_dng[8] is being developed[9] to convert the JPEG+RAW file into a standard Adobe DNG file.

Configuration

The cameras red LED lights up when recording video or taking a still picture, this can be turned off by adding the following line to config.txt (RPiconfig)

Troubleshooting

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.[11][12]

In some cases, the micro-connector from the camera module to the camera board PCB has been loose. This can be fixed by removing and re-seating the small (tiny!) yellow flex cable connector labelled "P5V04A SUNNY" on the camera board. It makes a click when it is fully seated.[13]

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.[14][15]

It can also be caused by indoor fluorescent lighting. The camera defaults to video mode at 30 fps, which works well in the USA with 60 Hz power. If you are in Europe or elsewhere with 50 Hz power, this may give you flicker under fluorescent lighting.[16] Try using the option -fps 25 to change the frame rate to 25 frames per second.

Customizing

Changing the ribbon cable

The ribbon cable that connects the camera board to the Pi is 15-core 1mm pitch ribbon cable, with alternate end contacts (top side / bottom side). ModMyPi stock Replacement Raspberry Pi Camera Cables for £1.99 and have worldwide shipping. In the UK they can also be sourced from Toby Electronics where the required type is FFC1-15-B150105160MM[17]. 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.[18] One user 'rew' reports a 4 m (13 foot) extension cable is working.[19][20]

Unscrewing more than 1 turn results in removal of the lens[23] allowing use of other optical systems. The lens thread size may be M6 x 0.35[24].

Macro, Wide, Tele adaptor 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.

Replacing Stock Lens

Changing the lens is a more significant and risky modification than simply adding an accessory lens.
Richard Kinch has made an adaptor to mount M12 thread lenses on the R-Pi camera board, after unscrewing and removing the stock lens.[25][26] Martin Miller has posted a guide on raspberrytorte.com describing complete camera module disassembly and replacing lens holder with a stock M12 unit.[27] Various M12 x 0.5 (S-mount) lenses intended for board-level cameras are available at focal lengths from fisheye to long telephoto.[28][29][30]

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[31] and scorp[32] were initially successful, but in both cases the camera died soon afterwards from blunt trauma to the fragile bond wires on the die.[33]

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.[34]

Housings

To help building your own camera board case or enclosure, a hand-measured mechanical drawing[35] of the camera module is available, thanks to Gert van Loo. There is another drawing[36] from raspberrypi-spy.
There are some CAD files for housings and camera holders available on Thingiverse[37].