Failed to switch Arducam IMX519 cameras via I2C/GPIO on Pi Zero W Multi-Camera Adapter V2.2

Hi everyone. I’m stuck trying to switch cameras using i2c and gpio on my setup. I have a Pi Zero W with 4x imx519 Arducam cameras on a Multi Camera Adapter Module V2.2 (UC444), following the quick start guide on the Arducam docs page for the Multi Adapter Board. libcamera-still --camera * always works, no problem there. But the demo script that switches cameras over i2c doesn’t work - I’ve been using the previewOpencv.py script from the ArduCAM repo (the Multi_Camera_Adapter V2.2 python folder, around line 14). I also checked the GPIO output directly and the GPIO side seems fine. Any idea what I’m missing with the i2c switching?

Welcome! Just to clarify one important thing: on the Multiple camera board, i2c-based camera switching isn’t supported the same way you’re trying it. The i2c switching path is really meant for the HAT Kit. For the Multiple camera board itself, you switch each camera using the --camera flag on libcamera-still, like this:

libcamera-still -t 0 --camera 0
libcamera-still -t 0 --camera 1
libcamera-still -t 0 --camera 2
libcamera-still -t 0 --camera 3

The --camera flag (0-3) selects among the cameras on the Multiple camera board. If you specifically need i2c-based switching, that’s the HAT Kit: Multi-Camera Solution - Arducam Wiki

Thanks for the reply. The thing is, libcamera-still --camera already works for me, but my project needs the i2c-based demo script to run - that’s the whole reason I’m going down this path. I’m using the previewOpencv.py script from the Multi_Camera_Adapter V2.2 python folder in the ArduCAM repo. Is there a reason that script won’t switch cameras the way it should?

That specific repo/script - the Multi_Camera_Adapter V2.2 python previewOpencv.py that uses i2c to switch cameras - is no longer supported on our side. So that’s why it’s not behaving the way the older docs describe. For i2c channel switching you’d want to look at the quad imx519 kit and its documented i2c commands for switching composition mode:

Quad imx519 kit: 16MP Synchronized Quad-Camera Kit
i2c commands to switch channels: Quick Start Guide for Arducam CamArray HAT Kit - Arducam Wiki

The Multiple camera board itself should be switched with the --camera flag instead.

Now something even worse happened. Both of my camera adapter boards stopped working. I have a Multi Camera V2.1 Adapter for 4 cams (the one at arducam.com/product/multi-camera-v2-1-adapter-raspberry-pi) and an Arducam Camera Adapter Doubleplexer for 2 cams. They worked fine for a while, then both suddenly stopped working, even after I refreshed the Pi.

Can you clarify what “suddenly stopped working” actually looks like? For example, can libcamera-still still access the cameras that are connected to the Multiple boards? That will help narrow down whether it’s a camera detection issue or something else.

libcamera-still --camera * still works for all 4 cameras, but switching between them is way too slow. The demo code (i2c/gpio based) worked initially for both the 4-camera and 2-camera boards, then suddenly stopped even after I refreshed the OS. I also tried this bash script, but it always shows one specific camera no matter what:

#!/bin/sh
raspi-gpio set 7 op
raspi-gpio set 11 op
raspi-gpio set 12 op

i2cset -y 1 0x70 0x00 0x04
raspi-gpio set 7 dl #set the gpio17 low
raspi-gpio set 11 dl #set the gpio4 low
raspi-gpio set 12 dh #set the gpio12 low
echo “Choose camera A”
libcamera-still -o cameraA.jpg

i2cset -y 1 0x70 0x00 0x05
raspi-gpio set 7 dh #set the gpio17 low
raspi-gpio set 11 dl #set the gpio4 low
raspi-gpio set 12 dh #set the gpio12 low
echo “Choose camera B”
libcamera-still -o cameraB.jpg

Looking at that script - you’re driving the mux directly with raspi-gpio and i2cset to 0x70, but on the Multiple camera board the camera routing isn’t controlled the same way it is on the HAT kit. That raw i2cset/gpio approach is exactly the unsupported path I mentioned earlier, which is why it keeps showing the same camera. A couple of the comments in the script also look mixed up between the pin numbers (the gpio17/gpio4/gpio12 comments don’t line up cleanly), which is worth cleaning up, but the bigger issue is that this board doesn’t respond to that switching method. The supported switching path for this board is the --camera flag, which you’ve confirmed works - it’s just slower than you’d like.

Is there any chance we could do a live troubleshooting session? Maybe over zoom or WeChat? I’d really like to get this working. To recap: the demo code worked initially for both the 4-camera and 2-camera boards, then suddenly stopped even after I refreshed the OS, and the bash script above always shows one specific camera without changing to another.

I’ve sent you the remote support details through private message - please check your messages and we can schedule something. Just to set expectations: the i2c/gpio demo path for the V2.2 board is the unsupported one, so the live session would mostly be to confirm the --camera switching works reliably and, if you need i2c switching, look at the HAT kit route.

One more question before we schedule - does the HAT kit you mentioned actually support the Pi Zero? I’m on a Pi Zero W, so I need to know that before I go down that road. And I’m still seeing the same issue with the bash script always showing one camera.

To wrap up where things currently stand: the i2c/gpio camera switching you’re trying - both the previewOpencv.py demo and the raw i2cset/raspi-gpio script - is the unsupported path for the Multi Camera Adapter V2.2, since that repo is no longer maintained. The supported way to switch on this board is libcamera-still --camera 0 through 3, which works but is slower than you’d like. For actual i2c channel switching, the HAT kit (or the quad imx519 kit’s documented i2c commands) is the recommended route. I’ve passed along your Pi Zero compatibility question for the HAT kit and will confirm once I hear back. I’ve also sent the remote session details privately so we can dig into the live behavior further.