Hi everyone, I’m stuck with a focus problem on my Arducam 64MP Hawkeye AF camera and hoping someone here has run into this before. The camera will not hold focus at all. I need to capture a cylindrical object (diameter 5-30mm, height 10-1200mm) at a working distance of 5-15cm, and I need the whole object in one frame at one time. My plan is to stack several of these cameras vertically, each one covering about 10-20mm of the object, then stitch the images into a single picture. The problem is that the autofocus keeps moving and I can’t lock it in one place. Also, I need at least 16MP resolution per frame, so the 12MP option that was suggested to me isn’t going to work.
Thanks for the details. Before we dig into the focus behavior, can you tell us the exact platform and camera model you’re running? Also, what OS and how the camera is connected. That’ll help narrow down which control paths are actually available.
Sure. Platform is a Raspberry Pi 4B, product series is Raspberry Pi Cameras, model is the 64MP Hawkeye AF.
Got it. Just to make sure we’re talking about the same thing: you said you want to control focus, not zoom. Can you describe exactly what you’re trying to do? For example, do you want to move the lens to a specific position once and keep it there, or do you need to change it per shot?
I want three things: 1) set a specific focus position, 2) lock the focus in a static position so it doesn’t move, and 3) turn off the continuously running autofocus. The AF keeps re-focusing and shifting, which ruins the stitching because each camera ends up at a slightly different focus.
That makes sense for a stitching setup. On this camera there’s a known quirk where a lot of the examples and docs that mention “focus” are actually driving the zoom/lens-position, not the true focus motor. In the code the parameter you set is literally called “lens-position”. Can you check which examples you’ve been using so far, and what value names you’re passing?
That matches what I found. In the documentation and examples, anything labeled “focus” actually controls zoom. The code parameter for setting it is called “lens-position”, and when I follow the instructions that say “focus” they move the zoom/lens-position instead. So I’m not actually controlling focus at all.
Right, that’s the trap. Have you tried anything lower level to reach the real focus motor? For example, the driver commands directly, i2c access, or v4l2-ctl? If you list the available v4l2 controls on the device, does anything other than the lens-position show up?
I went through a bunch of forum examples, looked at the driver commands, and also tried controlling it over i2c directly. With v4l2-ctl the only focus-related control I can see is “focus_absolute”, but that’s lens-position again, i.e. zoom. I still can’t get any access to the actual focus control. There’s just no path to it that I can find.
Thanks for checking all of that. I’ve dug into this and unfortunately the motorized trajectory of this camera cannot be fully controlled. There is no command available to lock the focusing motor into a specific position, and no commands to disable the continuous autofocus either. So what you’re seeing isn’t a missing flag or a wrong example name - it’s a hardware/firmware limitation on the 64MP Hawkeye AF.
So just to confirm, there’s really no way to set and hold a fixed focus on this camera? Not through v4l2, i2c, or the driver? I’ve spent a while on this and I want to be sure I’m not missing some hidden control.
Correct. The focusing motor on the 64MP Hawkeye AF cannot be locked to a specific position, and no instructions or commands exist to control the true focus (as opposed to the zoom/lens-position). This is the root cause: the autofocus motor is simply not fully user-controllable on this model.
That’s disappointing but at least it’s clear now. So what’s the alternative for a use case like mine where the focus has to stay absolutely static?
For applications that need a static, controllable focus, the recommendation is to use a manual focus camera with an M12 or CS lens instead. Those let you physically set the focus and it stays put, with no autofocus motor fighting you. Autofocus cameras in general aren’t a good fit for this kind of fixed multi-camera stitching setup. Bottom line: the 64MP Hawkeye AF’s autofocus motor is not fully user-controllable and can’t be locked to a fixed focus position, so a manual focus M12 or CS lens camera is required for what you’re trying to do.