Public Lab Research note

Raspberry Pi Microscope/close up lens system

by MaggPi |

Read more:

MaggPi was awarded the Basic Barnstar by stevie for their work in this research note.

Raspberry Pi Microscope/close up lens system

This project provides a way to use a Raspberry Pi camera to take microscope/macro pictures. The design may not be as elegant as some other public lab microscope kits ( but provides an alternate approach that may be useful for a given project.

Key aspects of the design: --Lens mount convertor/adapter rings that permit a variety of lenses/microscope objectives to be used with the Raspberry Pi camera array. Modular lens approach is very useful since microscope objectives, close-up or wide field of view lenses can be easily swapped for different measurements.
--A .5 meter flex cable for the Raspberry Pi camera. The flex cable permits greater camera/computer separation distances than the 15cm cable that comes with the camera.
--Mount/stage system. A basic setup using labjacks and an LED light. Nothing fancy but easy to set up and is essential to hold lens and focus image. --Python image capture software. Software permits real time video adjustments followed by jpg image capture.

Major lens system parts list (with supplier/cost): --Lens Mount: M12 lens mount (male metric thread with 0.5 mm pitch) with mounting screws. Designed for Raspberry Pi camera v2.1 with 21mm hole spacing. Mounts lens holder to camera/array board., $8.50. -- Adapter Ring: attaches onto the M12 lens mount and enables a C Lens to be mounted,, $6.59. -- C mount to RMS adapter: This ring has both an inside and outside thread that enables most microscope objectives (RMS mount) to connect to the C mount holder. , $8.75. --Flex cable: 1 meter flex cable for the Raspberry Pi camera., $ 3.95

Attached pictures provide assembly instructions:

  1. Remove lens from Raspberry Pi camera board. Note that lens removal voids the warranty. --Option1 is to unscrew the lens. This can be done by a special 3 D printed lens removal tool or a pair of pliers and a very steady hand. –Option 2 is to ‘decap’ the lens holder (and lens) from the board. One decap method is to cut into the epoxy between the board and lens holder with end cutting pliers. The technique chews into the epoxy until the holder pops off.

  2. Align camera board holes w/M12 lens mount and screw together.
    Lens removal and lens mount

  3. –Thread the C adapter ring to the M12 lens mount --Thread the C mount to RMS adapter on the microscope objective --Thread the objective to the C adapter ring Lens mount and adapter assembly

  4. Most applications will require an adjustable height camera/objective holder. One option is to use two lab jacks with the camera resting on two rulers. This is a good option for quick tests but other designs should be considered for reliable results. Adjustable camera/lens mount holder

  5. Start taking pictures! I prefer to use a python program that provides 30 seconds to optimize the focus and then automatically records a jpg picture. Code is available at:[]10.

In order to compare different lens options, pictures of Raspberry Pi camera shipping box were taken with a standard Raspberry lens (3.04mm), M12 2.8mm lens, 10X and 20X objective. Each of the images have a different camera to object distance and show how the lens system can provide different fields of view and magnification. Images are recorded and shown with the same digital format. Lens picture comparison

raspberry-pi python microscope



Wow! @stevie, check it out!

@stevie awards a barnstar to MaggPi for their awesome contribution!

Hi, @maggpi -- what do you think of trying this out with one of our microscope stage prototypes? Could we send you some parts to test it out with and provide some feedback?

Is this a question? Click here to post it to the Questions page.

You must be logged in to comment.