Arducam MIPI Camera Driver Framework

repository·master·Indexed 42 days ago

https://github.com/arducam/mipi_camera

Driver frameworks and tools for Arducam MIPI camera modules on Raspberry Pi and Nvidia Jetson platforms. Includes support for IMX219, IMX477, and Jetvariety series (IMX135, AR1820, AR0230, AR1335, OV9281, OV5647, OV2311). Provides utilities for autofocus, manual focus, PTZ control, and GStreamer pipelines for video streaming, MP4 recording, and JPEG snapshots.

Tokens
7.6K
Snippets
32
Records
52
Agent score
55%

What's inside Arducam MIPI Camera

  1. Overview of the Jetvariety driver framework

    master

    Jetvariety is a V4L2 kernel camera driver framework for the Nvidia Jetson platform. It is designed to support Arducam MIPI cameras that are not natively supported by Jetson hardware.

    Important Compatibility Notes:

    • Do NOT use this driver if you are using an IMX219 or IMX477 based camera module.
    • RAW Data Only: Jetvariety primarily supports RAW sensors and provides RAW image data without ISP (Image Signal Processor) support. Users are responsible for implementing software ISP in their own applications. For integrated ISP support, use Arducam OBISP cameras.
    • Hardware Requirement: This driver requires a Jetvariety adapter board, which is typically bundled with the camera breakout board.
  2. Choose the correct MIPI camera driver framework

    master

    Arducam provides different driver frameworks depending on your hardware platform and requirements. Select the framework that matches your device:

    • Raspberry Pi (Legacy): Use the MIPI Camera Driver for Raspberry Pi. This is a closed-source userland driver with no kernel dependency. It supports RAW sensors only, meaning users must implement software ISP (Image Signal Processing) to process RAW images.
    • Nvidia Jetson (Nano/Xavier NX): Use Jetvariety. This is a V4L2 kernel driver framework designed to support all Arducam MIPI cameras with a single driver, allowing users to switch cameras without changing drivers. It ensures software compatibility with V4L2-based applications.
    • Raspberry Pi (Modern/V4L2): Use Pivariety. Similar to Jetvariety, this is a V4L2 kernel driver that provides a single driver for multiple Arducam cameras, ensuring compatibility with OpenCV and other media players.
    • Raspberry Pi (libcamera): Libcamera-arducam is planned for future release.
  3. Supported cameras for Jetson Xavier NX driver

    master

    This driver is part of the Arducam Jetvariety series for Jetson Xavier NX. It only supports specific camera modules. Ensure your hardware matches one of the following SKUs:

    • IMX135 (SKU: B0213)
    • AR1820 (SKU: B0216)
    • AR0230 (SKU: B0247)
    • AR1335 (SKU: B0245)
    • OV9281 (SKU: B0223)
    • OV5647 (SKU: B0215)
    • OV2311 (SKU: B0221, B0220, or B0264)

    Note for OV2311 users: If the OV2311 fails to retrieve data normally on the first attempt, please try running the application again.

  4. Use Jetvariety for non-native MIPI cameras

    master

    Jetvariety is a V4L2 kernel camera driver framework designed for Nvidia Jetson. It allows users to use Arducam MIPI cameras that are not natively supported by the Jetson platform.

    Key benefits:

    • Unified Driver: A single-camera driver supports multiple different Arducam cameras, allowing you to switch hardware without changing the driver.
    • Software Compatibility: Designed for V4L2 software compatibility on Jetson boards.
    • Example: The Arducam_OBISP_MIPI_Camera_Module utilizes this driver.
  5. Configure a Multi-Camera Solution via GPIO

    master

    Using Arducam multi-camera adapter boards, you can connect up to 4 cameras to a single CSI port. On Jetson Nano or Xavier NX development kits (which have two CSI ports), you can connect a maximum of 8 cameras using two adapter boards.

    Constraint: Even though multiple cameras are connected to a single CSI port, only one camera can be active at a time. To switch between cameras, you must use GPIO control.

  6. Install Python 2.7 dependencies for Stereo Camera HAT

    master

    To run the stereo depth demo using Python 2.7, install the required system libraries and Python packages. This setup includes stereovision for stereo processing and matplotlib for visualization.

    # Install pip for Python 2.7
    wget https://bootstrap.pypa.io/get-pip.py && sudo python get-pip.py
    
    # Install Python packages
    sudo pip install stereovision
    sudo pip install matplotlib
    
    # Install system dependencies
    sudo apt install libpng-dev
    sudo apt install libfreetype6-dev
    sudo apt install python-gi-cairo
  7. Use native Jetson camera drivers for IMX219 and IMX477

    master

    Jetson Nano and Xavier NX provide native support for IMX219 and IMX477 sensors with optimized ISP performance.

    • IMX219: The driver and device tree are pre-installed in the official Jetson image. If using an Arducam motorized focus IMX219 module, use the software scripts located in the IMX219 folder to control manual or autofocus functions.
    • IMX477: The driver is not pre-installed. You must manually install the driver package from the IMX477 folder to replace the default IMX219 driver. The folder contains packages compatible with different kernel versions.
  8. Install SMBus dependencies for Python 2 and Python 3

    master

    The PTZ camera control scripts require the smbus library to communicate over I2C. Depending on your Python environment, use the corresponding command:

    • For Python 2: sudo apt-get install python-smbus
    • For Python 3: sudo apt-get install python3-smbus
    sudo apt-get install python-smbus
    sudo apt-get install python3-smbus
  9. Configure user permissions for Jetson GPIO

    master

    The Jetson GPIO Library requires specific user permissions and groups to function correctly. Follow these steps to configure your system:

    1. Create a gpio user group and add your current user to it:
      sudo groupadd -f -r gpio
      sudo usermod -a -G gpio $USER
    2. Install the custom udev rules by copying the provided rules file to the system directory:
       ```bash
    sudo cp /opt/nvidia/jetson-gpio/etc/99-gpio.rules /etc/udev/rules.d/
    1. Apply the new rules by reloading udev or rebooting the system:
      sudo udevadm control --reload-rules && sudo udevadm trigger

    OR

    sudo reboot

    sudo groupadd -f -r gpio
    sudo usermod -a -G gpio $USER
    sudo cp /opt/nvidia/jetson-gpio/etc/99-gpio.rules /etc/udev/rules.d/
    sudo udevadm control --reload-rules && sudo udevadm trigger
  10. Install the Jetson Nano driver using the automatic script

    master

    The driver for Jetson Nano has been moved to the official releases. For L4T (Linux for Tegra) versions 32.4.3 and later, it is recommended to use the automatic installation script provided by Arducam to ensure correct setup.

    Detailed instructions for the automatic installation can be found in the Arducam documentation.

    https://www.arducam.com/docs/camera-for-jetson-nano/mipi-camera-modules-for-jetson-nano/driver-installation/#2-automatic-driver-installation--only--for-l4t3243-and-after-versions