Unable to Focus Raspi Camera Module v2

Camera model

Raspberry Pi Camera Module V2

What is the problem?

Unable to get camera in focus

What did you already try to solve it?

Multiple combinations of options in libcamera.conf, including the following:

OPTIONS='--camera-options="AfMode=2" --camera-options="AfRange=2"'
and also
OPTIONS='--camera-options="AfMode=0" --camera-options="LensPosition=5"'

Camera is placed 20 cm from print head, so LensPosition=5 should equate to 20 cm.

and many other combinations. Nothing seems to affect the focus.

Have you tried running in safe mode?


Did running in safe mode solve the problem?


Systeminfo Bundle

You can download this in OctoPrint's System Information dialog ... no bundle, no support!)

octoprint-systeminfo-20240508100138.zip (1.8 MB)

Additional information about your setup

OctoPrint version, OctoPi version, printer, firmware, browser, operating system, ... as much data as possible

The snappy web interface for your 3D printer
Version 1.10.0

About OctoPi-UpToDate
The up-to-date version of OctoPi
Build 2024.04.25.103001 with "camera-streamer", based on OctoPi 1.0.0, running on Raspberry Pi 3 Model B Rev 1.2

About OctoPi
The ready-to-go Raspberry Pi image with OctoPrint
Version 1.0.0, running on Raspberry Pi 3 Model B Rev 1.2

RPi Cam V2 does not have autofocus, the lens is fixed in position.

So there's no way to focus it?

Well, just an FYI, I figured out how to focus it. There is this:

Little wheel that came with the camera, but no mention as to what it was. Turns out it's a focusing tool. I was able to get it pretty well into focus.