This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Jetson Nano Setup Guide

A comprehensive guide to setting up your Jetson Nano.

Introduction

Welcome to the Jetson Nano Setup Guide! This guide will walk you through the process of setting up your Jetson Nano developer kit, from downloading the system image to configuring advanced usage scenarios.

Download Jetson Nano Image

Before you begin, you’ll need to download the system image for your Jetson Nano model:

Setting up the MicroSD with Ubuntu using balenaEther

  1. Go to this website
  2. Find and download Jetson Nano Developer Kit SD Card Image
  3. Download and install balenaEtcher
  4. Open balenaEthcer
    1. Select: Flash from file
    2. Select: jetson-nano-jp461-sd-card-image.zip
    3. Select the MicroSD card
    4. Flash!
  5. Place the MicroSD back into the jetson nano and start.

Fresh Install Setup Guide for Jetson Nano

Once your Jetson Nano board is up and running with Ubuntu Desktop, let’s kickstart the setup process by opening the terminal and following these steps:

Step 1: Update System

First, let’s ensure your system is up to date:

sudo apt update

Next, upgrade your Jetson Nano:

sudo apt upgrade -y

During the upgrade process, you may encounter prompts for configuration files.

Select Y to install the package maintainer’s version.

Configuration file '/etc/ld.so.conf.d/nvidia-tegra.conf'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** nvidia-tegra.conf (Y/I/N/O/D/Z) [default=N] ? Y

Again select Y to install the package maintainer’s version.

Configuration file '/etc/systemd/nv-oem-config-post.sh'
 ==> Deleted (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** nv-oem-config-post.sh (Y/I/N/O/D/Z) [default=N] ? Y

Additionally, if prompted to restart Docker, select YES.

Now, let’s perform a distribution upgrade:

sudo apt dist-upgrade -y

Step 2: Clean Up

Once the upgrade process is complete, let’s tidy up by removing old packages:

sudo apt autoremove -y

And finally, let’s clean up the cache:

sudo apt clean

Step 3: Reboot

After these maintenance tasks, it’s recommended to reboot your Jetson Nano for changes to take effect:

sudo reboot now

Install Useful Tools

Here are some essential tools that are handy for almost every project:

sudo apt install git nano curl wget -y

Uninstall LibreOffice

If you no longer need LibreOffice and want to reclaim some disk space, follow these steps to remove it:

sudo apt autoremove libreoffice* -y

This command will uninstall all LibreOffice packages from your system.

After removing LibreOffice, let’s clean up the residual files:

sudo apt clean

This command will clean the package cache, freeing up additional disk space.

Your system is now free of LibreOffice and optimized for your needs.

Installing pip and pip3

To install both pip and pip3, which are package managers for Python 2 and Python 3 respectively, run the following command:

sudo apt install python-pip python3-pip -y

This command will install pip for Python 2 and pip3 for Python 3 on your system.

You’re all set with pip and pip3 installed and ready to manage Python packages!

Installing Jetson Stats

To install Jetson Stats, a utility for monitoring and controlling NVIDIA Jetson devices, follow these steps:

sudo pip3 install -U jetson-stats

This command will install Jetson Stats and ensure that you have the latest version.

After installation, reboot your Jetson Nano to enable the jtop command:

sudo reboot now

Once your device has rebooted, reopen the terminal and type the following command to launch Jetson Stats:

jtop

This will open the Jetson Stats interface, allowing you to monitor various aspects of your Jetson Nano’s performance.

You’re now ready to utilize Jetson Stats for optimizing your Jetson Nano’s performance!

Configuring Jetson Fan to Start at Boot

To ensure your Jetson Nano’s fans start automatically at boot, follow these steps:

  1. Open and edit the rc.local file using the Nano text editor:
sudo nano /etc/rc.local

Paste the following lines into the file:

#!/bin/bash
sleep 10
sudo /usr/bin/jetson_clocks
sudo sh -c 'echo 255 > /sys/devices/pwm-fan/target_pwm'
exit 0
  1. Next, create and edit the rc-local.service file:
sudo nano /etc/systemd/system/rc-local.service

Insert the following content:

[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99

[Install]
WantedBy=multi-user.target
  1. Ensure the rc.local file has execute permissions:
sudo chmod +x /etc/rc.local
  1. Now, enable the rc-local service to run on system boot:
sudo systemctl enable rc-local
  1. Start the rc-local service:
sudo systemctl start rc-local.service

Your Jetson Nano’s fans will now start automatically at boot, ensuring optimal cooling performance.

Increase Swap Space

To increase the swap space on your Jetson Nano, follow these steps:

  1. Clone the resizeSwapMemory repository:
git clone https://github.com/JetsonHacksNano/resizeSwapMemory
  1. Navigate to the cloned repository:
cd resizeSwapMemory
  1. Set the entire swap memory size to 8GB:
./setSwapMemorySize.sh -g 8

This will ensure sufficient memory for the OpenCV installation.

OpenCV Installation Guide

Before installing OpenCV on your Jetson Nano, ensure that your system has sufficient memory by following the steps above to increase swap space if needed.

Next, download the OpenCV installation script:

wget https://github.com/Qengineering/Install-OpenCV-Jetson-Nano/raw/main/OpenCV-4-8-0.sh

Set the appropriate permissions for the script:

sudo chmod 755 ./OpenCV-4-8-0.sh

Run the installation script:

./OpenCV-4-8-0.sh

Once the installation is complete, you can remove the installation script:

rm OpenCV-4-8-0.sh

Finally, you can remove the dphys-swapfile:

sudo /etc/init.d/dphys-swapfile stop
sudo apt-get remove --purge dphys-swapfile

As a tip to save additional space, you can remove the OpenCV and OpenCV_contrib directories:

sudo rm -rf ~/opencv
sudo rm -rf ~/opencv_contrib

Congratulations! You’ve successfully installed OpenCV on your Jetson Nano.

Install Python 3.12 on Jetson Nano From Source

Python 3.12 brings new features, improvements, and optimizations to the language, making it desirable for developers who want to leverage the latest capabilities.

To install Python 3.12 on your Jetson Nano from source, follow these steps:

  1. Update your system’s package list:
sudo apt update
  1. Install the necessary dependencies for building Python:
sudo apt install wget build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev -y
  1. Create a directory for the Python source code and navigate to it:
mkdir ./python && cd ./python
  1. Download the Python source code. Replace 3.12.0 with the desired Python version:
wget https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tgz
  1. Extract the downloaded archive:
tar -xvf Python-3.12.0.tgz
  1. Navigate to the extracted directory:
cd Python-3.12.0
  1. Configure the build with optimizations enabled:
./configure --enable-optimizations
  1. Compile and install Python:
sudo make install
  1. After completing the installation, reboot your Jetson Nano:
sudo reboot now

After rebooting, Python 3 will be installed on your Jetson Nano from the source code. You can verify the installation by running python3 --version.

Install CrewAI on Jetson Nano

CrewAI is a powerful AI platform designed to assist with a variety of tasks. To install CrewAI on your Jetson Nano, follow these steps:

To install the main CrewAI package, which includes core functionalities, run the following command:

pip3 install crewai

If you also want to install the tools package, which includes a series of helpful tools for your agents, you can use the following command:

pip3 install 'crewai[tools]'

This command will install the main CrewAI package along with additional tools to enhance your CrewAI experience.

Once installed, you can start using CrewAI to develop and deploy AI solutions on your Jetson Nano.

Make test script for crewAI (Testing)

mkdir test_ai && cd test_ai
nano .env

and then add this

ANTHROPIC_API_KEY=your_anthropic_api_key

Now save and close nano

now let’s create our main.py

nano main.py

And then add this code below

import os
from dotenv import load_dotenv
from crewai import Agent, Task, Crew
from langchain.llms import Anthropic
from textwrap import dedent

# Load the API key from the .env file
load_dotenv()
ANTHROPIC_API_KEY = os.getenv("ANTHROPIC_API_KEY")

# Define a simple agent
class SimpleAgent:
    def __init__(self):
        self.Claude = Anthropic(anthropic_api_key=ANTHROPIC_API_KEY, temperature=0.7)

    def create_agent(self):
        return Agent(
            role="Simple Test Agent",
            backstory=dedent("""You are a helpful assistant."""),
            goal=dedent("""Your goal is to assist the user with their query."""),
            allow_delegation=False,
            verbose=True,
            llm=self.Claude,
        )

# Define a simple task
class SimpleTask:
    def __init__(self, user_query):
        self.user_query = user_query

    def create_task(self, agent):
        return Task(
            description=dedent(
                f"""
            Please assist with the following query:
            
            {self.user_query}
        """
            ),
            agent=agent,
        )

# Main function
if __name__ == "__main__":
    print("## Welcome to the Crew AI Test")
    print("-------------------------------")

    user_query = input(dedent("""Enter your query: """))

    simple_agent = SimpleAgent().create_agent()
    simple_task = SimpleTask(user_query).create_task(simple_agent)

    crew = Crew(agents=[simple_agent], tasks=[simple_task], verbose=True)
    result = crew.kickoff()

    print("\n\n########################")
    print("## Here is the result:")
    print("########################\n")
    print(result)

1 - step one

Required Items

  • Nvidia Jeton Nano
  • MicroSD card
  • Nocuafan
  • Powersupply 5w
  • Keyboard/mouse
  • Internet cable
  • External SSD or M2 harddrive
  • WiFi

NOTE: This will eb the simpel version as i will make an other guide how to update the iso with new kernel without breaking stuff. It has been a while that Nvidia has been updating there Jetson Nano iso.

Setting up the MicroSD with Ubuntu using balenaEther

  1. Go to this website
  2. Find and download Jetson Nano Developer Kit SD Card Image
  3. Download and install balenaEtcher
  4. Open balenaEthcer
    1. Select: Flash from file
    2. Select: jetson-nano-jp461-sd-card-image.zip
    3. Select the MicroSD card
    4. Flash!
  5. Place the MicroSD back into the jetson nano and start.

Setting up Ubuntu on Jetson Nano

  1. Powerup the Jetson Nano and let the device bootup fully

Make Jetson Nano ready

sudo systemctl enable ssh
sudo reboot now

check what versions we have

docker --version
python --version
python3 --version
git --version

Login with

sudo apt update && sudo apt upgrade
git clone https://github.com/jetsonhacksnano/bootFromUSB
cd bootFromUSB
./copyRootToUSB.sh -p /dev/sda1

Jetson Nano with CrewAI, Claude and OpenAI

Yes you read this right im gonna build an nice system with the jetson nano that use ai and camera

  • Face Reconiziion
  • Speeche Reconigzion

Items

BootfromUSB


LABEL primary
      MENU LABEL primary kernel
      LINUX /boot/Image
      INITRD /boot/initrd
      APPEND ${cbootargs} root=PARTUUID=b49df390-238c-4497-99a6-0643b9077530 rootwait rootfstype=ext4

LABEL secondary
      MENU LABEL secondary kernel
      LINUX /boot/Image
      INITRD /boot/initrd
      APPEND ${cbootargs} quiet root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0

Other

sudo nano /etc/apt/sources.list.d/nvidia-l4t-apt-source.list
# SPDX-FileCopyrightText: Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation and any modifications thereto. Any use, reproduction,
# disclosure or distribution of this material and related documentation
# without an express license agreement from NVIDIA CORPORATION or
# its affiliates is strictly prohibited.

deb https://repo.download.nvidia.com/jetson/common r32.7 main
deb https://repo.download.nvidia.com/jetson/t210 r32.7 main

IMX298 CAM Arducam

CSI Camera

sudo apt install libcanberra-gtk-module libcanberra-gtk3-module -y

pip tools needed

sudo pip3 install -U jetson-stats v4l2-fix

Advanced Usage Examples

1. Machine Learning Frameworks

Example: Install and configure popular machine learning frameworks like TensorFlow, PyTorch, or MXNet to leverage the Jetson Nano’s GPU for accelerated deep learning tasks.

Guide:

  • Follow the official documentation or community tutorials for each framework to install the required dependencies and set up GPU support.
  • Utilize pre-trained models or train custom models using datasets optimized for inference on edge devices.
  • Explore optimizations such as TensorRT integration for improved inference performance on the Jetson Nano.

2. Dockerized Applications

Example: Containerize applications using Docker to simplify deployment and manage dependencies on the Jetson Nano.

Guide:

  • Install Docker CE (Community Edition) on the Jetson Nano by following the official Docker documentation.
  • Create Dockerfiles to define the application environment and dependencies.
  • Build Docker images for your applications and run them in containers on the Jetson Nano.
  • Explore Docker Compose for orchestrating multi-container applications or deploying services with dependencies.

3. IoT Integration

Example: Integrate the Jetson Nano into IoT (Internet of Things) projects for edge computing and sensor data processing.

Guide:

  • Interface sensors or peripherals with the Jetson Nano using GPIO pins, I2C, SPI, or USB interfaces.
  • Develop applications to collect, process, and transmit sensor data to cloud services or local IoT gateways.
  • Implement edge AI algorithms for real-time analytics, anomaly detection, or predictive maintenance in IoT deployments.
  • Explore MQTT (Message Queuing Telemetry Transport) or other IoT protocols for communication between devices and cloud services.

4. Computer Vision Applications

Example: Build computer vision applications using libraries like OpenCV or specialized frameworks for object detection, image recognition, or facial recognition.

Guide:

  • Install OpenCV and other relevant libraries using package managers or by compiling from source.
  • Experiment with pre-trained models for tasks like object detection (YOLO, SSD), image classification (ResNet, MobileNet), or semantic segmentation (DeepLab, Mask R-CNN).
  • Capture and process video streams from cameras or video files for real-time analysis or surveillance applications.
  • Explore techniques for optimizing computer vision algorithms for performance on resource-constrained devices like the Jetson Nano.

5. Robotics Projects

Example: Use the Jetson Nano as the brain of robotic systems for tasks such as autonomous navigation, object manipulation, or drone control.

Guide:

  • Interface sensors, actuators, and motor controllers with the Jetson Nano to enable sensing and control capabilities.
  • Develop control algorithms using frameworks like ROS (Robot Operating System) or libraries like Jetson.GPIO for GPIO control.
  • Implement perception algorithms for environment mapping, obstacle detection, or localization using onboard sensors or external cameras.
  • Integrate AI models for tasks like object detection, gesture recognition, or path planning to enable autonomous behavior in robotic systems.

These advanced usage examples demonstrate the versatility of the Jetson Nano for a wide range of applications beyond basic system setup and configuration.

Troubleshooting

1. Network Connectivity Issues

Problem: Unable to connect to the internet or download packages during setup.

Solution:

  • Check the network connection by running ping google.com. If there is no response, ensure that the Jetson Nano is properly connected to the network and that the router or modem is functioning correctly.
  • Verify network settings, including IP configuration and DNS servers, by running ifconfig and cat /etc/resolv.conf.
  • If using Wi-Fi, ensure that the correct SSID and password are entered, and try restarting the network interface with sudo systemctl restart networking.

2. Package Installation Errors

Problem: Encounter errors while installing packages with apt.

Solution:

  • Check for any typos in the package names or repository URLs.
  • Ensure that the package repositories are configured correctly by inspecting /etc/apt/sources.list and files in /etc/apt/sources.list.d/.
  • If encountering dependency issues, try running sudo apt --fix-broken install to resolve them automatically.

3. Hardware Compatibility Issues

Problem: Certain hardware components or peripherals are not recognized or functioning properly.

Solution:

  • Verify that the hardware is compatible with the Jetson Nano by checking manufacturer specifications or community forums.
  • Check for any firmware updates or driver installations required for the hardware to work with the Jetson Nano.
  • Test the hardware on another device or platform to confirm functionality, if possible.

4. System Freezes or Crashes

Problem: The Jetson Nano freezes or crashes unexpectedly during operation.

Solution:

  • Check system resource usage using tools like top or htop to identify any processes consuming excessive CPU or memory.
  • Ensure that the power supply is adequate and stable, as insufficient power can cause system instability.
  • Check system logs for error messages or warnings that might indicate the cause of the issue (/var/log/syslog, /var/log/kern.log, etc.).

5. Display or Graphics Issues

Problem: Encounter issues with the display output or graphics acceleration.

Solution:

  • Verify that the display cable is securely connected to the Jetson Nano’s HDMI or DisplayPort interface.
  • Check display settings and resolution configuration using the system settings or xrandr command.
  • Ensure that the appropriate NVIDIA drivers are installed and configured correctly for graphics acceleration.

If you encounter any other issues not covered here, feel free to seek assistance from the Jetson Nano community forums or NVIDIA support resources.