Raspberry Pi

Information and Products for
Custom Applications and Engineering

Richard J Kinch, PhD

Last updated: May, 2019

This page describes the lens adapters I design and manufacture for the Raspberry Pi camera module. With my engineered modifications, the stock camera module gains an upgraded capability for scientific and industrial imaging. I also give examples below of various projects to enhance the optical performance, including suggestions for novel applications of the camera. You may skip down to the adapter descriptions below for details and ordering, or continue reading here with my technical introduction to the Raspberry Pi itself and the camera module.

Raspberry Pi Single-Board Computer

Raspberry Pi  The Raspberry Pi, a credit-card-sized computer. See also my high-resolution reference photos for the Raspberry Pi Model B (top view) and Raspberry Pi Model B (bottom view). Raspberry Pi models include "A", "B", "B+", and "2", which differ in memory, connections, and speed. These photos here are of the Model B version. In 2015, the Raspberry Pi Foundation introduced the official 7-inch touchscreen display, for which I provide a dimensional reference drawing.

The original Raspberry Pi was introduced in 2012. With the more recent "2" and "3" models introduced in 2015 and 2017, all the various original model names before the "2" are now qualified by being called "1" varieties. The names can be confusing because all the older technical news and discussions such as you might find on the Web did not call the older models "1" at the time, just "the Raspberry Pi", possibly with a letter (A, B, B+) qualification. The older models are thus today intelligently distinguished by precise, fully-qualified names: the Raspberry Pi 1 Model A, 1 Model B, 1 Model B+. In 2015 the "Raspberry Pi 2 Model B" appeared (itself confusing as no corresponding "A" version was produced, and the "Model B" is often left off in casual discussion, and older discussions about the "Raspberry Pi Model B" refer to model "1 B", not model "2 B"). Since 2017 the "Raspberry Pi 3 Model B+" is the current most-capable version. The naming predicament can be off-putting and a barrier-to-entry, so it is best to be aware of it, and not let it deter you from engaging the potential of these devices. Take it as part of the mystery, charm, and intrigue of computers.

Raspberry Pi Camera Module

Raspberry Pi Camera Module  The Raspberry Pi camera module. Actual size is 25mm square, much smaller than the Rasperry Pi computer, to which it connects by a "flat flex" cable (FFC, 1mm pitch, 15 conductor, type B contacts, Molex 21039-0843, discussed here). The connection between the camera element assembly and the module's PC board (indicia "P5V04A SUNNY") uses flex cable and a very tiny connector (Hirose DF30 series, part DF30FC-24DP-0.4V)

The Raspberry Pi camera module offers a unique new capability for optical instrumentation because it is the only device I know of with all of these critical capabilities required for hardware and software application engineering:

None of the recent 1080p cameras like the GoPro Hero3/Hero4 or HackHD provide all of these features.

The Raspberry Pi camera module has several technical shortcomings and limitations:

Details below explain:

Raspberry Pi camera module stock lens characteristics:

My analysis demonstrates a 3.6mm focal length of the stock lens in the camera module, with an f/2.9 aperture, based on my physical measurements and the Omnivision OV5647 specs as follows:

Shooting a full-resolution still (2592 x 1944 pixels, 4:3 aspect ratio) displays a field of view about 194.5 inches wide at 195 inches distance. By optical trigonometry principles, this corresponds to a 2*atan(0.5*194.5/195) = 53 degrees horizontal field of view. Likewise the vertical field of view is 40 degrees, and the diagonal 66 degrees.

The active pixels of the sensor chip are 2592 x 1.4um = 3.629mm wide. Proportioning this by 195/194.5 = 3.6mm yields the lens focal length.

My microscopic examination of the lens entrance pupil with a 10x reticle shows it to be about 1.25mm diameter, so the f/number of this 3.6mm lens is 3.6mm/1.25mm = f/2.9.

For the 1080p video frame, the system uses the unscaled central 1920 x 1080 pixel crop. That is, the 1080p image is cropped without scaling from the central 1920 x 1080 pixels from the larger overall sensor frame. This is unlike a handheld camcorder, or video on a DSLR camera like the Canon 5D Mark II, where the 1080p image is scaled from the entire width of the overall sensor having a higher native resolution. This cropping versus scaling in the camera sensor is analogous to letterboxing instead of scaling on a display. The 1080p field of view with the 4mm lens is thus proportionately different from that of the full frame. The physical width of the central 1920 pixels spans 2.688mm on the sensor. This 1080p 16:9 frame cropping factor is 2952/1920 = 1.35x horizontally and 1944/1080 = 1.8x vertically from the 2952 x 1944 4:3 full frame. HD 1080p angular field of view is thus 39 degrees horizontally, 22 degrees vertically, and 45 degrees diagonally.

Cropping the 1080p image from the central area of the sensor, realizes less total image resolution, versus what is available if the imaged were scaled from the entire width. This is a consequence of the stock lens delivering less resolution than the sensor pixels. See below for a detailed analysis of the lens performance.

The dimensions of the sensor are 2592 x 1944 pixels, each 1.4 microns square, which overall provides a sensor area of about 10 square mm. The sensor diagonal is sqrt(2592**2 + 1944**2) = 3240 pixels, which spans 4.54mm. In video camera terms, where a so-called "1 inch" sensor actually is defined as a 16mm diagonal, the Raspberry Pi sensor is 4.54mm/16mm = 0.28 of a video camera "inch", which is to say a 1/3.5" format (slightly smaller than 1/3", slightly larger than 1/4", in terms of CCTV formats). (For historical reasons, video camera "inches" are 16mm. This strange characterization arose from the original video imaging technology, where a vacuum tube glass envelope of actual 1-inch outside diameter would encapsulate a smaller 16mm active device inside, and the size of the tube and not the sensor was the defining characteristic. In the era of the 1980s when semiconductor chips were first replacing video tubes, the chips came to be commercially identified with the size of the tubes they replaced, not the actual chip dimensions. The tube's imaging elements also were round instead of rectangular, so the diagonal dimension of a rectangular chip sensor was taken as the characteristic dimension for comparison. Today, tubes are long gone, but the confused terminology and standards of measurements may forever govern semiconductor imaging chips and whatever future technology may follow.)

Field of view when substituting a different lens on the Raspberry Pi camera module:

For a lens of focal length f, the Raspberry Pi camera field of view (FOV) for the full-frame still-capture mode is:

FOV = 2·atan(2.27mm ÷ f )
For the diagonal field of view in 1080p HD video cropping mode:
FOV = 2·atan(1.54mm ÷ f )
Where "atan(…)" is the trigonometric inverse tangent (arctangent) function.

The constants 2.27mm and 1.54mm in the above formulas represent one-half of the sensor diagonal size in full-frame and HD-video-crop modes (the image formats acquired by the raspistill and raspivid utilities), respectively.

Some typical lenses thus provide the following fields of view:

Raspberry Pi Camera Module Field of View (FOV)
With Various Typical Alternative Lenses
(Focal Length
and Mount)
Diagonal FOV
Angle in Degrees

(Full-frame still
Diagonal FOV
Angle in Degrees

(HD video
(See later sections below
for full description)
(See table
 [1] Remove stock lens, install M12 adapter, install new lens.
 [2] Remove stock lens, install universal adapter, install new lens.
 [3] First attach additional DSLR/C-mount adapter to new lens. Examples: Canon EF, Nikon F.
 [4] If given lens-mount is not M12 or C-mount, first attach additional lens-to-C-mount adapter to lens.
3.6mm stock lens 65 ° 46 ° None None
6mm M12 lens 41 ° 29 ° M12 or Universal [1] or [2]
12mm M12 lens 21 ° 15 ° M12 or Universal [1] or [2]
25mm C-mount lens 10 ° 7.0 ° Universal [2]
35mm C-mount lens 7.4 ° 5.0 ° Universal [2]
50mm DSLR lens 5.2 ° 3.5 ° Universal + DSLR/C-mount [2] + [3]
Any given lens with
focal length f
2·atan(2.27mm ÷ f ) 2·atan(1.54mm ÷ f ) Universal [2] + [4]

These field-of-view values represent an angular coverage when the scene is at infinity, and approximately to scenes at a significant distance (that is, a distance which is many times the focal length of the lens, which is practically "infinite" in the optical sense). When focusing to closer scenes (via macro magnification with a close-focusing lens or macro extension tube, or by attaching a close-up lens to the front of the lens), the effective field of view will shrink for a given focal length, in proportion to how close the scene is to the lens.

Note that wide-angle lenses (that is, shorter focal lengths) typically exhibit uncorrected barrel (or pincushion) distortion, which will slightly narrow (or widen) the actual field of view from the theoretical value.

Specified, theoretical, and actual resolution in the Raspberry Pi camera:

Cameras are governed by a dismal weakest-link principle: whichever camera system component (lens, sensor chip, lighting, file format) is least resolving, limits the total system performance to that component's weak performance. Camera sensor chips with tiny pixels (such as the Raspberry Pi camera module) demand a lens which provides image resolution that is similarly resolved. When pixels are so tiny as to approach the wavelength of light, the lens demanded must be similarly ideal. The weakest link is the lens, and the lens choice becomes the critical factor in achieving performance.

This predicament is further constrained by an fundamental principle of optics:

The f/number of a lens wholly determines the spatial resolution of the lens images.

In short: The sharp images required by a sensor with tiny pixels constrains lens choices to very low f/numbers. Higher f/numbers will result in images blurrier than the sensor chip. Moreover, since the f/number also determines depth of field (DOF), the DOF is likewise constrained to be shallow. One ought not to be too charmed by the idea that any lens can be fitted to the Raspberry Pi camera module with a special adapter, since full performance will be realized only by certain lenses that obey the f/number principle. One ought not adopt a binary criterion that lenses are "good" vs. "bad" (or "quality" vs. "cheap"). While build quality matters (another weakest-link constraint), what matters most in judging the suitability of a lens is the proper choice of f/number, and understanding the consequences (such as DOF) that follow. This rightfully proportioned judgment then becomes a trade-off tool, where one can sacrifice a bit of performance for significant advantages in cost and feasibility. This is what makes for engineering analysis, which predicts performance and pays once for reliable results, instead of repeated-risk, hit-or-miss guesswork.

When considering the image resolution performance of a camera lens, a useful optical engineering rule-of-thumb is that an ideal lens cannot focus a spot smaller than about double the wavelength of light times the f/number (see the Optipedia optical theory, and an essay from Edmund Optics). That is, the spot size at the camera sensor when imaging a point-source (the point-spread function, or impulse response, of the lens) is always bigger than that lower diffraction limit. The best-quality practical lenses are still less sharp. The following formula succintly states the diffraction limit of a lens:

Spot size (in microns) = 1.3 * N
  where N = f/number of the lens
(This rule-of-thumb derives from the Rayleigh criterion for the size of the Airy disk in green light.)
A perfect lens can do no better than this.

Practical lenses are significantly imperfect due to aberrations, such that the best commercial lenses only begin to approach this diffraction limit. This was not a critical limitation in the history of photography, when commercial lenses could resolve better than film, but with the tiny pixels of today's digital sensors, this f/number limitation is essentially the whole story of digital camera performance. Today, good performance from a digital camera is entirely dependent on extreme lens quality in low f/numbers, because digital sensors having tiny pixels (which is all sensors in small formats lately) out-resolve theoretical lens limits.

The MTF (modulation transfer function) of a lens, which characterizes the useful sharpness, cannot be better than the spatial frequency of the diffraction-limited spot size. MTF specifications for commercially available lenses are never available in detail, if at all, so useful guidance on choosing a lens must rely on the rule-of-thumb for spot size, and on some specification or guessing on the correction quality of a given lens.

Using lower f/numbers to increase lens resolution is an unhappy trade-off, because aberrations increase with lower f/numbers. Useful contrast will only appear at reduced spatial frequencies. The lens is simply blurry, not sharp, at resolving image details at this spot size or smaller. Lens aberrations will further reduce the performance, since aberrations make the realized spot size larger and distorted in shape (astigmatic). Aberrations worsen towards the edges of the image from the center, so the performance is best at the center and worst at the corners of the image.

Given f/2.9 for the Raspberry Pi camera's stock lens, the rule above implies a spot size of 1.3 * 2.9 = 3.8 microns. A good quality lens might resolve close to that, but 5 microns might be a reasonable expectation, especially at the edges of the field. So the Raspberry Pi 5-megapixel camera with stock lens, consisting of 1.4 micron pixels, cannot possibly produce 5-megapixel images. More likely the optics are resolving much less, which means the true resolution is perhaps 1.3 megapixels over the full sensor, and still less over the 1080p HD crop. The pixels are much smaller than the actual image detail, and the pixels are oversampling the image content, with the inevitable result of blurry pixel data.

If we were to attempt to improve the camera performance by fitting a lens adapter and installing a different lens, that lens would have to improve on the stock lens with either a lower f/number or improved correction of aberrations, or both. Given that f/numbers in small lenses are only available down to about f/2, and that reduced depth-of-field consequent to such fast lenses may be incompatible with the application goals, the potential improvement from a lens change may not be dramatic. Since the lens f/number and correction, and not the focal length, are the critical factors determining image resolution, the motive for a lens change will typically be to freely choose the focal length for an appropriate field of view for a given application.

The MTF of the sensor itself is another uncounted factor, where the Bayer filtering and GPU processing will necessarily introduce additional loss of resolution from the nominal pixel spacing. The MTF of the system is always a cumulative product of the MTF of each element. The weakest-link MTF imposes an envelope over the best potential system MTF performance.

These are all theoretical considerations, which ought to be measured with laboratory testing if we are to properly apply the camera. A simple impulse image test, measuring the realized point spread function, or a slanted-edge image test (see Kerr's paper, and the Imatest methods) would establish the true performance of the Raspberry Pi camera with its stock lens. I have not yet performed these tests or found reports of others doing so.

Camera manufacturers themselves are never candid about these things; commercial competition turns entirely on isolated theoretical numbers and not on the relatively miniscule delivery of the whole system. Consider the absurd 41 megapixels touted by the Nokia Lumia 1020 smartphone. Canon is reputed to be the most honest, advertising MTF charts of their lenses, but in fact these are simulated and not real tests, and involve only low lp/mm conditions that reveal little about the high-resolution performance; Canon disclaims that their purpose is not proof of absolute performance, and admits that they are only good for roughly comparing one lens to another. Hence we have endless research and inconclusive debate amongst photographers about the best lenses and cameras. It is a complicated question, where "resolution" is a genuinely subtle concept, so the debate will never end. One is reminded of the difficulty of evaluating cars, audio amplifiers, vacuum cleaners, and even air compressors.

This dismal truth of resolution limits might upset one's hopes for amazing $35 camera performance. It may help to understand that any camera is just a "dual" of a microscope, in the engineering sense of isomorphic duality, where the camera lens is the dual of a microscope objective inspecting the sensor. The pixels in the case of the Raspberry Pi camera, being 1.4 microns, are about the size of bacteria. A microscope objective that resolves bacteria is very expensive and large, cannot cover a field of view anything like the area of the camera sensor, and provides about 2 megapixels of image content at best. A small f/2.9 lens, even of the highest quality, cannot approach that kind of microscopic performance. Such performance is not possible for a microscope, and neither is it possible for a camera.

The same limits apply to tiny smartphone cameras. The iPhone 6 may specify 8 megapixels, and produce image files of that geometry, but there are certainly not 8 megapixels of information contained therein. High-resolution photography requires large pixels. Sensor chips in 1/3-inch and 1/2-inch formats cannot achieve more than a few megapixels, because there are no lenses that produce images beyond that resolution.

Depth-of-field (DOF) also competes with resolution, because DOF strictly depends on f/number. You can have large DOF, or you can have high resolution, but you can't have them both at the same time. This trade-off governs the many applications where a large DOF is required.

Adjusting the Raspberry Pi camera module stock lens focus:

The stock lens consists of aspherical elements glued into a black plastic cell. The outside of this plastic cell is threaded (M6x0.35 metric thread) which then screws into matching M6x0.35 internal threads (nominal 5.64mm minor diameter) on the plastic receptacle housing. The outside edge of the forward end of lens cell provides a spline shape, presumably to engage a tubular mating spline tool for adjusting image focus while live-viewing the video image through the tube.

The threaded focus adjustment is set to infinity at the factory. Changing the focus from infinity to something closer requires that you turn the threaded lens cell counterclockwise, moving the lens further away from the imagning sensor. You may turn the lens cell in the receptacle without the spline tool, using tweezers or tiny screwdriver tips to grasp the spline corners, although this will tend to mar the plastic. Three tiny dabs of clear elastomeric cement lock the very top of the cell into the receptacle, so adjustments are easier if you slice carefully into these dabs with the corner of a fresh single-edged razor blade, or the tip of a fresh Xacto knife, taking care not to slice into the soft plastic itself. The 8mm square receptacle housing is held onto the PC board only by a thin square of foam sticky tape, so you will have to grasp the receptacle in forceps or some other fixture to loosen the threaded engagement. These adjustments are all best done under workstation magnification such as a 10x stereomicroscope, since these precision parts are tiny. Keep tools away from the glass lens surfaces, as tool contact will likely scratch or mar them, causing permanent optical damage, resulting in loss of image quality. Because the stock lens is tiny, slight flaws or contamination can result in significant degradation in overall image contrast and sharpness, even though the flaw itself will not be imaged.

Comparing the Raspberry Pi camera module with stock lens to a 35mm camera:

Comparing to a 35mm-format film camera (36mm x 24mm frame), the relative linear sensor size of the Raspberry Pi camera module is a factor of about 10 (36mm/3.629mm) smaller for stills capture. So the Raspberry Pi camera module with its 3.6mm f/2.9 lens acts like a 35mm camera with a 36mm f/2.9 lens, in terms of field of view and brightness. In photographic terms, this is in the middle of the wide-angle range of lensing. In 1080p video mode, the Raspberry Pi camera module crops the active sensor width to 2.688mm, and consequently the 35mm-film relative scale ratio increases to about 13 (36mm/2.688mm), making the 3.6mm lens field-of-view equivalent to about a 50mm lens on a 35mm-film camera. Since 50mm lenses on 35mm-film format cameras are considered the happy medium between wide-angle and telephoto, we can appreciate the Raspberry Pi stock lens design as fitting the classical compromise when the photographer is limited to a single prime lens. Depth of field is likewise scaled 10x or 13x, which is to say, not at all like the 35mm camera, as is typical of digital cameras with small sensor chips versus 35mm film. The full-frame aspect ratios also differ, namely 4:3 (Raspberry Pi stills) or 16:9 (Raspberry Pi 1080p video), versus 3:2 (35mm film).

Removing the Raspberry Pi camera module stock lens to adapt another lens:

Turning the cell out (counterclockwise looking into the lens) will move the focus closer, and turning in (clockwise) will move the focus toward or past infinity. Unscrewing the lens cell completely will remove the lens entirely, revealing the infrared blocking filter at the bottom of the receptacle, beneath which can be seen the imaging chip itself. The filter also serves as a dust window, keeping the sensor surface clean where dust would cause spots on the image; any dust on the window will be well defocused and only slightly affects image contrast instead of appearing in the image.

Adjusting the Raspberry Pi image corrections for a modified lens:

When digital camera designs are shrunk to smaller sizes, the ideal behavior of the optical system becomes disproportionately less ideal. With decreasing size, the raw image formed in a camera becomes increasingly aberrated. This is a dismal inevitability imposed by optical physics, and engineering better lenses is not available as a solution like it is in big cameras, because the system has shrunk into a different realm of optical scale and principle. It is also a complex physical problem imposing multiple conflicting interactions, because each of the elements (lens, IR-blocking filter, Bayer color filtering, and sensor pixels) yields different types of non-ideal performance from the others as they all shrink.

The major examplar effect of shrinking a digital color camera is that the Bayer color filter placed over each minute pixel performs differently at the edges of the sensor versus the central area. This is an inevitable consequence of the incoming light ray angles varying from the center outward. As pixels shrink in design size, this effect becomes more pronounced from the compounded effects of the Bayer filters shrinking in size and the angles increasing from the smaller overall scale. In the end, a camera design principle that delivers a flat color response in a larger format (such as a full-frame or APS-C DSLR, or Micro Four Thirds) will deliver an increasingly distorted color response as the implementation shrinks in scale. Thus the engineering goal of a tiny camera is not to produce a camera with an ideally uniform color response across the field, but instead with an convenient non-uniformity that can be corrected later through digital post-processing.

It appears ("appears" as in, the developers have yet to openly disclose the facts) the Raspberry Pi camera module embodies this principle, correcting color response through firmware post-processing and not through optics. This is a current practice in the best smartphone cameras, as you may read in an intelligent explanation of color shading problems in those products. This digital magic relieves the analog optical elements from performing any goal of color fidelity. It frees the optical designer to perfect flatness, contrast, and resolution in the optics, while disregarding the color aberrations thereby introduced. In design-goal essence, the analog optics must establish only spatial fidelity, and digital processing compensates for any characteristic spectral infidelity. This is in keeping with the essential capabilities of the analog versus digital image technology: the analog mechanisms must be about detecting and transducing "where" precisely (spatial fidelity), the digital realm is about representing what it means (color fidelity). Digital processing can perfectly invert certain aberrations in analog images, such as color and spatial distortion, as long as the aberrations precisely correspond to some mathematically-modeled characteristic.

So a consequence of shrinking a camera to a very small format is that the The Raspberry Pi GPU firmware applies several digital image corrections to the raw camera images to improve for the optical imperfections of its physical image formation. At least we believe this must be the case, although the fact of it and the details of implementation are hidden in the mysterious GPU binary blob. Since the Raspberry Pi has not provided the option of capturing raw images from the camera module, we are in a predicament of having to work with images that have been processed through the mysterious GPU methods.

Therein lies a problem, if we are to switch lenses. The firmware color correction is based on the stock lens; the system assumes that the stocks lens is on the camera, and provides (to date) no option to change or disable that assumption. If we replace the lens, the stock-lens correction no longer is appropriate, and indeed may be opposite to what is appropriate for the new lens, and may thus introduce a false color distortion to the images. This would be the case if the stock optics are color-distorted, and switching in a more-perfect lens (one that is not color-distorted) will inadvertently result in a poorer image, in terms of color fidelity. This is an unhappy conundrum: a better lens should not yield a worse image.

If you replace the stock lens with a different lens, you must also adjust the firmware settings to maintain a even color response across the field of view. This is difficult with what we don't know as of this writing about the Raspberry Pi firmware: we don't know what corrections are being applied, and we haven't been allowed the tools to change the application. The result is that switching a different lens onto the Raspberry Pi may result in uneven color, such as a greenish tint towards the center of the image, and a pinkish tint towards the outer portions. Results can be confusing because past versions of the standard capture software applied lens correction differently in video (raspivid) versus still (raspistill) modes, and the automatic white balance (AWB) settings also factored into color corrections (in order to correct for various spectra of ambient or flash lighting). This is further complicated by the original firmware and capture software being designed to correct only the stock lens and not providing any options for a different lens, or to just turn correction off altogether. So to achieve an even color response, this leaves us to carefully observe and apply proper color corrections in the capture software, as we are enabled. Current (09/2015) features of the raspistill software provide only limited control over color correction, namely through the --awbgains option; it is unclear whether altering the lens-correction component is available through any option or modifying the user source code.

An alternative technique for better control of lens correction is to capture raw images into files, and then post-process those files with ImageMagick. This is more involved and slow process than correcting in firmware, but necessary to get the ultimate imaging performance from the camera with a lens change. You can detect the radial color correction required by imaging a white card, which will map the color distortion of the system (including the inappropriate corrections of the firmware). This color distortion map is what you must invert and apply to correct images through post-processing.

M12 lens adapter for the Raspberry Pi camera module:

M12 lens adapter for Raspberry Pi camera module Here is my adapter to use standard M12 PC board camera lenses (micro video lenses, sometimes called "S-mount") with the Raspberry Pi camera module. Remove the stock lens as described above, and attach this adapter to use an M12 lens. See the adapter full size drawing here [PDF file]. Construction is from black-anodized aluminum (weight: 10 grams). I also can provide a black Delrin version (weight: 6 grams) for weight-critical applications.

Buy Now: Order this adapter online from me here

Universal lens adapter for the Raspberry Pi camera module:

C-mount and M12 lens adapter for Raspberry Pi camera module This is my "universal" adapter to use standard C-mount camera lenses (CCTV lenses) with the Raspberry Pi camera module, or M12 lenses, and by extension Canon and Nikon DSLR lenses as well. Remove the stock lens as described above, and attach this adapter to use a C-mount lens. The adapter also accepts M12 lenses like the simpler M12-only adapter above, so this is a combination adapter. The C-mount adapter is parfocal, that is, it fits the camera sensor to the standard C-mount lens focal plane location and flange distance. By adding an inexpensive stock C-mount to Canon EF-mount adapter, this adapter also becomes a parfocal adapter for Canon EOS lenses, and likewise for Nikon F-mount lenses. See the adapter full size drawing here [PDF file]. These larger types of lenses mean that the lens itself dominates the bulk of the assembly, meaning that you are essentially piggybacking a lightweight camera onto the back of a lens, such that any fixture to hold the camera should be fastened to the lens and not the camera module itself.

Construction is from aluminum with optical surfaces painted black. Weight is 15 grams.

The currently shipping version of this adapter has been upgraded to provide an M30x0.75 outside thread (4mm long) on the front diameter. This additional feature is available to mount camera filters, camera step-up/step-down rings, close-up lenses, weatherproof windows, etc., in front of the Raspberry Pi camera, when using the stock lens or M12 lens. Similarly the front-outside thread is available to panel-mount the camera to a mating threaded hole in a panel or box enclosure less than 4mm thick, or an unthreaded hole using a step-ring as a fastening nut. When using a C-mount lens, the front adapter thread is immediately behind the lens rear flange, so it provides a mechanical panel-mounting option, but optical elements will still fit onto the front of the lens itself.

Buy Now: Order this adapter online from me here

Applications of the M12 and C-mount adapters

  C-mount adapter with Raspberry Pi camera module and computer

  This is a typical custom C-mount lens I design and fabricate for microscopic applications of the Raspberry Pi camera. This design inexpensively provides the optical system of a surgical operating microscope to the versatility of the Raspberry Pi camera's image capture and processing. The design consists of a stock C-mount lens with custom optics added to the front. As shown at left, the working distance to the subject is focusable from 135mm to 170mm, with a microscopic field of view of 12mm x 7mm and resolution of 10 microns at the subject. A wide range of field of view (magnification) and working distance are available through choice of the custom optics. Cost for this custom lens is $500.

  Stock lenses can be used directly on the Raspberry Pi with the C-mount adapter. Shown here is a typical telephoto zoom C-mount lens on the Raspberry Pi (Canon V5x20 20-100mm zoom, f/2.5).

  Another C-mount lens on Raspberry Pi (Computar 12.5mm f/1.3).

  The lens alone is bigger than the camera module and adapter, suggesting the lens should be supported or mounted directly, with the camera module supported by the lens, rather than trying to support the lens with the camera board.

  Canon EF-mount for Raspberry Pi camera module. This is achieved by adding a stock C-mount/EF adapter onto the C-mount adapter. The Canon EF bayonet receptacle then fits any Canon EOS lens. Parfocality and infinity focus are maintained.

  Canon EF 24-105mm f/4L IS USM zoom lens adapted to Raspberry Pi camera module.

  Canon EF 70-200mm f/2.8L IS II USM zoom lens adapted to Raspberry Pi camera module. Also shown is the Canon Extender EF 2x III teleconverter, which doubles the focal length to a 140-400mm zoom. Given the 1.4 micron pixels in the camera, the off-the-shelf Canon 400mm optics digitally resolve about 1.4 seconds of arc at f/5.6, with a diagonal field of view of 0.65 degrees. With the 70mm setting, the resolution is 8 seconds of arc at f/2.8, over a diagonal field of 3.7 degrees. The MTF limitations (analyzed above) at f/2.8 or f/5.6 will reduce the resolution to a much lower realized performance. A reasonable expectation is that with this Canon lens, the Raspberry Pi camera will resolve as many megapixels of genuine image as the stock f=3.6mm lens, but at a telescopic f=200mm focal length. Cost of this entire superb assembly is about USD $3000.

  Raspberry Pi camera module adapted to Leica Dialux for fluorescence microscopy, using the C-mount adapter. This configuration is suitable for any microscope with a C-mount trinocular adapter, such as Olympus, Nikon, Zeiss, etc. The microscope's intermediate image is directly projected onto the camera sensor. The camera's tiny 1.4 micron pixels will greatly oversample this intermediate image, which resolves to a spatial frequency of 10's of microns at the camera. For example, a high-NA 40X microscope objective resolving 1 micron at the object projects that image at 40X, which is to say 40 microns at the camera, requiring sampling at 20 microns or smaller, which the camera's 1.4 microns are oversampling. The camera will thus easily capture the full microscopic resolution of the instrument, although a highly cropped central portion of the full field a view. The sensor chip has a 4.54mm diagonal, versus a usual microscope intermediate image size of 18mm, so the cropped view will span only the central 1/4 of what is seen visually in the eyepieces.

  Rear view showing how the camera module attaches to the C-mount adapter, and is fastened with two screws

  Front view of camera module with C-mount adapter. Blue rectangle shows the reflected edges of the active camera sensor area at the bottom of the stock lens receptacle. The adapter maintains precise placement of the sensor at the C-mount flange distance, providing parfocality and infinity focus with standard C-mount lenses.

  The solid aluminum adapter clears all camera module components, but is rigidly attached and electrically isolated.

  Separated views of the C-mount adapter with the Raspberry Pi components. The two screws attach the adapter to the camera module. Shown above the screws is the stock lens which has been removed from the camera module.

  Bottom of the C-mount adapter is supplied with an insulating lamination to isolate it electrically from the camera module PC board. Originally this insulation was vinyl tape as shown here, but the current versions ship with 0.010-inch thick, amber-colored polyimide tape.

  Stock lens removed from Raspberry Pi camera module. Camera sensor is seen reflecting from the bottom of the stock lens receptacle.

  Typical M12 lens fitted to C-mount/M12 adapter. Lenses in this format and about the size shown are available in focal lengths from 1.6mm to 16mm. Longer focal lengths require a larger lens body as shown below.

Focus is adjusted manually by screwing the lens in and out. This adjustment permits focusing from infinity, down to a close-focus limit which depends on the lens chosen, typically a few inches. An even closer focus in the macro technique is available by stacking on an M12 extension tube, which will allow macro focusing to a working distance approximately equal to the lens focal length.

The M12 thread fit is not snug, so holding a focus adjustment requires wrapping a bit of Teflon tape around the lens threads when installing the lens. To fix the focus semi-permanently, touch a bit of nail polish or solvent glue between the top of the thread receptacle and lens threads.

  Long focal length (35mm), high-speed M12 lens fitted to the combination C-mount/M12 adapter. A larger lens body with 50mm focal length is also available.

  Views of the M12 adapter. This photo shows the original black Delrin material. The current version is identical, except in black-anodized aluminum with a smooth matte finish.




  Long focal length, high-speed M12 lens fitted to the M12 adapter.

  Typical M12 lens fitted to M12 adapter.

  Typical M12 lens fitted to the Raspberry Pi camera module.

  Long M12 lens assembled with camera module.

Copyright 2013, 2014, 2015, 2016, 2018, 2019 Richard J Kinch.
"Raspberry Pi" is a trademark of the Raspberry Pi Foundation.
Richard J Kinch is the sole designer and manufacturer of the compatible products described above, and has operated independently of the trademark owners and the Raspberry Pi Foundation. Trademarks are referenced solely to establish compatibility and suitability for your application, or for product comparison.