Motorized IMX477 not focusing manually on demand with keystroke

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

  2. Model number of the product(s)? UC-517 revD.3

  3. What hardware/platform were you working on? Raspberry Pi CM4 running 32bit Bullseye. CM4 mounted to Compute Module IO board. Camera connected to CM1 camera lane. I think the i2c device appear on i2c bus 10 and be position 10a based on reviewing i2cdetect when camera plugged in or out.

  4. Instructions you have followed. (link/manual/etc.)
    For original installation
    For 12MP IMX477 Motorized Focus Camera - Arducam Wiki

To run the python demo script

  1. Problems you were having?
    When I run the following autofocus or single manual focus position I have no problems, the camer is working and focusing
libcamera-still -t 0 --autofocus-mode continuous --tuning-file /usr/share/libcamera/ipa/rpi/vc4/imx477_af.json
libcamera-still -t 0 --autofocus-mode manual --lens-position 5 --tuning-file /usr/share/libcamera/ipa/rpi/vc4/imx477_af.json

But when I try to control position with the keyboard (focus on or out) on demand it does not move the lens. The image appears, but it is retaining whatever position the lens was last in
libcamera-still -t 0 --autofocus-mode manual -k --tuning-file /usr/share/libcamera/ipa/rpi/vc4/imx477_af.json

When I try to run the Python script to move the lens with up/down keys it is also not working. The image comes up on the screens, the arrows are working I can see the numbers incrementing or decreasing by 50, but no focus adjustment. Also when I take the picture the shades or red appear to be missing when taken through the Python script, but are normal when command line commands are used.

  1. The dmesg log from your hardware?

  2. Troubleshooting attempts you’ve made?

  3. What help do you need?

Please let me know some things I can try. I have tried modifying various aspects of the python script but nothing seems to work so it is obviously not correct.

Hi Mike,
To prevent the repeated message, I would like to know if you have emailed [email protected].
Because I met a same problem with yours this morning in the inbox.


Incase it is not clear to anyone else, when you type this command

libcamera-still -t 0 --autofocus-mode manual --tuning-file /usr/share/libcamera/ipa/rpi/pisp/imx477_af.json
# Use keyboard to control focus
# "f" trigger one-shot autofocus
# "a" add the lens position, "d" decrease the lens position, the minimum unit of step adjustment is 1
libcamera-still -t 0 --autofocus-mode manual -k --tuning-file /usr/share/libcamera/ipa/rpi/pisp/imx477_af.json


and try to increase or decrease focus using a or d keys, you need to press the enter key after you change position. This is not stated anywhere in the documentation, and is not clear or obviouls you should need to press the enter key.

The python script does not work and is not supported apparently. This is a shame, as it is way more useful that the command line interface.