JetsonHacks

GPIO/I2C on Jetson TX1 – LIDAR-Lite v2 Installation

Interfacing with GPIO/I2C on the NVIDIA Jetson TX1 Development Kit is slightly different than it’s little brother, the Jetson TK1. This is mainly because the GPIO header is physically different on the Jetson TX1, which uses a 2.54mm IDC type of connector, similar to the physical connectors on Arduinos and Raspberry Pis. While the software that is used to interface with an I2C device is the same as on the Jetson TK1, the physical connection is different. As a demonstration, we hook up a LIDAR-Lite v2 to the Jetson TX1. Looky here:

Background

Interfacing with the J21 GPIO Header is straightforward, much like interfacing with some of the more mass market microprocessors/micro-controllers. The same wires and header connectors can be used, as well as ribbon cables and connectors.

In the video, 0.1″ (2.54mm) connector female to male wires were used to connect the Jetson TX1 to the protoboard. These supplies are ubiquitous. There are some may different suppliers and vendors which provide a multitude of configurations. So rather than give links, it’s a better idea for you to look for supplies that suit your needs. The prototyping materials in the video were from Adafruit, if you need a place to start.

Here is the Jetson TX1 J21 header pinout for reference. The GPIO numbers have not been verified by a third party, so use those at your own risk, but the signals should be correct.

LIDAR-Lite

LIDAR-Lite is a laser ranging module from Pulsed Light, Inc. which is a lightweight and cost effective measurement device. LIDAR-Lite can be accessed over I2C or PWM. The JetsonHacks Github repository contains a small library for accessing the LIDAR-Lite v2 over I2C.

The LIDAR-Lite v2 in the demo was purchased from Sparkfun.

Earlier this year, we covered the LIDAR-Lite v1 installation. Refer to that article for a quick background on LIDAR and the device. Recently, a new and improved version was introduced. A summary of the new goodness taken from the Sparkfun website:

Each LIDAR-Lite v2 features an edge emitting, 905nm (75um, 1 watt, 4 mrad, 14mm optic), single stripe laser transmitter and a surface mount PIN, 3° FOV with 14mm optics receiver. The second version of the LIDAR-Lite still operates at 5V DC with a current consumption rate of

The LIDAR-Lite v2 has received a number of upgrades from the previous version. With the implementation of a new signal processing architecture, LIDAR-Lite v2 can operate at measurement speeds of up to 500 readings per second offering greater resolution for scanning applications. Additionally, the LIDAR-Lite v2 has had its I2C communications improved to operate at 100 kbits/s or 400 kbits/s with you, the user, able to assign your own addressing! Just in case you are wondering: yes, the LIDAR-Lite v2 is compatible with its previous version in all primary functions and their compatibility will extend into the next version and beyond.

LIDAR-Lite v2 Installation

Here are the signals for the J21 header: Jetson TX1 J21 Header Pinout Note: There is a small white triangle pointing to Pin 1 of the J21 Header on the Jetson TX1 carrier board.

Follow the wiring diagram:

Connection for Jetson TX1 to LIDARLite v2
I2C Connection for Jetson TX1

There are two I2C ports on the expansion header. The first uses J21 pins 3 and 5 (I2C_GP0_DAT and I2C_GP0_CLK respectively) and is on I2C bus 0. The port used in our project, uses J21 pins 27 and 28 (I2C_GP1_DAT and I2C_GP1_CLK respectively) and is on I2C bus 1. Bus one is the bus used in the JetsonHacks LIDAR-Lite library.

The I2C bus is 3.3V. There is a jumper on the TX1 that allows the signal to be set for either 1.8V or 3.3V signals, 3.3V should be chosen. Note that the power supplied to the LIDAR-Lite is 5V, though 3.3V I2C signals are connected.

Software

Note: The LIDAR-Lite V2 software is not backward compatible with the LIDAR-Lite V1.
Once you have the LIDAR-Lite connected, you’re ready to test. There is a small library written for the Jetson to interface with the LIDAR-Lite over I2C available on Github. First, install some prerequisites:

$ sudo apt-get install libi2c-dev i2c-tools

You can then check to see if the Jetson TK1 can detect the LIDAR-Lite v2 address:

$ sudo i2cdetect -y -r 1

You should see ’62’ as one of the entries, which is the address of the LIDAR-Lite.
You can then run the example:

$ git clone https://github.com/jetsonhacks/JHLidarLite_V2.git
$ cd JHLidarLite_V2
$ cd example
$ make

After the example compiles, run:

$ sudo ./example

The sudo is required to access the I2C bus from user space. The example program will show the measured distance, the previous measured distance, and the velocity (rate of change) repeatedly. If the distance is always -1, even after passing your hand over the LIDAR-Lite, this probably means that it is not being recognized by the Jetson.

Also included in the examples folder is a little graphics plotting example as seen in the video. It’s beyond the scope of this article to give step by step instructions on how build the program, but the overview follows.

In order to compile the program, you will need to install Qt Creator as described in an earlier article. Using Qt Creator, compile the program contained in the ‘JHLidarLite_V2/example/LidarPlotSketch’. Once the program is compiled, find the executable in the build folder, and from a Terminal execute the application using ‘sudo’.

Note: This software was demonstrated using L4T 23.1.

Conclusion

Using I2C over the GPIO header of the Jetson TX1 is straightforward, and the LIDAR-Lite v2 is a nice upgrade from the original product. Hopefully this article provided enough information to get started working with the expansion header.