Unable to set manual focus on Arducam 64MP quad camera for barcode detection

Hi everyone, I’m building a barcode detection program using the Arducam 64MP quad camera kit with the HAT. I need to grab an image with a fixed focus within 3 seconds across all four cameras. The trouble is I can’t seem to set the autofocus mode to manual, and I can’t adjust the focus on any of the 4 cameras. It just keeps doing its own autofocus thing. Has anyone gotten manual focus working on this setup?

Welcome! To narrow this down, could you share a bit more about your environment? Are you driving the cameras with libcamera-still from the terminal, or through the libcamera Python/C API? Also, what have you tried so far and what error messages, if any, are you seeing?

Sure. My setup is an Arducam 64MP camera with the quad camera HAT on a Raspberry Pi. I’ve been testing with both libcamera-still and some Python through the libcamera bindings. Before posting I dug through a bunch of threads, including:

…but I couldn’t find a clear answer for locking manual focus across all four cameras.

Thanks. One thing to keep in mind: with the quad HAT each camera is a separate instance, so you need to target them individually (camera 0 through 3) when applying focus controls. Can you paste the exact command or script you’re running? Even if there’s no error, seeing the actual parameters will help. Also, is the behavior identical on all four cameras, or only some of them?

I tried something like:

libcamera-still --camera 0 --autofocus-mode manual --lens-position 4.0 -o test0.jpg

…and the equivalent for cameras 1 through 3. It doesn’t throw an error and it captures fine, but the result still looks like it autofocused, the focus isn’t locked where I set it. All four cameras behave the same. For barcodes I need the whole capture to finish in under 3 seconds, so letting autofocus hunt every frame isn’t really an option.

That’s helpful. Since the manual focus isn’t sticking, I’d point you to the official Libcamera User Guide section written specifically for the Arducam 16MP/64MP autofocus cameras. It covers the supported focus modes and the correct syntax for manual lens position on these sensors. The relevant section is here:

https://docs.arducam.com/Raspberry-Pi-Camera/Native-camera/Libcamera-User-Guide/#for-arducam-16mp64mp-autofocus-camera

Thanks, I’ll go through that section and test the exact parameters from the guide. If the lens position takes effect I should be able to lock focus and keep the capture loop under the 3 second limit.

To wrap up: the 64MP quad setup runs each camera as its own libcamera instance, so the manual focus settings from that guide need to be applied to each camera (0 through 3) individually. Try the focus mode and lens position values from the Libcamera User Guide section first, then check whether the capture time stays within your 3 second target. If the focus still won’t lock, let us know exactly which values you used and we’ll dig further.