Maker.io main logo

Getting Started with the NVIDIA Jetson Nano - Part 1: Setup

2019-12-10 | By ShawnHymel

License: Attribution Jetson

In June, 2019, NVIDIA released its latest addition to the Jetson line: the Nano. The Nano is a single-board computer with a Tegra X1 SOC. Essentially, it is a tiny computer with a tiny graphics card. The Nano is capable of running CUDA, NVIDIA’s programming language for general purpose computing on graphics processor units (GPUs). With CUDA, we can run a host of machine learning algorithms that have been optimized for GPUs.

Remember that the Jetson Nano is an embedded device, which means it will likely be slower than any modern desktop or laptop computer you might encounter. As a result, it’s not intended to be used as a development system to train new machine learning models. We recommend investing in a newer graphics card or rent time from a cloud-based GPU server if you wish to train deep models from scratch. 

That being said, it can be useful to deploy a model to the Nano if you wish to predict or classify things like images, sounds, etc. As the Nano is an embedded device, it can be easily integrated into other devices, such as a robotic chassis.

Here is a video if you would like to watch the setup:

 

Required Accessories

Jetson Nano - Accessories

While the Jetson Nano packs some amazing hardware in a small package, it does not contain everything you need to get started. You will need a few accessories:

  • Power Supply - NVIDIA recommends a 5V, 2A USB power supply. This will quickly fail if you do any real processing, so I recommend a 5V, 4A power supply with a barrel jack.
  • You will need a jumper if you’re using a power supply with a barrel jack.
  • MicroSD Card - The minimum size is 16 GB. If you plan to download training data or more than a couple of models, you’ll find that you run out of space very quickly. Therefore, I recommend a 32 GB (or more) microSD card with at least a UHS-1 speed rating.
  • WiFi adapter - The Nano does not have onboard WiFi or Bluetooth. As a result, you will need to provide your own network card. There is an M.2 (Key-E) slot under the Nano itself, so something like the Intel Dual Band Wireless-Ac 8265 W/Bt (Intel 8265NGW) is reported to work. I happen to have an old Edimax EW-7811Un lying around, so I’ll be using that instead.
  • Like the Raspberry Pi, you will need a monitor, keyboard, and mouse (at least for the initial setup).
  • A webcam (I’m using a Logitech c920) or CSI camera (the Raspberry Pi Camera Module V2 supposedly works) is necessary if you wish to capture or own images or play with the demos.
  • I recommend getting a 5V 40x40 mm fan to mount on top of the heatsink if you plan to really push the Nano. Something with a 4-pin connector will work the best (as these will offer PWM control, which means the Nano can control the speed when needed).

Download and Burn Image

Download the latest Jetson Nano Ubuntu image from here: https://developer.nvidia.com/embedded/learn/get-started-jetson-nano-devkit#write. At the time of this writing, the latest image was r3223 (based on Ubuntu 18.04).

Use a program like balenaEtcher to write the image file to your microSD card.

Connect Accessories

Insert the microSD card into the SD card slot found just underneath the Jetson Nano main card (not the motherboard).

Insert SD card into Jetson Nano

If you are using a power supply with a barrel jack adapter, you will need to put a jumper on the J48 header.

Jumper on J48 on Jetson Nano

Connect the rest of the accessories to your Jetson Nano:

Connect accessories to Jetson Nano

A Note About NVIDIA’s Online Course

NVIDIA has a free online course that covers the basic of the Jetson Nano. You can sign up for it here: https://courses.nvidia.com/courses/course-v1:DLI+C-RX-02+V1/about. Note that it has you download a different Ubuntu image for the Nano, which comes pre-installed with a number of tools for using and training machine learning models.

Configure Ubuntu

Once the Nano boots, you should be presented with Ubuntu’s configuration program. Walk through the steps to set up your username, password, timezone, WiFi, etc.

Configure Ubuntu on Jetson Nano

Once you’ve logged in to Ubuntu, you need to perform a few more steps.

If you’re using an Edimax EW-7811Un like I am (or any other wireless card based on the Realtek 8192 chipset), you’ll need to add it to the blacklist file, as there’s a bug in the Ubuntu kernel we need to work around. This should prevent any dropped connections during an remote desktop or SSH session.

Open the blacklist.conf file with vi:

Copy Code
sudo vi /etc/modeprobe.d/blacklist.conf

 

Scroll to the bottom of the file and press ‘o’ to insert a new line and edit. Add the following line:

Copy Code
blacklist rtl8192cu

 

Press ‘esc’ to exit insert mode, and type ‘:wq’ to write the file and exit. Sometimes, it can also help to disable power saving mode to the WiFi card:

Copy Code
sudo iw dev wlan0 set power_save off

 

You will want to get the IP address of your Nano, too (write this down, as you’ll need it for RDP and SSH):

Copy Code
ifconfig

 

Finally, install the Remote Desktop Protocol (RDP) server. I know that RDP is a proprietary protocol by Microsoft, but it seems to work better than VNC on the Nano.

Copy Code
sudo apt update
sudo apt install -y xrdp

 

Follow this with a reboot:

Copy Code
sudo reboot

 

Log in via RDP

If you are on Mac or Linux, you will need to download and install the RDP client of your choice.

On Windows, start the Remote Desktop application. Enter your username and IP address of the Nano. In the Display tab, change the resolution to 1280x1024 and change the Color depth to 16-bit. These will help the RDP session run more smoothly.

Configure RDP

In the Experience tab, change the Performance setting to Modem (56 kbps) and de-select the Persistent bitmap caching option. Supposedly, these help optimize the RDP connection for speed over nice visuals.

Configure RDP

Connect, and you should be presented with the Nano’s login screen. Enter your password (maybe twice) to get access to the desktop. From there, click the Activities button in the top-left to get the launcher to appear. You should then be able to open a file browser and terminal to begin developing on your remote desktop.

Remote desktop into Jetson Nano

Using SSH

By default, the Jetson Nano should be running an SSH server. Just use your favorite SSH client (e.g. PuTTY on Windows) to connect to the Jetson Nano to get a remote terminal.

Using SSHFS

If you would like a graphical interface to copy files between your host computer and the Nano, you can use SSHFS. This will let you mount a network drive on your host computer.

For Mac and Linux, follow the instructions here to install an SSHFS client: https://www.digitalocean.com/community/tutorials/how-to-use-sshfs-to-mount-remote-file-systems-over-ssh

On Windows, you’ll need to perform a few more steps:

  • Download and install the latest release of winfsp from this site: https://github.com/billziss-gh/winfsp/releases
  • Download and install the latest release of SSHFS-Win from this site: https://github.com/billziss-gh/sshfs-win/releases (you will likely need to reboot after this step)
  • Open a file explorer window, right-click on This PC, and select Add a Network Location. Enter the following, replacing <username> with the username on your Nano and <IP address> with the IP address (or hostname) of the Nano: \\sshfs\<username>@<IP address>

Once you connect via SSHFS, you should be presented with the directory structure located at /home/<username/ of your Nano. Now, you can enter commands via terminal and work with files using a graphical interface!

SSHFS connection to Jetson Nano

Alias Python 3

The Jetson Nano image comes installed with Python 2 and Python 3. However, Python 2 is configured as the default version. If you’re like me and trying to move all your work to Python 3, I recommend setting an alias in your .bashrc file:

Copy Code
vi ~/.bashrc

 

Scroll to the bottom of the file and press ‘o’ to insert a new line and edit. Enter the following line:

Copy Code
alias python=python3

 

Exit by pressing ‘esc.’ Type ‘:wq’ to exit and enter the following on the command line to run the .bashrc file:

Copy Code
source ~/.bashrc

 

Install Packages

In preparation for the next tutorial, you will need to install some packages and source code from NVIDIA. This will allow us to play with prepared demos and train a model for classifying images. Start by installing the following packages:

Copy Code
sudo apt install -y git cmake libpython3-dev python3-numpy

 

When that’s done, clone the jetson-inference repository:

Copy Code
git clone --recursive https://github.com/dusty-nv/jetson-inference

 

Create a build folder in the jetson-inference directory and execute cmake:

Copy Code
 
Copy Code
git clone --recursive https://github.com/dusty-nv/jetson-inference
cd jetson-inference
mkdir build
cd build
cmake ../

 

This will take some time. Throughout the build process, you will be asked for your password, and at some point, you will be asked to download pre-trained models. Leave the default GoogleNet and ResNet-18 models selected and press ‘enter’ to continue.

Load model in Jetson Nano

You’ll also be asked to install PyTorch. If you switched over to using Python 3 earlier, you will want to de-select PyTorch for Python 2 and select PyTorch for Python 3 using the spacebar. 

Install PyTorch for Python 3

Once that’s done, build and install the tools:

Copy Code
make
sudo make install
sudo ldconfig

 

Going Further

In the next tutorial, I’ll show you how to run the demos in the jetson-inference repository and use transfer learning to train a model. Feel free to read through the READMEs in the jetson-inference repository to see the demos: https://github.com/dusty-nv/jetson-inference

In addition to the online course, NVIDIA also has a set of tutorials showing you how to train a deep neural network from scratch using the DIGITS system: https://github.com/dusty-nv/jetson-inference/blob/master/docs/digits-workflow.md. Note that you will need access to a powerful graphics card (on your personal computer or cloud-based server) to use DIGITS.

Recommended Reading

制造商零件编号 102110268
NVIDIA JETSON NANO DEV KIT
Seeed Technology Co., Ltd
¥905.58
Details
制造商零件编号 PSAC30U-050L6
AC/DC DESKTOP ADAPTER 5V 20W
Phihong USA
¥85.47
Details
制造商零件编号 RP-SMLF32DA1
MEM CARD MIC SDHC 32GB 10UHS TLC
Panasonic Electronic Components
More Info
Details
制造商零件编号 SC0023
RASPBERRY PI CAMERA MODULE V2
Raspberry Pi
¥203.50
Details
Add all DigiKey Parts to Cart
TechForum

Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.

Visit TechForum