Can't move Arducam motorized focus lens with Python +/- keys on Pi Zero 2W

Hi everyone, I’m stuck trying to change the lens position on my Arducam motorized focus camera. The sample Python code is supposed to let me move the focus with the + and - keys, but pressing those keys does nothing at all. The camera itself works fine through other commands, so it’s not completely dead - it’s just the keyboard focus control that won’t respond. Anyone else run into this?

Welcome to the forum. That sounds frustrating. Could you post the exact setup you’re running? Pi model, the camera version, which cable/adapter you’re using, and everything you’ve already tried? That’ll help us figure out whether it’s a wiring, driver, or code issue.

Sure. I’m using a Raspberry Pi Zero 2W (RPI0-2W) with the Arducam 5MP Autofocus Motorized Focus Camera (B0176) and the Arducam Pi Zero camera cable set - the 15-22 pin converter plus the ribbon flex extension cable. So far the camera is usable via commands, but the provided Python code won’t change the lens position with the + and - keys. Everything else seems to work fine.

Thanks, that narrows it down. The B0176 motorized focus camera does work on a Pi Zero 2W with the 15-22 pin cable, so the hardware side should be okay. The actual problem is that support for the old Python sample code for the motorized focus camera has been discontinued - manual focus position control is now done through the libcamera command instead. Have a look at the Arducam docs section on enabling the focus driver: For 5MP OV5647 Motorized Focus Camera - Arducam Wiki - then use libcamera commands to set the focus position manually. The old Python sample is no longer the supported path for this.

Thanks, I followed that and I can now move the focus manually through libcamera commands. Quick follow-up though - does this mean I can’t use Python at all for this camera? I have my own scripts I’d like to integrate focus control into, and it would be much easier if Python were still an option.

Python is still possible - you just need to write the code yourself. libcamera now supports manual focus control, so you can call that from your own Python code. What’s been dropped is the old sample Fourser.py, because it was based on the legacy stack. Since libcamera handles manual focus natively now, that old sample is no longer supported. So the summary is: write your own Python code that uses libcamera’s manual focus control, and don’t rely on the deprecated Fourser.py sample.