Jetson Cameras

  1. Home
  2. Docs
  3. Jetson Cameras
  4. Multiple cameras on the Jetson
  5. Arducam Multi-Camera Adapter on the Jetson Nano & Xavier NX

Arducam Multi-Camera Adapter on the Jetson Nano & Xavier NX

Introduction

NVIDIA Jetson Nano Developer Kit is a small, powerful computer and low-cost embedded board that lets you run multiple neural networks in parallel. The first Jetson Nano kit was released in May 2019, which only has one CSI camera interface. And the latest Jetson Nano Kit released in January 2020, brought out two CSI camera ports that allow using two cameras at the same time for stereo vision.

The NVIDIA Jetson Xavier NX Developer Kit includes a power-efficient, compact Jetson Xavier NX module for AI edge devices. It benefits from new cloud-native support and accelerates the NVIDIA software stack in as little as 10 W with more than 10x the performance of its widely adopted predecessor Jetson TX2.

If you want to connect more cameras what should we do?

The multi-camera adapter board allows you to connect 4 cameras to a single CSI interface and it was original designed for Raspberry Pi. And now we also made it working on Jetson as well. The basic principle of this multi-camera adapter board is multiplex 4 MIPI cameras and output one camera image data at a time. You have to switch between cameras when you fetch an image from one of the cameras. All cameras are working simultaneously are not supported with this adapter board.

Hardware

V2.2

Install the dependency

The multi-camera adapter board requires the GPIO pins to do the channel selection, so we have to install the GPIO library support for Jetson.

sudo pip install Jetson.GPIO 

Set User permissions

Setting User Permissions In order to use the Jetson GPIO Library, the correct user permissions/groups must be set first.

Create a new GPIO user group. Then add your user to the newly created group.

sudo groupadd -f -r gpio
sudo usermod -a -G gpio $USER

Install custom udev rules by copying the 99-gpio.rules file into the rules.d directory:

sudo cp /opt/nvidia/jetson-gpio/etc/99-gpio.rules /etc/udev/rules.d/ 

Please note that for the new rule to take place, you may either need to reboot or reload the udev rules by issuing this command:

sudo udevadm control --reload-rules && sudo udevadm trigger
sudo reboot

Python Demo Code

Run the demo script which can be found from our GitHub repository.

git clone https://github.com/ArduCAM/MIPI_Camera.git
cd MIPI_Camera/Jetson/Multi-Camera Adapter/
sudo python Multi-Camera-Adapter-Demo.py  -i 1 

-i use to set i2c bus, for Jetson Nano it is 1, for Jetson Xavier NX it is 8.

This demo will preview each camera and get one snapshot. Then stored it to local path.

import RPi.GPIO as gp # sudo pip install Jetson.GPIO #https://pypi.org/project/Jetson.GPIO/#description
import os

gp.setwarnings(False)
gp.setmode(gp.BOARD)

gp.setup(7, gp.OUT)
gp.setup(11, gp.OUT)
gp.setup(12, gp.OUT)

def main():
    print"Start testing the camera A"
    i2c = "i2cset -y 1 0x70 0x00 0x04"
    os.system(i2c)
    gp.output(7, False)
    gp.output(11, False)
    gp.output(12, True)
    capture(1)
    print"Start testing the camera B"   
    i2c = "i2cset -y 1 0x70 0x00 0x05"
    os.system(i2c)
    gp.output(7, True)
    gp.output(11, False)
    gp.output(12, True)
    capture(2)
    print"Start testing the camera C"
    i2c = "i2cset -y 1 0x70 0x00 0x06"
    os.system(i2c)
    gp.output(7, False)
    gp.output(11, True)
    gp.output(12, False)
    capture(3)
    print"Start testing the camera D"
    i2c = "i2cset -y 1 0x70 0x00 0x07"
    os.system(i2c)
    gp.output(7, True)
    gp.output(11, True)
    gp.output(12, False)
    capture(4)

def capture(cam):
    #cmd = "raspistill -o capture_%d.jpg" % cam
    cmd = "nvgstcapture-1.0 -A --capture-auto -S 0 --image-res=3 --file-name=capture_%d.jpg" % cam
    os.system(cmd)

if __name__ == "__main__":
    main()

    gp.output(7, False)
    gp.output(11, False)
    gp.output(12, True)

Note

Since the Multi-Camera Adapter cannot switch channels while the camera is running when used on Jetson, it cannot achieve the same effect as the Raspberry Pi (cannot switch between multiple cameras in real-time), so we did not provide the corresponding OpenCV example.

Troubleshooting

Can not find the /dev/video0 device

  1. Check the all the cable connections.
  2. Make sure if the Camera Port D is connected to a camera, other camera port can be float without connecting a camera.
  3. Using command “i2cdetect -y -r 1” to make sure there are devices can be found at address 0x10 and 0x70.
  4. Some old version boards might not supported for Jetson, please check your board version with us.

Supported Resolutions for Nvgstcapture-1.0:

640×480/1280×720/1920×1080/2104×1560/2592×1944/2616×1472/3840×2160/3896×219/4208×3120/5632×3168/5632×4224
and more information you can refer to here.

Was this article helpful to you? Yes 3 No 2