Connection and initialization

  • Power — a really good USB-C cable for power. It needs a strong power source
  • Data — Ethernet cable provided by Luxonis into the Ethernet port

The camera uses a link-local address for direct Ethernet communication. Set the network adapter to a manual IPv4 address:

169.254.10.112
255.255.0.0

Install oakctl — the Luxonis CLI tool for discovering and managing OAK devices:

bash -c "$(curl -fsSL https://oakctl-releases.luxonis.com/oakctl-installer.sh)"

Testing

Verify that the system recognizes the camera via USB:

lsusb
Bus 002 Device 005: ID 05c6:901d Qualcomm, Inc. OAK4-D R9

Then check that oakctl can discover the device:

oakctl list
+---+--------------+-------------+-------------+-------------+---------+-------+
| # | Serial       | Device      | Connection  | OS          | Agent   | Setup |
|   | Number       |             |             |             | Version |       |
+==============================================================================+
| 1 | 3063918513   | Luxonis,    | 169.254.154 | Luxonis OS  | 0.17.0  | OK    |
|   |              | Inc. OAK4-D | .93,        | RVC4 1.23.1 |         |       |
|   |              | R9          | usb:2-2     |             |         |       |
+---+--------------+-------------+-------------+-------------+---------+-------+
  1. For Ubuntu link
  2. Install
    sudo apt install ./viewer.deb
  3. Run
    oak-viewer

Connecting to the camera

0. If the camera is new, unlock it and set a password

oakctl device unlock

1. Connect

ssh root@<camera-ip>

On the PI 5 side

Camera should be visible here

rasp@raspberrypi:~ $ oakctl list
+---+---------------+-------------------------+--------------------------------------------------------+------------------------+---------------+-------------------+
| # | Serial Number | Device                  | Connection                                             | OS                     | Agent Version | Setup             |
+===================================================================================================================================================================+
| 1 | 3063918513    | Luxonis, Inc. OAK4-D R9 | 192.168.1.165, 2001:1ae9:103d:3200:46a9:2cff:fe30:6287 | Luxonis OS RVC4 1.27.1 | 0.18.3        | Setup (unadopted) |
+---+---------------+-------------------------+--------------------------------------------------------+------------------------+---------------+-------------------+
rasp@raspberrypi:~ $

If you want connect camera through USB.

sudo dhclient eth0

If nothing helps or the camera cannot be found, reflash the camera and start over. Also try on a compute PC with Ubuntu and Oak-Viewer. Raspberry does not have these options

import depthai as dai
import cv2

DEVICE_IP = "192.168.1.165"

device = dai.Device(dai.DeviceInfo(DEVICE_IP))

pipeline = dai.Pipeline(device)

cam = pipeline.create(dai.node.Camera).build(dai.CameraBoardSocket.CAM_A)

queue = cam.requestOutput((640,400), dai.ImgFrame.Type.BGR888i).createOutputQueue()

pipeline.start()

while True:
    frame = queue.get()
    img = frame.getCvFrame()

    cv2.imshow("OAK4", img)

    if cv2.waitKey(1) == ord("q"):
        break
#include <iostream>
#include <opencv2/opencv.hpp>
#include <depthai/depthai.hpp>

int main() {

    // Find available devices through the agent
    auto devices = dai::Device::getAllAvailableDevices();

    if(devices.empty()) {
        std::cerr << "No OAK devices found\n";
        return 1;
    }

    std::cout << "Connecting to: " << devices[0].name << std::endl;

    auto device = std::make_shared<dai::Device>(devices[0]);

    dai::Pipeline pipeline(device);

    auto cam = pipeline.create<dai::node::Camera>()
                   ->build(dai::CameraBoardSocket::CAM_A);

    auto queue =
        cam->requestOutput({640, 400}, dai::ImgFrame::Type::BGR888i)
            ->createOutputQueue();

    pipeline.start();

    while(true) {

        auto frame = queue->get<dai::ImgFrame>();
        if(!frame) continue;

        cv::imshow("OAK4 Stream", frame->getCvFrame());

        if(cv::waitKey(1) == 'q')
            break;
    }

    return 0;
}

Firmware

cat /etc/os-release

A. Via device update

oakctl device update --select --channel=stable
(depthai-env) foxcom@mass-defekt:~$ oakctl device update --select --channel=stable
Device Info:
  OS:            Luxonis OS RVC4 1.23.1
  Agent Version:    0.17.0 (rvc4)
  Architecture:        linux/arm64
  Model:        Luxonis, Inc. OAK4-D R9
  Serial Number:    3063918513
  Platform:        rvc4
  Connection:        127.0.0.1, usb:2-2
> Is this the device you want to update? Yes
? Select firmware to update to
> 1.27.1
  1.25.3
  1.24.0
  1.23.1
  1.23.0
  1.21.1
v 1.20.5

B. If threw an error. Flash the camera — downloads the latest update

oakctl device flash