16MP Autofocus Camera - set fixed number

  1. Where did you get the camera module(s)?
    from ArduCam web shop
  2. Model number of the product(s)?
    The 16MP Autofocus Camera
  3. What hardware/platform were you working on?
    Raspberry/Raspberry Pi Bullseye
  4. Instructions you have followed. (link/manual/etc.)
    official
  5. Problems you were having?
    I can’t set focus with fixed number in a (bash) script:
    v4l2-ctl -c focus_absolute=300
    fails
  6. The dmesg log from your hardware?
    unknown control ‘focus_absolute’

Any ideas?

Try this:

v4l2-ctl -c focus_absolute=300 -d /dev/v4l-subdev1

The focus motor and camera sensor are two different devices, so you need to specify it manually.

It works great! Thank you so much!

This solution did work just the other day for me. I had to set focus_absolute=1600 to get a clear picture inside of my 3D printer.
Today however, I get:
$ v4l2-ctl -c focus_absolute=1600 -d /dev/v4l-subdev1
Failed to open /dev/v4l-subdev1: Invalid argument
Has some recent OS package update changed this functionality?

Have you updated your kernel?

If you updated the kernel, what is your current kernel version?

uname -a 

Sorry to have necro’ed this old thread, and thank you for responding:

$ uname -a
Linux maxime 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux

That’s the same kernel version that I’ve been using for a month now.

The camera last responded successfully to the above v4l2-ctl command on July 3rd.

Maybe one or more package updates have affected this?

@OldGuyMeltsPlastic

Maybe it’s a driver issue or a hardware issue, I’m not sure yet.

Before, I need some more information

Please reboot your device and execute the following command:

wget -O arducam-camera-bug-report https://github.com/ketai-dhr/arducam-camera-bug-report/releases/download/tools/arducam-camera-bug-report
chmod +x ./arducam-camera-bug-report
./arducam-camera-bug-report

This will output an arducam-bug-report.txt in the current directory.

Please send this file to me via google cloud disk or similar platform or email ([email protected])

And if possible, please send me the hardware connection diagram.

Thank you for your cooperation.

Thanks Wong, this is a great command! I just used it and it works marvels.
v4l2-ctl -c focus_absolute=300 -d /dev/v4l-subdev1

I have a few technical questions:

  1. What are the units for the variable “focus_absolute”? Is it measured in micrometers?

  2. Was the entire stroke displacement divided by an arbitrary number? If so, what are the safe lower and upper limits for displacement without damaging the motor?

  3. Has anyone measured the velocity of displacement (in millimeters per millisecond)?

  4. How does v4l2-ctl work? Does it directly interface with low-level commands for controlling the motor?

5.How is this related to the Focal Length of the camera?
Regards!