Camera: Raspberry Pi Camera Module v2 (no hardware autofocus)
plan: attach a stepper motor to the microscope’s focus mechanism to do motorized autofocus (I’ve seen designs that use the fine-focus knob, but this microscope only has coarse adjustment)
Software: I know OpenFlexure uses the Pi Camera v2; unsure how its autofocus works
Questions I need help with
Will using a stepper motor on a coarse-focus mechanism (instead of a fine-focus knob) be a problem for reliable autofocus?
The Pi Camera v2 has no hardware AF — does OpenFlexure rely on software focus metrics (contrast/variance/FBP/etc.) that would work with v2? Is it straightforward to adapt OpenFlexure’s autofocus to my design?
Can I reasonably use OpenFlexure software to autofocus this cheap microscope after changing parameters, or would it need significant code changes? If so, what parameters are important to tweak?
General recommendations: should I upgrade to Pi Camera v3 (with AF) or stick with v2 + software autofocus? Any example configs, forks, or projects that did something similar?
That will not be clear unless you have the microscope in your hands. If you can focus it by hand, it should be possible to get a motor to do it. Mounting the motor firmly and mechanically connecting it is the challenge.
If you use a v2 camera and the same stepper motors and stepper controller as an Openflexure Microscope then there should be no show-stopping issues. The range in steps for focusing will need adjustment. The camera images will need to be good so that there is a clear ‘best focus’ position. If different parts of the image are in focus at different adjustments of the focus knob, or if the sample is not thin and flat, then there is not a single focus position and no autofocus can work.
OpenFlexure software will only work with Pi Camera v2
The wider question is how are you planning to integrate the camera with the microscope mechanically?
What are you planning to do with the microscope that you could not do with a complete OpenFlexure Microscope?
So you will need to 3D print something to hold the camera. If you are using an eyepiece you need to manage to focus the picamera lens, via the eyepiece to focus on the image plane by the eyepiece as well as positioning the objective so that the sample is imaged onto the same plane. This is a bit more difficult than the way we normally design a digital microscope. You can find some more information on one of our Knowledge base pages.
If you wanted to do it without the eyepiece the camera would need to be somewhere within the tube so this might not be possible.
For the motor I would think that as long as you can design a bracket it should work as long as the motor has enough torque.
Its a shame you had issues sourcing the condenser. There are a number of vendors who are working on increasing access to components, but it is still a bit geographically constrained.
The condenser in the OpenFlexure illumination is designed to give high numerical aperture illumination for high resolution lenses. The microscope that you link to has quite a distance between the illumination and the sample, it looks to be a low NA illumination. That would be enough for use with a 20× objective, and it might be easier to make something like that to mount on the OpenFlexure platform than putting a motor and camera on a manual microscope.