Arducam 64MP autofocus issues in sunlight and night with window reflections on Raspberry Pi 4

Having a weird autofocus issue with an Arducam Pi Hawk Eye 64MP. It’s doing a timelapse looking out a window, and the glass is only about 2-3 inches from the lens. Most of the time autofocus is okay, but when the sun shines straight into the lens, or at night when the only things in the frame are points of light, it hunts and ends up out of focus. I also get faint reflections from the inside of the window showing up. Is there any way to just keep the focus fixed at infinity?

Are you running the Arducam build of libcamera, or the stock Raspberry Pi one? The 64MP Hawk Eye really needs the Arducam libcamera build plus the right dtoverlay, otherwise the autofocus does strange things in exactly the kinds of scenes you’re describing. Can you post your exact capture command and platform details? That’ll help narrow it down.

Platform is a Raspberry Pi 4, and I’m using libcamera-still for the captures. Honestly not sure which libcamera build is on there - I just used what was on the card. The command runs every 20 seconds:

libcamera-still --width 2288 --height 1736 --rotation 180 -o “/media/pi/Samsung USB/img/$(date +%s).jpeg”

The camera is looking out the window, roughly 2-3 inches from the glass.

Got it. First thing I’d do is make sure you’re on the Arducam libcamera build, not the stock one. Follow the getting-started section of the Arducam Libcamera User Guide (https://docs.arducam.com/Raspberry-Pi-Camera/Native-camera/Libcamera-User-Guide/#getting-started) and the Quick Start Guide for the Hawk Eye 64MP (Quick Start Guide - Arducam Wiki).

Then open the config file and make sure the overlay is actually enabled. If you see:
#dtoverlay=arducam-64mp
change it to:
dtoverlay=arducam-64mp
and reboot the Pi so it takes effect.

If you still have trouble after that, I’ve sent you a small bug report script via private message. After a reboot, run it and PM me the arducam-bug-report.txt it generates so I can look at the camera state.

Okay, after getting the Arducam build and overlay sorted, I switched to manual focus with:

–autofocus-mode manual --lens-position 5.8

The misfocusing under bright sun / night points of light is gone now, which is great. But I picked 5.8 just because it looked close in the images. I have no idea if that’s actually at infinity for this lens. Is there an exact lens-position value for infinity on the 64MP? I can PM you the live timelapse feed if that helps.

There isn’t one exact value I can give you for infinity on the 64MP. The optimal lens position varies from unit to unit, so 5.8 might be close for yours but it’s not guaranteed to be true infinity. The good news is you can bracket it pretty quickly.

Start from 5.8, capture a test image or short video. Then move the lens position a small step up or down and capture again. Compare the two. If the second is sharper, keep going in that direction and keep comparing after each step. Once you see it get softer again, you’ve passed the best point, so reverse and narrow it down. Repeat until you find the position that gives you the focus you want for your scene.

So the workaround right now is: stay on the Arducam libcamera build with dtoverlay=arducam-64mp enabled, use --autofocus-mode manual, and determine the lens position empirically rather than relying on a fixed infinity number. That should keep focus stable in the sun and point-light conditions you described.