Get Started with Jetson Nano 2GB and CSI Camera

Scroll down

NVIDIA® Jetson Nano™ 2GB Developer Kit is the latest offering in the Jetson Nano range. This small, powerful, single-board computer is the entry-level model for AI, making it accessible to makers, learners, and embedded developers. It lets you run multiple neural networks in parallel for applications like image classification, object detection, segmentation, and speech processing.

This getting started will guide you through setting up your Jetson Nano 2GB and configuring it for AI image processing using the Pi Camera Module V2 with Python and C++.

What you'll need

Jetson Nano 2GB
Raspberry Pi camera module V2.1
Power supply
64 GB MicroSDHC Card Class 10
Host computer Windows/Mac/Linux
HDMI monitor
USB keyboard
USB mouse
HDMI cable
Ethernet cable
Internet connection and router

Additional hardware

Micro SD card

Jetson Nano 2GB uses a microSD card for its operating system and storage. Use a high-performance card with a minimum 32GB capacity. We used a Samsung Evo Plus 64GB UHS-1 rated at Speed Class 10 (C10) and UHS Speed Class 3 (U3) for this guide.

Power supply

A power supply is not included with the Jetson Nano 2GB. Minimum requirement is USB-C 5V / 3A. We used a good quality 5.1V / 3A (15W) power supply.

Flash micro-SD card

Prepare the microSD card system image using a Windows, MacOS or Linux PC with an SD card writer or adapter.  balenaEtcher was used on a Windows 10 PC to flash the image. The steps are similar for MacOS and Linux PC’s.

  • Download the Jetson Nano 2GB Developer Kit SD Card Image to the PC. The image file was named jetson-nano-2gb-jp451-sd-card-image.zip
  • Insert the microSD card into the PC.
  • Start balenaEtcher, select the Jetson Nano 2GB image and SD card drive.

Using large SD cards will generate warnings in Etcher. Be careful to select the correct drive!

balena etcher
  • Select Flash and wait for the image to be written and verified.
  • Eject the SD card and remove it from the card reader.

Setup & first boot

Set up the board and peripherals, including the Pi Camera module V2 for first boot.

The CSI interface only works with the Pi V2.1 camera modules

  • Unbox the Jetson Nano 2GB Developer Kit.
  • Connect the USB-C power supply to the USB-C socket – the Micro-USB socket is for device mode only.
Jetson nano power connection
  • Insert the microSD card into the card socket beneath the heat sink. This is a push and release connector.
  • To attach the Pi Camera Module V2 to the CSI connector, open the connector latch by lifting the tab.
  • Slide the ribbon cable into the connector with the blue marking facing away from the heat sink.
  • Gently push down on the latch to secure it.
Jetson nano attach ribbon cable
  • Connect the HDMI monitor, keyboard, mouse and ethernet cables.
  • Insert the power cable and the Jetson Nano 2GB will boot.
  • The green LED next to the USB power connector will turn on.
  • Review and accept NVIDIA Jetson software EULA.
  • Select system language, keyboard layout, and time zone.
  • Create username, password, and computer name.
  • Optionally configure wireless networking.
  • Select APP partition size. It is recommended to use the max size suggested.
  • Create a swap file.

The Jetson Nano 2GB basic setup is now complete.

jetson nano desktop

CSI camera setup

JetsonHacks.com have provided useful scripts to test the camera operation and ensure the Python and C++ environment is setup ready for AI development.

Open LXTerminal from the desktop icon and execute the following commands:

  • Clone the CSI-Camera repository
git clone https://github.com/JetsonHacksNano/CSI-Camera.git
  • Change directory to CSI-Camera.
 cd CSI-Camera 
  • Test the camera, this is a single GStreamer pipeline command.
  • Ctrl + C to exit.
gst-launch-1.0 nvarguscamerasrc sensor_id=0 ! \
 'video/x-raw(memory:NVMM),width=3280, height=2464, framerate=21/1, format=NV12' ! \
 nvvidconv flip-method=2 ! 'video/x-raw, width=816, height=616' ! \
 nvvidconv ! nvegltransform ! nveglglessink -e 

Depending on the orientation of your camera, you may need to adjust the flip-method index in the above command line. Here are the different settings:

flip-method: video flip methods
Default: 0, “none”
(0): none – Identity (no rotation)
(1): counterclockwise – Rotate counter-clockwise 90 degrees
(2): rotate-180 – Rotate 180 degrees
(3): clockwise – Rotate clockwise 90 degrees
(4): horizontal-flip – Flip horizontally
(5): upper-right-diagonal – Flip across upper right/lower left diagonal
(6): vertical-flip – Flip vertically
(7): upper-left-diagonal – Flip across upper left/low

The camera should display a video image in a new window.

Jetson nano displaying camera feed

Python image processing

Face Recognition Test

This AI test uses Python3 libraries and a trained model to recognise faces in the video image.

  • Install numpy library module.
 sudo apt install python3-numpy 
  • Install libcanberra.
sudo apt install libcanberra-gtk-module 
  • Run face_detect.py script.
python3 face_detect.py 

You may need to edit the flip-method in the definition of gstreamer_pipeline in face_detect.py:

def gstreamer_pipeline(
     …
     framerate=21,
     flip_method=2, 
  • A new window will open and a blue highlight box will appear around any faces that are recognised in the video capture.
  • Close window to exit.
jason nano face detection

C++ image processing

This test uses a C++ framework to compile a video test from simple_camera.cpp.

  • Compile simple_camera.cpp with the following command line:
  g++ -std=c++11 -Wall -I/usr/include/opencv4 simple_camera.cpp \
 -L/usr/lib/aarch64-linux-gnu -lopencv_core -lopencv_highgui \
 -lopencv_videoio -o simple_camera 

You may need to open simple_camera.cpp and edit the flip_method in the main function.

 int main()
 {
 …
     int framerate = 60 ;
     int flip_method = 2; 
  • Run simple_camera.
./simple_camera 
  • A new window will open displaying the video image.
  • Ctrl + C   to terminate the application and close the window.

Safe shutdown

Avoid corrupting the SD card image by shutting down the system correctly.

  • Click the red stop button in the bottom right of the panel and select Shutdown.
  • After a few seconds, the green power LED will go off and the power connector can be removed.
  • The system is now powered off.

Allow the power supply to discharge before reconnecting otherwise the Jetson Nano 2GB will not boot.

jetson nano shutdown

Summary

Congratulations! You should have successfully set up and configured your Jetson Nano 2GB Developer Kit. The Pi Camera V2 module was connected and tested using Python & C++ code examples. Everything is now ready to start exploring the AI image processing capabilities of the Jetson Nano 2GB.

NVIDIA produce very high-quality documentation for their products and you can find links to tutorials, how-to-guides and an active developer community to make your next steps: https://developer.nvidia.com/embedded/learn/get-started-jetson-nano-2gb-devkit#next

Privacy

Our website uses cookies and similar technologies to provide you with a better service while searching or placing an order, for analytical purposes and to personalise our advertising. You can change your cookie settings by reading our cookie policy. Otherwise, we’ll assume you’re OK with our use of cookies.

Location

Please select an option to see content specific to your location and shop online.

Browse the US site