How do I access each IMX519 camera individually on the Quad HAT using picamera2?

Hi all, I just bought the imx519 quad HAT kit and I’m trying to run it with the picamera2 library. What I want is to access each imx519 camera individually, like cam0 = picamera2(0), cam1 = picamera2(1), cam2 = picamera2(2). But in single channel mode, running i2cset -y 10 0x24 0x24 0x02 only lets one channel work at a time. Is there a way to access multiple channels individually?

Can you confirm your environment first? Which I2C bus and device address are you using on the HAT, and can you paste the exact snippet you’re using to open the cameras? That’ll help narrow this down.

Sure. The HAT is on I2C bus 10 with device address 0x24, using picamera2. My code was basically:

cam0 = picamera2(0)
cam1 = picamera2(1)
cam2 = picamera2(2)

and I tried single channel mode with i2cset -y 10 0x24 0x24 0x02, but only one channel ended up usable.

Thanks. The root cause here is that the imx519 quad HAT kit doesn’t expose each imx519 as an individually addressable camera. The four sensors are designed to be treated as a whole, so you can’t open them as separate cam0/cam1/cam2 devices, and the i2cset single-channel command will only ever switch one channel. So individual access isn’t possible on this kit.

Got it, that clears things up. So then is the UC-512 synchronous HAT kit the only adapter that can connect multiple imx519 cameras? I’m trying to find something that lets me use imx519 the same way I used my multi-imx708 adapter before.

Just so I’m on the same page - are you referring to the Arducam Multi Camera Adapter Module V2.2 for Raspberry Pi 4/3B/3B+ (the one for 5MP and 8MP cameras, compatible with Arducam MIPI cameras)? Also worth noting: the four imx519 cameras on the HAT kit are different from the individual imx519 camera modules, and the HAT’s cameras can’t be used directly on the Pi even with that Multi Camera Adapter.

Yes, that’s the adapter. Previously I connected several imx708 units by editing sudo nano /boot/config.txxt and adding dtoverlay=camera-mux-4port, cam0-imx708, cam1-imx708, etc. I was hoping to do the same with imx519.

Right, that matches the imx708 method. For multiple imx519 cameras, the setup we suggest is individual imx519 autofocus camera modules (fewer than 4) plus the Multi Camera Adapter. The individual modules are here: Arducam IMX519 autofocus camera module for Raspberry Pi and the adapter is here: Arducam Multi Camera Adapter Module V2.2 for Rasperry Pi Camera Module 3 12MP IMX708 / 5MP OV5647 / 8MP IMX219 / 12MP IMX477 Cameras

Okay, so to be direct: is the UC-512 synchronous HAT kit the only adapter that can connect multiple imx519 cameras, or is there an adapter that lets me use imx519 with the dtoverlay=camera-mux-4port approach the same way as imx708?

To summarize: the UC-512 is not the only option for multiple imx519. The quad HAT’s four sensors can’t be used as individual cameras on the Pi. If you want imx519 in the same camera-mux-4port dtoverlay style you used for imx708, the path is individual imx519 modules connected through the Multi Camera Adapter V2.2. That gives you the cam0/cam1/… mapping via /boot/config.txt, same concept as your imx708 setup.