I’m trying to get focus adjustment working on an Arducam Pi Camera with motorized lens (the adjustable focal length version with the 1m flex cable). It’s connected to a Raspberry Pi running OctoPrint. The video preview works fine, but I can’t adjust focus — the control just isn’t showing up anywhere. I’ve already enabled I2C via raspi-config.
Thanks for the details. Since the motorized lens uses I2C, can you check /boot/config.txt to make sure the i2c_vc and i2c_arm device tree params are enabled? raspi-config alone sometimes doesn’t add the right entries. If they’re missing, add them and reboot.
I appended this to /boot/config.txt:
if ! grep -Fxq "^#ArduCamFocus$" /boot/config.txt; then
sudo cat << end_of_file >> /boot/config.txt
#ArduCamFocus
dtparam=i2c_vc=on
dtparam=i2c_arm=on
end_of_file
fi
Then I ran it, enabled I2C with raspi-config, and rebooted. I’ve attached a screenshot of the current state.
Thanks. We actually updated the mjpeg-streamer and webcamd plugins, and the old setup isn’t enough for the focus control. The recommended path now is to flash the provided OctoPi image and follow the documented steps. I’ve sent you the image link through private message — please check your messages and try the update. Once it’s flashed, follow steps 3 through 8 here:
https://docs.arducam.com/Raspberry-Pi-Camera/Native-camera/OctoPrint/
Just to be clear, I didn’t flash that image because I’m actually running Klipper, not a standard OctoPi setup. I added the OctoPrint plugin on top of Klipper. OctoPrint does show the camera, but the focus control still doesn’t show up. I’m working in /home/docker/mjpg-streamer for the streamer.
Earlier I added the OctoPrint plugin from the Arducam docs link before realizing that was step 8, not step 3. Then I went back and ran the step 3 driver install commands, and moved on to step 5.2 (mjpg_streamer), which is where it failed — the plugin file only exists in the build directory.
Commands I’ve run:
- ./install_pivariety_pkgs.sh -p libcamera_dev
- ./install_pivariety_pkgs.sh -p libcamera_apps
- libcamera-still -t 5000 -o test.jpg -n
- ./mjpg_streamer -i “input_libcamera.so -h”
Logs:
docker@octoprint:~ $ ls /dev/video*
/dev/video0 /dev/video11 /dev/video13 /dev/video15 /dev/video18 /dev/video21 /dev/video23
/dev/video10 /dev/video12 /dev/video14 /dev/video16 /dev/video20 /dev/video22 /dev/video31
docker@octoprint:~ $ libcamera-still -t 5000 -o test.jpg -n
[86:35:41.932352935] [18120] INFO Camera camera_manager.cpp:297 libcamera v0.0.0+4367-ad9428b4
ERROR: *** no cameras available ***
docker@octoprint:~/mjpg-streamer $ pwd
/home/docker/mjpg-streamer
docker@octoprint:~/mjpg-streamer $ ./mjpg_streamer -i "input_libcamera.so -h"
MJPG Streamer Version: git rev: 888dc3d3990b0092f06da1c95f4928acb16cd7b2
ERROR: could not find input plugin
Perhaps you want to adjust the search path with:
# export LD_LIBRARY_PATH=/path/to/plugin/folder
dlopen: input_libcamera.so: cannot open shared object file: No such file or directory
To be honest, I haven’t used Klipper, so it’s going to be hard for me to debug this in your Klipper environment. The Arducam docs are written for OctoPrint Pi. My recommendation is to use a fresh/new SD card, flash the OctoPrint image from the guide, and follow the steps exactly. That avoids the Klipper-specific issues. The guide is here:
https://docs.arducam.com/Raspberry-Pi-Camera/Native-camera/OctoPrint/
I did flash the provided image to a new SD card and booted from it (hostname is arducam). Now the camera is detected — ov5647@36 is registered to Unicam /dev/media1 and ISP /dev/media0 — but libcamera-still fails. Also, ~/.octoprint only contains config.yaml, not the full set of octopi files like logs, so I’m starting to wonder if the image is actually a working OctoPi install.
Commands:
- ./install_pivariety_pkgs.sh -p libcamera_dev
- ./install_pivariety_pkgs.sh -p libcamera_apps
- ls /dev/video*
- libcamera-still -t 5000 -o test.jpg -n
- ls ~/.octoprint
Logs:
docker@arducam:~ $ ls /dev/video*
/dev/video0 /dev/video11 /dev/video13 /dev/video15 /dev/video18 /dev/video21 /dev/video23
/dev/video10 /dev/video12 /dev/video14 /dev/video16 /dev/video20 /dev/video22 /dev/video31
docker@arducam:~ $ libcamera-still -t 5000 -o test.jpg -n
[0:14:18.908595790] [3549] INFO Camera camera_manager.cpp:284 libcamera v0.1.0+246-9fb4698e-dirty (2024-02-27T06:28:07+00:00)
[0:14:19.037550046] [3554] WARN RPiSdn sdn.cpp:39 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[0:14:19.042677071] [3554] INFO RPI vc4.cpp:455 Registered camera /base/soc/i2c0mux/i2c@1/ov5647@36 to Unicam device /dev/media1 and ISP device /dev/media0
[0:14:19.042957487] [3554] INFO RPI pipeline_base.cpp:1169 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
Mode selection for 1296:972:12:P
SGBRG10_CSI2P,640x480/0 - Score: 3296
SGBRG10_CSI2P,1296x972/0 - Score: 1000
SGBRG10_CSI2P,1920x1080/0 - Score: 1349.67
SGBRG10_CSI2P,2592x1944/0 - Score: 1567
Stream configuration adjusted
[0:14:19.049616957] [3549] INFO Camera camera.cpp:1183 configuring streams: (0) 1296x972-YUV420 (1) 1296x972-SGBRG10_CSI2P
[0:14:19.049966905] [3554] ERROR V4L2 v4l2_videodevice.cpp:1047 /dev/video0[13:cap]: Unable to set format: Device or resource busy
ERROR: *** failed to configure streams ***
Actually the important part is right there in that log: /dev/video0 exists and ov5647@36 is registered to /dev/media1 and /dev/media0. That means the Pi sees the camera fine. The ‘Device or resource busy’ error just means something else is currently holding /dev/video0 — probably the webcam service/streamer that’s already running. Don’t let that stop you; it’s not a hardware or driver failure. Skip the standalone libcamera-still test and continue with the guide steps until the camera streams on the website. If the stream comes up, the focus control should be available there.