Arducam_64mp autofocus via picamera2

  1. Where did you get the camera module(s)?
    ArduCam

  2. Model number of the product(s)?
    arducam_64mp

  3. What hardware/platform were you working on?
    Raspberry Pi 4B 8GB

  4. Instructions you have followed. (link/manual/etc.)
    How to use arducam_64mp & arducam_64mp FAQ
    Picamera2 - Arducam Wiki

  5. Problems you were having?

picam2.set_controls({“AfMode”: 1 ,“AfTrigger”: 0})

results in the following errors:

RuntimeError: Control AfMode is not advertised by libcamera
RuntimeError: Control AfTrigger is not advertised by libcamera

  1. The dmesg log from your hardware?

[ 7.953904] arducam_64mp: loading out-of-tree module taints kernel.
[ 7.976270] arducam_64mp 10-001a: Device found Arducam 64MP.
[ 7.977021] arducam_64mp 10-001a: Consider updating driver arducam_64mp to match on endpoints

  1. Troubleshooting attempts you’ve made?

Reinstalled from a fresh image multiple times.

  1. What help do you need?

I need to know why AfMode and AfTrigger controls aren’t being recognized by picamera2, and what the fix is. The camera works properly if these control settings are removed, albeit unfocused.

Thanks!

1 Like

New information:

If I downgrade to libcamera-dev 0.0.10 (from 0.0.11) this works! Is it just missing from the latest release?

1 Like

How do you downgrade?

Download the 0.0.10 version of libcamera-dev + libcamera-apps from Releases · ArduCAM/Arducam-Pivariety-V4L2-Driver · GitHub, copy to your pi, and then install them with “sudo apt install ./filename”

Honestly though, even with the camera accepting the commands the autofocus still seems somewhat unreliable. Does anyone have any advice? I’m using AfMode: 1, AfTrigger: 0

1 Like

This is so frustrating to read through.

I’ve been waiting forever to be able to use the 16 and 64mp cameras with python for the AF capabilities. I installed the 16mp, but don’t seem to be able to get autofocus to work. When I try and run camera16_test.py I get a RuntimeError: Control AfMode is not advertised by libcamera and now it looks like it could be that I installed 0.0.12 version of libcamera as it was the most recent.

1 Like

If you downgrade to 0.0.10 it should definitely work. The autofocus seems to work well on the 16mp camera and on the 64mp camera in 16mp mode. At 64 mp it’s very unreliable in my experience so far.

2 Likes

I’m not at my dev machine at the moment, but is there a way to set 16mp mode, autofocus, lock the focus and switch it to 64mp?

My plan has been to upgrade cameras in my two units so the lesser unit is 16mp and the other is 64mp.

I will try the downgrade to .10 this evening though, thank you.

Well, so much for that. Very frustrating as there is so much potential. I downgraded to 0.0.10 and confirmed with dpkg -l | grep libcamera, then when I ran the picamera2 script it showed a blurry zoomed in image and then crashed with just an error “Segmentation fault”

1 Like

Hi,
We released the new version of libcamera 0.0.12 yesterday. Maybe you can try it.

https://docs.arducam.com/Raspberry-Pi-Camera/Native-camera/Libcamera-User-Guide/

Actually, if you go up a few posts I had installed .12 originally, then tried to downgrade to get it working. Neither works for me.

1 Like

0.0.12 doesn’t expose the AfMode and AfTrigger commands either. Fail.

1 Like

With 0.0.12 and using the example here: Picamera2 - Arducam Wiki

The code crashes on this command: picam2.set_controls({“AfMode”: 0, “LensPosition”: 425})
With the error: RuntimeError: Control AfMode is not advertised by libcamera

Not sure how this code even gets put out there?

@Nighthawk I feel your pain (for a year now).

I also used a completely fresh install of the 64-Bit OS hoping that might be my issue. Both my existing install (32-bit) and my new 64-bit install have the same exact issue.

Being very honest here. I pre-ordered the 16mp AF and the 64mp AF wanting to use them. But I can’t even get them to work and I’ve had the 16mp for what has to be a year now. I’ve now had to order the Rpi v3 AF camera at only 12mp because I expect it to work and autofocus when plugged in.

I don’t know why I keep coming back thinking you have this working and ripping my stuff apart to test your cameras. Ok, I do know why, I’d like to offer them in my units. But I can’t go on and on getting one answer per night, testing what was said, only finding out it doesn’t work (yet again) and repeating this. I have a product, the electronics inside must function with the software. This does not.

Who are these being sold to, and if someone has them working I’m sure there are plenty of us that would love to see how you did it. For those who have not purchased the product yet, caveat emptor.

1 Like

yes, i agree, i am getting pretty frustrated ordering these cameras that have lots of potential for projects for my clients, but then in order to do the VERY BASIC functions of the cameras (take a picture, set the focus), i have to navigate through an ever changing labyrithing of them updating parts of their setup without including documentation on what changed, and Arducam breaking their own basic system setups.

I have been working with these cameras since November and still can’t get a reliable process going :frowning:

One basic thing they could do is have their installation/ startup guides point to a STABLE branch of their libraries that doesn’t change until all the documentation changes. This seems like a very basic need :frowning:

your own docs here are out of date with your own library update. Look, in the docs it says run this command

glowcake@glowcake:~ $ libcamera-still --autofocus

and then here is the error that comes out.

Closing Libcamera application(frames displayed 0, dropped 0)
Camera stopped!
Tearing down requests, buffers and configuration
Camera closed
ERROR: *** option '--autofocus' is ambiguous and matches '--autofocus-mode', '--autofocus-on-capture', '--autofocus-range', '--autofocus-speed', and '--autofocus-window' ***

please don’t update things if it breaks your documentation, or none of us will be able to use your cameras :frowning:

i can’t even do non-autofocus commands like the basic libcamera-still, because the camera will startup, (be blurry), and then freeze after a couple frames and do nothing. (this is on a brand new rpi4)

for other people to know at least for autofocus, apparently these commands are changed, and i hunted down the commands from RPI

so i ended up with a command like


libcamera-still --autofocus-mode auto --autofocus-speed fast -o testA.jpg -t 15000

now keep in mind this didn’t actually make my camera autofocus, nor did it result in taking a picture, but it at least opened the preview window and showed video for 15 seconds until it froze.

1 Like

Looking for updates here. Can someone at Arducam show us their install steps on a Rpi 4b+ with the 16 and 64mp cameras along with their python code successfully using the autofocus? It seems I am not the only person having issues.

I’d even be willing to host a Zoom session with others in this thread as we watch and learn from your development team.

2 Likes

Anyone have any updates? It has been days with no response? I need to get these stations upgraded and into production very soon if I am going to use your cameras instead of the Rpi V3.

2 Likes

Bump. @Arducam, we need to see some code that makes this thing work on your latest release!

Or just release your source code and we’ll make it work ourselves.

3 Likes

Hi everyone, I have the same issue with a raspberry pi 4B ( Raspbian OS 64 bit) and an arducam 16 MP autofocus camera module. With the new version of libcamera autofocus command doesn’t work. Is there a possibility to downgrade libcamera at previous versions in order to solve the problem? The “AfMode” was very useful

Well, my official Raspberry Pi v3 autofocus camera module arrived and works perfectly. Such a letdown that my units will have to utilize a 12mp autofocus than the 16 and 64mp autofocus cameras I wanted to use. I will continue to monitor this thread, and hopefully Arducam decides to solve the issue some day. I had hoped at least we would get a reply telling us they were actively working on it, but the silence is deafening.

Anyone have any updates? It is very important for me to have autofocus on 16 MP arducam camera module. I don’t know how to fix the problems, commands like:
“picam2.set_controls({“AfMode”: controls.AfModeEnum.Continuous})” or
“picam2.set_controls({“AfMode”: 2, “AfTrigger”:0})” don’t work. How can I solve?