Hi everyone. I’m using an Arducam 16 MP Autofocus Camera on a Raspberry Pi and autofocus just won’t work. libcamera-vid and libcamera-still capture fine at the full raw resolution (4654x3496, using --mode 4656:3496), but whenever I try autofocus it always fails.
With --autofocus-mode continuous (and also with auto) pressing ‘f’ makes the lens scan from position 0 all the way to 10, then the scan fails. It does this whether the target is about 2 m away or very close at ~11 cm. The image never comes out sharp and %afstate shows failed.
Thanks for the report. That scan-from-0-to-10-and-fail pattern is useful info. Can you post your full environment (Pi model, OS/kernel) and the exact libcamera parameters you’re using? Also, have you been able to get a sharp image any other way, e.g. by moving the focus manually?
Raspberry Pi OS 11 (Bullseye), kernel 5.10.92-v7l+
Arducam 16 MP Autofocus Camera
libcamera-vid / libcamera-still
I’ve been using these parameters:
–autofocus-mode continuous (also tried auto)
–mode 4656:3496
–info-text with %afstate, %lp and %focus
I also tried the Pivariety FocuserExample.py for manual control, and if I move the focus manually I can get a very sharp image. So the lens itself can focus — the libcamera autofocus scan is what’s failing.
Since manual focus works, the optics and focus motor are probably fine, so we need to see the full camera state. Could you generate a camera bug report and attach it here? Reboot first, then run:
Thanks, I’ve got the report. While I’m going through it, can you also check this thread about the 64MP autofocus over libcamera-still? It covers a similar scan-fails-from-0-to-10 situation and may be relevant to the 16MP behavior:
Nothing conclusive yet — I’m still analyzing the report. The key point so far is that the camera and focus motor work (manual focus is sharp), but the libcamera autofocus scan consistently fails from position 0 to 10 and never locks. That makes it likely to be an autofocus scan/parameter issue rather than a hardware fault. For now, the workaround is to keep using Pivariety FocuserExample.py for manual focus. I’ll follow up once I’ve had a chance to go through the bug report and compare it against the 64MP thread.