Arducam_64mp autofocus via picamera2

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?

I have not had any success, and Arducam has gone dark on any responses to us at this point. I also tried to send them a contact us form describing the issue on the morning of February 6th (last Monday) and have not received a response. While I have not received a response, I do encourage anyone having an issue with the 16 or 64mp autofocus to also send the issue to their contact us form here: Contact Arducam - Arducam

At some point they can’t continue to ignore the fact that their products are unusable, and would hopefully work to fix them.

1 Like

I’m sending the issue to arducam. I hope someone is able to solve the problem, maybe with a downgrade of libcamera to a previous version.

2 Likes

I solve the problem on my own. There was a missing part in the imx519.json file which you can find in “/usr/share/libcamera/ipa/raspberrypi”. You have to add the following part at the end of the file:

        {
            "rpi.af":
            {
                "ranges":
                {
                    "normal":
                    {
                        "min": 0.0,
                        "max": 10.0,
                        "default": 1.0
                    },
                    "macro":
                    {
                        "min": 3.0,
                        "max": 15.0,
                        "default": 4.0
                    }
                },
                "speeds":
                {
                    "normal":
                    {
                        "step_coarse": 1.0,
                        "step_fine": 0.25,
                        "contrast_ratio": 0.75,
                        "pdaf_gain": -0.02,
                        "pdaf_squelch": 0.125,
                        "max_slew": 2.0,
                        "pdaf_frames": 20,
                        "dropout_frames": 6,
                        "step_frames": 4
                    }
                },
                "conf_epsilon": 8,
                "conf_thresh": 16,
                "conf_clip": 512,
                "skip_frames": 5,
                "map": [ 0.0, 0, 15.0, 4095 ]
            }
        }

And then reboot. In this way autofocus will work. You can try easly with the command “libcamera-still -t30000” in Terminal and you can now set it in python script with the command: picam2.set_controls({"AfMode": 2}) or picam2.set_controls({"AfMode": controls.AfModeEnum.Continuous}). I hope everything is clear, let me know if it will work for you too.

1 Like

Thx for posting. I will give it a test right now and let others know if it works for me as well.

@Minesv what version of libcamera are you using? When I go into imx519.json file this is already posted at the end of it. I went line by line and confirmed that is in the json file on mine. I still am getting the error that AfMode is not advertised by libcamera.

I’m using the latest version, and I had to write this part in order to solve the problem, because I don’t have it. Maybe you can try to reinstall libcamera-dev and libcamera-app and reboot.