Simegnew Alaba
5 min readAug 10, 2024

Installing Intel RealSense D435i Camera on Nvidia Jetson Orin NX: Step-by-Step Guide

Setting up the Intel RealSense D435i camera on an Nvidia Jetson Orin NX involves several steps, including downloading, building, and installing the necessary drivers and tools. Below, I will guide you through each step with explanations and the corresponding commands. At the end, you will find the complete script, which you can run in one go.

Important Note: USB-C Port Considerations

Before proceeding with the installation, it’s important to note that the USB-C port on the Nvidia Jetson Orin NX may not work reliably with the Intel RealSense D435i camera. To avoid potential connectivity issues, I recommend connecting the camera to a USB-3 hub. This will ensure stable communication between the devices during installation and operation.

This installation has been tested on Ubuntu 20.04 and 22.04.

Step 1: Initialize the Script and Handle Errors

Start by creating a Bash script to execute the installation. To ensure the script runs smoothly and exits on errors, include the following initialization commands:

#!/bin/bash -xe

# Locally suppress stderr to avoid raising not relevant messages
exec 3>&2
exec 2> /dev/null
con_dev=$(ls /dev/video* | wc -l)
exec 2>&3

This block initializes the script, handles error messages, and checks for connected video devices (such as cameras).

Step 2: Check for Connected RealSense Cameras

To avoid issues during the installation, you should disconnect any RealSense cameras:

if [ $con_dev -ne 0 ]; 
then
echo -e "\e[32m"
read -p "Remove all RealSense cameras attached. Hit any key when ready"
echo -e "\e[0m"
fi

If any cameras are connected, the script prompts you to remove them and waits for your confirmation to proceed.

Step 3: Display System Information

It’s useful to know your system’s Linux distribution and kernel version, especially for troubleshooting:

lsb_release -a
echo "Kernel version $(uname -r)"

Step 4: Update and Prepare the System

Before building the necessary library, update your package list and prepare a clean build directory:

sudo apt-get update
cd ~/
sudo rm -rf ./librealsense_build
mkdir librealsense_build && cd librealsense_build

This step ensures your package list is up-to-date and creates a fresh directory for building the Librealsense library.

Step 5: Check and Setup Swap Space

Building the Librealsense library can be resource-intensive. Ensure your system has enough swap space:

if [ $(sudo swapon --show | wc -l) -eq 0 ]; 
then
echo "No swapon - setting up 1Gb swap file"
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show
fi

If your system has no active swap space, the script creates a 2GB swap file to help manage memory during the build process.

Step 6: Install Required Development Packages

To compile and install the Librealsense library, install the necessary development packages:

echo Installing Librealsense-required dev packages
sudo apt-get install git cmake libssl-dev freeglut3-dev libusb-1.0-0-dev pkg-config libgtk-3-dev unzip -y

These packages include essential tools like git, cmake, and libraries required for building the Librealsense library.

Step 7: Download and Extract the Librealsense Source Code

Next, download the Librealsense source code from GitHub and extract it:

rm -f ./master.zip
wget https://github.com/IntelRealSense/librealsense/archive/master.zip
unzip ./master.zip -d .
cd ./librealsense-master

The script removes any existing master.zip, downloads the latest version of the source code, and extracts it into a new directory.

Step 8: Configure Udev Rules

To ensure the system recognizes the RealSense camera correctly, install the necessary udev rules:

echo Install udev-rules
sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/
sudo cp config/99-realsense-d4xx-mipi-dfu.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules && sudo udevadm trigger

These commands copy the udev rules to the appropriate directory and reload them so that they take effect immediately.

Step 9: Build and Install the Librealsense Library

Finally, configure, build, and install the Librealsense library:

mkdir build && cd build
cmake ../ -DFORCE_LIBUVC=true -DCMAKE_BUILD_TYPE=release
make -j2
sudo make install

This step compiles the Librealsense library with specific options and installs it on your system.

Step 10: Completion Message

To signify that the installation has completed successfully, the script outputs a message:

echo -e "\e[92m\n\e[1mLibrealsense script completed.\n\e[0m"

Now, the camera is ready to use.

Complete Installation Script

For convenience, here’s the entire script consolidated into one block. You can save this as installation_jetson.sh and run it directly:

#!/bin/bash -xe

# Locally suppress stderr to avoid raising not relevant messages
exec 3>&2
exec 2> /dev/null
con_dev=$(ls /dev/video* | wc -l)
exec 2>&3

if [ $con_dev -ne 0 ];
then
echo -e "\e[32m"
read -p "Remove all RealSense cameras attached. Hit any key when ready"
echo -e "\e[0m"
fi

lsb_release -a
echo "Kernel version $(uname -r)"

sudo apt-get update
cd ~/
sudo rm -rf ./librealsense_build
mkdir librealsense_build && cd librealsense_build

if [ $(sudo swapon --show | wc -l) -eq 0 ];
then
echo "No swapon - setting up 1Gb swap file"
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show
fi

echo Installing Librealsense-required dev packages
sudo apt-get install git cmake libssl-dev freeglut3-dev libusb-1.0-0-dev pkg-config libgtk-3-dev unzip -y

rm -f ./master.zip
wget https://github.com/IntelRealSense/librealsense/archive/master.zip
unzip ./master.zip -d .
cd ./librealsense-master

echo Install udev-rules
sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/
sudo cp config/99-realsense-d4xx-mipi-dfu.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules && sudo udevadm trigger

mkdir build && cd build
cmake ../ -DFORCE_LIBUVC=true -DCMAKE_BUILD_TYPE=release
make -j2
sudo make install

echo -e "\e[92m\n\e[1mLibrealsense script completed.\n\e[0m"

To run this script on your Nvidia Jetson Orin NX:

bash installation_jetson.sh

If the bash command does not work, use the following.

First, make the script executable with the following command:

chmod +x installation_jetson.sh

Then, run the script.

./installation_jetson.sh

This will execute all the steps automatically, setting up your Intel RealSense D435i camera on the Nvidia Jetson Orin NX.

Finally, run the following to check if the camera is working or not.

realsense-viewer

If everything goes well, you will see something similar.

Intel Realsense d435i camera viewer

Now, you can start streaming.

Follow me for more!

More Reading:

Intel® RealSense™ SDK 2.0 linux distribution.

Simegnew Alaba

Simegnew Alaba is a postdoctoral research associate specializing in computer vision, deep learning, and autonomous driving.