Microscope lens for Raspberry Pi camera V2

Hi everyone,

I would like to build a raspberry pi based microscope to analyse red blood cells for detection of malaria. What kind of external lenses can I use? is there any review on different type of lenses used with Raspberry pi cameras (v1 and v2, not HQ)?

Some of the lenses I consider for these are extracted from laser pointers, DVD drives, ball lenses and single aspherical lenses.

Please let me know your recommendations.

I read a few research papers and I think the following paper captured most of the designs, but didn’t discuss on the lenses.

Haoran Wang, Rainer Heintzmann and Benedict Diederich, “The power in your pocket – uncover smartphones for use as cutting-edge microscopic instruments in science and research”, Adv. Opt. Techn. 202, De Gruyter, 2021.


For the OpenFlexure microscope we recommend 40x-100x 160mm tube lenses with RMS threads for the high-resolution version. We have 3d-printable adapters for these to be mounted on the Raspberry Pi camera.

My colleagues @rbowman and @julianstirling would be able to talk more intelligently than me about trade-offs of using different lenses and their suitability for detection of Malaria. I also just came across these wiki articles explaining some of the trade-offs of different options that we have adapters for: -


Hi Kasper, thanks for the reply. Do you have any particular reason to use tube lenses+fixed length objective than infinity corrected objectives, except for cost reasons? I am looking for cheap lenses, like mobilephone lenses.

Generally cost but also space. For the finite conjugate, the tube lens is used to demagnify the image as the pi camera sensor is much smaller than the eyepiece:

If we use the same 50mm tube lens with an infinite conjugate lens the sensor will sit 50mm behind the lens, it is a bit smaller for the finite conjugate objective.

More details on the optics implementation, and our plans to simplify the generation code are given in the OpenFlexure Enhancement Proposal OFEP2

1 Like

Thanks, Julian for the excellent guide. I have a small question. I think your answer regarding the infinity lens is for Raspberry Pi HQ camera sensor, rather than for the camera v2, which has an in built lens in front of the CMOS sensor. Please correct me if I am wrong.

My question is for camera v2, which is very similar to smartphones (I mean sensor with fixed lens in front of the CMOS sensor).

We remove the lens from the V2 , but we are are using the V2. We do not use the HQ yet. The HQ sensor is much bigger, so we would require a much longer tube length.

With a lens fixed in front of the camera you end up with a more complex imaging system. I have not looked into this but I assume you want to be forming a virtual image which you then view with the lens on the phone.

We also have a version which uses the lens of the v2, but we again remove the lens, flip it, and then move it away from the camera creating effectively a macro lens. While this is good for hobbyist use, it will not be reliable enough for malaria parasitology. For malaria parasitology we always use a 100x, oil-imersion, plan corrected objective, and an achromatic doublet tube lens.

It is also worth considering that if you do remove the lens from the Pi Camera V2 and replace with a different lens you will get colour aberrations because the cheif ray angle has changed and does not align with the lenslets above the pixel colour filters. The OpenFlexure software does this correction. We also have a paper describing this issue and how to fix it

1 Like

That is a very good information. I think an experiment like the below with reversed lens from the same raspberry pi camera lens would be good to have. I hope someone form here might have done.

Not immediately related but maybe worth a glance:

Arducam Raspberry Pi 8MP v2 camera modifications

Some months ago I bough a modified version of the v2 camera with voice coil motor focus control. Works like a charm.

Thanks. I am also trying to buy an Arducam. We yet to figure out from where to buy it.