New autofocus camera modules! - Raspberry Pi Camera Module 3

Nice camera, bringing a few questions for the microscope.

It appears to require the Libcamera software (As stated by Pimoroni), and it is not obvious whether we can now take the lens out. Libcamera means changes to the Openflexure server that will take effort.

The pixels are bigger, and there are more pixels, so the overall sensor is almost twice as big on the specification comparison. In fact it is nearly as big as the High-Q camera - smaller diagonal, but higher aspect ratio, so the long dimension is bigger on Camera Module 3 and the short dimension is bigger on High-Q camera.

This brings bigger design questions in the optics modules, to make use of that larger sensor area might mean a longer optical train - There is a bit of a thread here. @r.w.bowman any thoughts?

Of course, one could just keep the same optical train and then only use the central part of the sensor. Camera V1, also had 1.4µm pixels and gave 5MP which is still probably more than the actual optical resolution of the system. With fewer, bigger, pixels than V2, and a newer sensor design one would hope that the noise is quite a bit better. By cropping we could also use more of the useful optical image area with a nearly square crop to 3.68mm wide (width of image circle designed for the V2 camera) by 3.63mm high (limited by the height of the V3 camera), which gives nearly 7MP. Having significantly more pixels than needed for the optical resolution would just bloat the image sizes.

1 Like

I got a Raspberry Pi Camera Module 3 to play with.

It works on a new install of the Raspberry Pi OS, which needed updating to get the new camera driver.

Unsurprisingly it does not work immediately on a microscope Raspbian Openflexure, which is based on an older version of the Pi operating system and a different camera software. It is not recognised as a camera, which may be more about drivers than about how the software talks to it. That is beyond what I can do quickly.

The Camera module 3 does not come with a lens removal tool like Pi camera v2 usually does. The lens is freely floating on the autofocus mechanism. Grabbing the lens it will move in and out a bit, and twist a bit before coming to stops. Surprisingly this did not immediately break the autofocus mechanism.

I don’t actually need a camera, this is just to work out whether it is possible to use the new sensor with other lenses. So the next is a pair of big pliers. Twisting the lens has quite a bit of resistance at first, so the camera body needs to be supported. But the lens does start to unscrew! The autofocus also works, although of course the focus range becomes very reduced.

Unscrewing the lens completely reveals the sensor and the lens.

The sensor is very wide aspect ratio, as we know from the specifications. The lens is obviously different from the Camera V2, but overall pretty similar.

So what have I learnt for the Openflexure Microscope from the teardown? The board form factor is the same, and we can remove the lens. The lens is suitable to be re-used in a microscope lens spacer. So there would be a few changes to microscope parts to accept the slightly different size camera module and the different size lens in a lens spacer, but optically and physically it should all still work. It is likely that we would want to crop the image to a square-ish shape so this is would not be a 12MP camera on a microscope.

The software would however probably require much more involved revision to accommodate this camera.

One final note: After screwing the lens back in, the autofocus still worked. That is amazingly robust for such a thin and light mechanism.


This is a fantastic review. I’m making a few microscopes and was informed by the pihut ( that the previous 8MP v2.1 cameras have been replaced by the current model 3. Not sure if the V2.1 will be discontinued, but they are extremely difficult to locate in the United States.
Many people, including myself, have noticed that the arducams do not function with the current OFM software.

Just as the Pi is supposed to be coming back available, the camera goes away…

Looking in the UK, the maker retailers seem to have stopped stocking the Pi Camera V2.1, but the big electronics firms still have them (RS and Farnell/CPC) with more than 150,000 in stock between them. However Newark (sister company to Farnell in the US) only has a small number of the NoIR version.

The announcement of Camera Module 3 seemed to say that it was a new camera alongside Pi Camera V2.1, but having it still manufactured is not the same thing as it being widely stocked. There are other projects where I need a fixed focus camera to keep the image size constant, so the Camera Module 3 is a problem even when there are not the software ties to V2.1 that we have on the microscope.

The NoIR is still widely available but I don’t think is OFM compatible. It is too hard to make the Arducam or similar OFM compatible?

1 Like

The V2.1 NoIR should be the same as the normal V2.1 in terms of the connection to the Pi and operating with the OpenFlexure software. The only difference is that it does not have an optical filter in front of the sensor to remove any infrared light. When using the camera to image a scene in daylight or using incandescent illumination this will make the colours look odd. In the microscope with LED illumination the LED spectrum usually contains no infrared anyway, so having no filter should make no difference. However, I have not actually tried it.

Making other cameras compatible requires quite a big change in the software in order to implement the camera colour and lens shading correction that makes the microscope images so clear. It is going to be necessary, the current method not only prevents other cameras from being compatible, it also ties the microscope server to an old version of the Raspbian operating system.

I think you can disable the autofocus/set it to manual on the new camera so it should still work for non-OFM uses. There’s also the global shutter camera with larger pixels New Raspberry Pi Global Shutter Camera for machine vision and more - Raspberry Pi which could be very useful for fluorescence, imaging fast things (it should be able to do 30us exposure if we can get enough light), and synchronising to illumination.

Has anyone tried the lens shading tuning described in ?

According to your findings, camera module 3 differs greatly from v2.1. I believe it will necessitate some modifications to the objective tube and possibly another type of corrective lens(?) as well as software changes. But aren’t we passing up an opportunity to increase image quality by not making it more compatible?

There is actually not much to do to make the camera physically compatible. We would just need to define the new camera cutout shape in the same way that we have for the existing cameras.

The resolution part of the image quality is set mainly by the objective lens and the illumination, all the cameras have plenty of pixels to cover the optical resolution. The new camera has bigger pixels and so should have better low light and noise performance. The lens shading correction is the biggest part of the visual image quality, and is what makes tiled images look good. That is the software part that is only currently implemented for V2.1.

The software is the larger task, because it means somebody learning how to use the new lens shading in the latest Raspberry Pi OS and libcamera. However it could bring big rewards because there should be ways to make it much less camera specific.


I finally bought the new module today. I now have OFM server running on the latest 64bit Raspberry Pi OS and can stream the preview MJPEG stream using Picamera2 (which uses libcamera) and take images in OFM software. The dependencies are a complete mess (e.g. using venv --system-site-packages to include libcamera), but otherwise, it’s looking promising. The more complicated part of camera configuration, lens shading etc. is mostly untouched yet, but it should be supported by picamera2 so with a bit of luck it won’t be as bad as I feared. I pushed my implementation of PiCamera2Streamer in Commits · picamera2 · OpenFlexure / openflexure-microscope-server · GitLab (it will need some cleanup when it’s done, I just wanted to have something working for now).

I’ll try to make progress on it when I have some free time, if anyone else wants to work on this I can provide my SD image to simplify setup.