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 have one CSI camera interface. And the latest Jetson Nano Kit released on January 2020, it brought out two CSI camera ports which allow to use two cameras at the same time for stereo vision. If you want to connect more cameras what should we do?
The multi-camera adapter board allows you 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 Nano 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 camera. All cameras are working simultaneously is not supported with this adapter board.
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 Nano.
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
Python Demo Code
Run the demo script which can be found from our GitHub repository.
sudo python JetsonNanoAdapterTestDemo.py
This demo will capture an image from each camera and save it to a local folder.
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)
Can not find the /dev/video0 device
- Check the all the cable connections.
- Make sure if the Camera Port D is connected to a camera, other camera port can be float without connecting a camera.
- Using command “i2cdetect -y -r 1” to make sure there are devices can be found at address 0x10 and 0x70.
- Some old version boards might not supported for Jetson Nano, please check your board version with us.