Multiple DepthAI per Host

You can find Demo scripts here. Learn how to discover multiple OAK cameras connected to your system, and use them individually.


Shown on the left is Luxonis OAK-1 which is actually plugged into an OAK-D-CM3.

So in this case, everything is running on the (single) Raspberry Pi 3B+ host which is in the back of the OAK-D-CM3.

Discovering OAK cameras

You can use DepthAI to discover all connected OAK cameras, either via USB or through the LAN (OAK POE cameras). The code snippet below finds all OAK cameras and prints their MxIDs (unique identifier) and their XLink state.

import depthai
for device in depthai.Device.getAllAvailableDevices():
    print(f"{device.getMxId()} {device.state}")

Example results for 2x DepthAI on a system:

14442C10D13EABCE00 XLinkDeviceState.X_LINK_UNBOOTED
14442C1071659ACD00 XLinkDeviceState.X_LINK_UNBOOTED

Selecting a Specific DepthAI device to be used

From the Detected devices(s) above, use the following code to select the device you would like to use with your pipeline. For example, if the first device is desirable from above use the following code:

# Specify MXID, IP Address or USB path
device_info = depthai.DeviceInfo("14442C108144F1D000") # MXID
#device_info = depthai.DeviceInfo("") # IP Address
#device_info = depthai.DeviceInfo("3.3.3") # USB port name
with depthai.Device(pipeline, device_info) as device:
    # ...

And you can use this code as a basis for your own use cases, such that you can run differing neural models on different OAK models.

Specifying POE device to be used

You can specify the POE device to be used by the IP address as well, as shown in the code snippet above.

Now use as many OAK cameras as you need! And since DepthAI does all the heavy lifting, you can usually use quite a few of them with very little burden to the host.

Got questions?

We’re always happy to help with code or other questions you might have.