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

  • We are shipping but experiencing some delays due to COVID-19 situation. Thank you for your continued support. We are shipping but experiencing some delays due to COVID-19 situation. Thank you for your continued support.
  • Free delivery on orders over £60 Free delivery on orders over £60

Project

Get started with Jetson Nano and CSI Camera

Scroll down

NVIDIA® Jetson Nano™ Developer Kit is a small, powerful single-board computer designed to make AI 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 and configuring it for AI image processing using the Pi Camera Module V2 with Python and C++.

1. Additional Hardware

microSD Card

The Jetson Nano uses a microSD card for its operating system and storage. Use a high-performance card with a large enough capacity for your project. This guide used a Samsung Evo Plus 64GB UHS-1 rated at Speed Class 10 (C10) and UHS Speed Class 3 (U3).

Note: The official Jetson Nano guide recommends a 16GB minimum capacity card – we had problems creating the image on this size card.

Power Supply

There are 3 options to power the Jetson Nano:

  • Via the micro USB connector at 5V / 2A (10W). This defaults to using 2 of the 4 CPU cores only (5W power mode).
  • Using the Barrel Jack at 5V / 4A (20W). Defaults to using all 4 cores (Max power mode).
  • Via the GPIO header at 5V / 6A (24W) for use with higher power peripherals (Max power mode).

This guide used a 5V / 4A (20W) desktop power supply with 2.1 mm inner diameter and 5.5 mm outer diameter, centre positive plug via the Barrel Jack.

 

2. Flash microSD Card

Prepare the microSD card system image using a Windows, MacOS or Linux PC with an SD card writer or adapter. balenaEtcher ( https://www.balena.io/etcher/ ) 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 Developer Kit SD Card Image to the PC. The image file was named nv-jetson-nano-sd-card-image-r32.3.1.zip
    • Insert the microSD card into the PC.
    • Start balenaEtcher, select the Jetson Nano image and SD card drive.

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

jetson nano image

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

 

3. Base setup and 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 camera modules

  • Unbox the Jetson Nano Developer Kit.
  • Using the jumper, connect the J48 power select header pins to enable 5V / 4A supply via the J25 barrel jack. This will disable power supply via Micro-USB socket.

jetson nano power

  • Insert the microSD card into the card socket beneath the heat sink. This is a push and release connector.
  • Attach the Pi Camera Module V2 to the CSI connector closest to the barrel jack (Camera 0). 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.

jetson nano ribbon

  • Attach the HDMI monitor, keyboard, mouse and Ethernet cables.
  • Insert the power cable and the Jetson Nano will boot.
  • The green LED next to the USB power connector will turn on.
  • Follow the on-screen prompts to set up the Ubuntu Linux system – when this is complete the Desktop will be displayed

jetson nano desktop

The Jetson Nano basic setup is now complete.

 

4. 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 a Terminal window (Ctrl + Alt + T) 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 camera – this is a single GStreamer pipeline command
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 camera

 

5. 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.
  • Ctrl + C to terminate the script

jetson-nano-face-recognition

 

6. C++ Image Processing

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

In the latest Jetson Nano image, the opencv libraries and header files are installed in a different location to the example code so the include and library paths need updating in the examples.

  • Compile simple_camera 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.
  • Press ESC to terminate the application and close the window.

 

7. Safe shutdown

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

  • Click the Cog icon in the top right-hand corner of the desktop and select Shut Down.
  • After a few seconds, the green power LED will go off and the power connector can be removed.
  • The system is now powered off.

The power supply needs to discharge before re-connecting the Jetson Nano otherwise it does not boot.

Summary

Congratulations! You should have successfully set up and configured your Jetson Nano 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.

NVIDIA have produced a series of Deep Learning examples and Tutorials that you can follow at: https://developer.nvidia.com/embedded/learn/get-started-jetson-nano-devkit#next

 

Like what you read? Why not show your appreciation by giving some love.

From a quick tap to smashing that love button and show how much you enjoyed this project.