Autofocus in Motorized Arducam IMX 477 not working

  1. Where did you get the camera module(s)?
    I bought it from Robu.in
    https://robu.in/product/arducam-12mp-imx477-motorized-focus-high-quality-camera-for-jetson-nano/

  2. Model number of the product(s)?

Arducam 12MP IMX477 Motorized Focus High Quality Camera for Jetson Nano/Xavier NX (SKU BO272)

  1. What hardware/platform were you working on?
    NVIDIA Jetson Nano 4 GB Developer kit

  2. Instructions you have followed. (link/manual/etc.)
    Official documentation

  3. Problems you were having?
    The main issue is that the Autofocus.py file isn’t actually working, it’s nt focusing by itself. I’m getting the following error : [sh: 1: i2cset: not found]

  4. The dmesg log from your hardware?
    [ 0.207819] DTS File Name: /var/jenkins_home/workspace/n_nano_kernel_l4t-32.6.1-arducam/kernel/kernel-4.9/arch/arm64/boot/dts/…/…/…/…/…/…/hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-p3448-0000-p3449-0000-b00.dts
    [ 0.416361] DTS File Name: /var/jenkins_home/workspace/n_nano_kernel_l4t-32.6.1-arducam/kernel/kernel-4.9/arch/arm64/boot/dts/…/…/…/…/…/…/hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-p3448-0000-p3449-0000-b00.dts
    [ 1.797101] imx477 7-001a: tegracam sensor driver:imx477_v2.0.6
    [ 2.099130] imx477 8-001a: tegracam sensor driver:imx477_v2.0.6
    [ 2.399519] imx477 8-001a: imx477_board_setup: error during i2c read probe (-121)
    [ 2.407078] imx477 8-001a: board setup failed
    [ 2.411558] imx477: probe of 8-001a failed with error -121
    [ 2.592478] vi 54080000.vi: subdev imx477 7-001a bound

  5. Troubleshooting attempts you’ve made?

  6. Re-installed the driver several times

  7. Installed the script from the following link s specified on the user manual which came with the camera (https://github.com/ArduCAM/MIPI_Camera/releases/download/v0.0.2/install_imx477.sh)

  8. What help do you need?
    I need help with the Autofocus, as it’s not working.

hi, @devpatel

What system version are you using? You can view it with the following command:

cat /etc/nv_tegra_release

install_imx477.sh is an outdated installation script, you can refer to the link below to reinstall it.

I am using L4T R32.6.1 Linux Tegra version
# R32 (release), REVISION: 6.1, GCID: 27863751, BOARD: t210ref, EABI: aarch64, DATE: Mon Jul 26 19:20:30 UTC 2021

I tried to install it with the script you provided but it shows the following output and autofocus is still not working

hi, @devpatel

Can you provide the command you executed?

Is your camera connected to CAM0 or CAM1?

Yes, I executed this exact command, I ran the Autofocus.py file which comes along with the driver

python Autofocus.py -i 7

My camera is connected to CAM0
image

hi, @devpatel

After testing, we can operate the focus normally here.

Our script uses the i2cset command, you can check if it is installed by typing i2cset on the command line.

Hi @yang
I tried to install i2c tools by following this link

https://elinux.org/Jetson/I2C

The command doesn’t work without sudo, hence I added sudo in the Focuser.py file in the line where i2c is set.
As a result, when I run the file Focuser.py , instead of i2cset not found, I got Error: write failed. Despite, the Autofocus started working but somehow it seems to be working at a macro level and farther objects are still very blurry. Does this have something to do with the range for focus?

Here is the sample video
[Video.mp4 - Google Drive](video showing the focus range)

hi, @devpatel

You can try manually twisting the lens and see the effect.

Thanks, The range of focus improved by manually twisting it, but our use case requires it to be automated using bash scripting. Is there any parameter to configure the autofocus with gstreamer pipeline? My current pipeline is as follows which I was using with IMX219 fixed focus camera :

gst-launch-1.0 nvarguscamerasrc sensor-id=0 num-buffers=$num_buffers ! 'video/x-raw(memory:NVMM), width='$width', height='$height', framerate='$fps'/1' ! nvtee ! omxh264enc bitrate=20000000 ! qtmux ! filesink location=Videos/"$dir_name"/"$vid_name"

hi, @devpatel

It is not possible to use gstreamer to control camera autofocus. A specific driver is required.

@yang Can you guide me regarding what driver is required? My use-case requires videos of certain intervals to be stored for the specified time. I have developed a bash script that stores videos for specified hours and intervals using the gstreamer pipeline I added before. To configure autofocus, what do you suggest, do you recommend a python script for this?

Hi,
In fact, the control interface of the vcm is released for users. We have a demo about how to control the vcm on imx519

Maybe you can refer to the demo above.

Hello,
Thank you for your response, I have already tried this demo. My issue got resolved, thanks for the support