Developing on NVIDIA® Jetson™ for AI on the Edge

GPIO Interfacing – NVIDIA Jetson TK1

A small ‘C’ programming language library can be used to interface with the GPIO (General Purpose Input/Output) subsystem on the Jetson TK1. Looky here:


On the Jetson forum the other day, a community member asked about how to interface through code with GPIO on the Jetson TK1. That seems like a reasonable request.

On the Jetson Wiki there is a tutorial page on how to interface with the subsystem through the command line. Linux for Tegra (L4T) used on the Jetson uses a standard Linux interface which uses ‘sysf’ and the file system to control the GPIO pins. On the Jetson TK1, the GPIO pins can be configured as either input or output, and are used for a variety of applications both for reading from various sensors and for writing output. The explanation of GPIO is outside the scope of this article. There are a lot of sites which talk about the subject in more detail, starting with the GPIO page on the Jetson Wiki.

The topic is not as straightforward as one would first think. First, there is the idea of using GPIO in ‘user space’, that is, where an application runs, versus in the actual kernel itself. Second there is the idea that the control files for the pins are created dynamically. A user or application in user space can request that the kernel give access to the GPIO pin if the they have the proper permissions using an ‘export’ command. In turn, the kernel creates a file directory to give access to the user/application. This makes things more difficult for things like setting up permission rules in ‘udev’ files.


Note: The usual warning, you are dealing with electricity and all that, there is a chance you could fry your Jetson by hooking it up incorrectly. Be strong, be brave, but also be very careful.

In the demonstration, a simple GPIO library interface for the Jetson TK1 was created, and a little hardware/software demo was built. The hardware consists of a couple of circuits, a LED driven by a GPIO pin on the Jetson, and a button switch which is read by another GPIO pin on the Jetson. The LED circuit was adapted from the Jetson Wiki GPIO tutorial page:

Controlling a LED from Jetson TK1 GPIO
Controlling a LED from Jetson TK1 GPIO

The tactile button switch circuit is taken from

This is a ‘pull down’ design with the exception being that Vcc is 1.8V versus the 3.3V listed in the schematic. This circuit is discussed in more detail here. By using a pull down circuit, when the button is pressed the GPIO will read high, when not pressed the button will read low.

Note: The Jetson TK1 GPIO pins use 1.8V logic. Be careful to convert them to the appropriate voltage level when using them.

Note 2: If you’re coming from devices like the Raspberry Pi, you know that the Pi has pull up/down resistors built in to the device. The Jetson does not, therefor the need for the external resistors.


Parts list:
2.3V 16ma LED
Tactile Button Switch
BC547 transistor
All resistors are 1/4 watt:
10K resistor
1.5K resistor
1.0K resistor
220 Ohm resistor
Hookup wire (In the video Hook up Wire – 22 Gauge was used).
Breadboard (In the video, a Solderless BreadBoard, 400 tie-points, 4 power rails was used)
Multimeter (Optional, a Fluke 117 Electricians True RMS Multimeter was used in the video)

The The Arduino Starter Kit has a wide selection of the above components (though it is missing the 1.5K resistor), you can consider acquiring one of those).


Here’s some pictures of everything wired up:

Full Wiring







The breadboard is described as [row][column]. For example row 9 column ‘c’ is 9c. There are two different power rails, the one on the left of 1a is 1.8V, the one on the right of 1j is 5V.


Tactile Button Switch GND 8e, (+) 10e
10K Resistor 8a to 4c
GND 4 (-) to 4b (1.8V side)
Power 1.8V (+) 10 (+) to 10a
1K Resistor 2d to 8d


Transistor (BC547) Collector 25e, Base 26e, Emitter 27e
LED Anode 24h, Cathode 25h
220 ohm resistor 21h to 24i
Power 5V (+) 21 (+) to 21i
GND 27 (-) to 27j (5V side)


GND rails are tied together at row 30
5V from Jetson J3A1 pin 1 to 1 (+) 5 volt side
GND from Jetson J3A1 pin 8 to 2 (-) 5 volt side
1.8V from Jetson J3A1 pin 19 to 1 (+) 1.8 volt side

GPIO pins

gpio166 from Jetson J3A2 pin 58 to 2c
gpio165 from Jetson J3A2 pin 55 to 17i

The GPIO library and example code to run the breadboard prototype is stored on the JetsonHacks Github account. To clone the repository:

$ git clone

To build the example:

$ cd jetsonGPIO
$ ./

Once the example has been compiled, run the example:

$ sudo exampleGPIOApp

The ‘sudo’ is needed to get permission for accessing the GPIO subsystem. The example application will start up and flash the LED a few times. Next, the user can tap the button to turn the light on and off, the button pressed is ‘on’, the button not pressed is ‘off’. The application runs for a little while like that, then quits.


This is a simple way to interface with GPIO on the Jetson, try it out! The code is provided for the library, as is the example application. Note that this is a very simplistic version of a GPIO interface library. There are many types of device interface strategies for using GPIO, this is a starting basis for how it could be approached.


2 Responses

  1. Hello,
    I am so gratefull for the information provided above and I have a few question about the materials which have been used for circute.
    1. Why did you use the BC547 transistor?
    2. Can I use BC238 instead of BC547?

    Thanks for your advice in advance.

    1. The circuit was copied Jetson Wiki GPIO Tutorial Page. It’s a pretty simple circuit, you should be able to choose part substitutions as needed. Thanks for reading!

Leave a Reply

Your email address will not be published. Required fields are marked *


Some links here are affiliate links. If you purchase through these links I will receive a small commission at no additional cost to you. As an Amazon Associate, I earn from qualifying purchases.

Books, Ideas & Other Curiosities