4 Character 7 Segment LED over I2C – NVIDIA Jetson TK1

Installing a 4 Character, 7 Segment LED that communicates with the NVIDIA Jetson TK1 over I2C is useful for adding a little visual flair to numeric display projects such clocks, up/down counters and numeric displays. Looky here:

IMG_0947

Background

On a thread over on the NVIDIA Jetson TK1 Forum a forum member was having issues with getting a device working with the Gen2 I2C signals. As covered before, we’ve added some devices to the Gen2 I2C signals on this website with success. The question then becomes, “Is the device connected to the Jetson compatible, or is something else wrong?”.

The device being used is a 4 Character 7 Segment LED made by Adafruit. A very important fact to remember here is that during this discussion, it was “Back to the Future” day. In the movie 1989 “Back to the Future Part II“, Doc, Marty and Jennifer travel to “the future” date October 21, 2015. In the time travel machine, a Flux Capacitor driven Delorean, the time circuit user interface uses segmented LED displays. A coincidence? The Doctor and Sherlock don’t believe in them, neither should we.

Parts

For this project, a Adafruit 0.56″ 4-Digit 7-Segment Display w/I2C Backpack – Green was used. The Display was assembled per the Adafruit instructions.
880-01

880-02

For connecting to the Gen1 I2C signals, an Adafruit 4-channel I2C-safe Bi-directional Logic Level Converter:
757-04
In the video, a Solderless BreadBoard, 400 tie-points, 4 power rails was used, along with Hook up Wire – 22 Gauge.

Additional Tools

There are a couple of tools that are useful for this project:
1) A soldering iron, in the video a Hakko FX888D-23BY Digital Soldering Station was used.
2) Wire strippers, in the video a Hakko CHP CSP-30-1 Wire Stripper, 30-20 Gauge Maximum Cutting Capacity were used.

Wiring

The LED Backpack is connected to the I2C Gen2 signals on the Jetson J3A1 connector as follows:

GND J3A1-14 -> LED Backpack (GND)
VCC J3A1-1 -> LED Backpack (VCC – 5V)
SCL J3A1-18 -> LED Backpack (SCL)
SDA J3A1-20 -> LED Backpack (SDA)

IMG_0904
IMG_0906

Software Setup and Installation

Note: The demonstration was filmed directly after flashing the Jetson with L4T 21.4 using JetPack 1.2.
Once the board is wired up, turn the Jetson TK1 on.
In order to be able inspect the LED Display, you may find it useful to install the i2c tools:

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

After installation, in a Terminal execute:

$ sudo i2cdetect -y -r 1

ubuntu@tegra-ubuntu:~$ sudo i2cdetect -y -r 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: — — — — — — — — — — — — —
10: — — — — — — — — — — — — — — — —
20: — — — — — — — — — — — — — — — —
30: — — — — — — — — — — — — — — — —
40: — — — — — — — — — — — — — — — —
50: — — — — — — — — — — — — — — — —
60: — — — — — — — — — — — — — — — —
70: 70 — — — — — — —

You should see an entry of 0x70, which is the default address of the LED Segment Display. If you have soldered the address pins on the Display you should see the appropriate address.

LED Segment Display Install

There is a LED Segment interface available in the JHLEDBackpack repository on the JetsonHacks Github account. To install:

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

You are then ready to compile the example and run it.

$ make
$ sudo ./displayExample

The display will go through a couple of examples, a blinking set of dashes, a hexadecimal display, a floating point number display, a count down timer and a clock example. Hit the ‘Esc’ key during the clock example to end the example.

I2C Gen1 Wiring

As shown in the video, when wiring the LED display to the Gen1 I2C signals, a level converter is used. The level converter takes the 1.8V signals from the Jetson and converts them to 3.3V to drive the LED display. A voltage divider is an alternative to this arrangement.

The signals from the Jetson:

J3A1 pin 1 -> LED Display VCC
J3A1 pin 14 -> GND rail (GND rail is wrapped to both sides of the breadboard)
J3A1 pin 16 -> 3.3V + rail (High voltage side of level converter)
J3A1 pin 19 -> 1.8V + rail (Low voltage size of level converter)
J3A1 pin 21 -> Level Converter A1 (SCL)
J3A1 Pin 23 -> Level Converter A2 (SDA)

From the level converter to the LED display:

Level Converter B1 -> LED Display SCL
Level Converter B2 -> LED Display SDA
1.8V + -> Level Converter LV
3.3V + -> Level Converter HV
GND -> Both Level Converter GNDs

IMG_0950

Software Changes

The Gen1 I2C signals run on the I2C “0” bus. The software example needs to be changed to reflect this when using the Gen1 signals.
As shown in the video, add the line in JHLEDBackpack/example/display.cpp:

HT16K33 *displayMatrix = new HT16K33() ;
// Add the following line
displayMatrix->kI2CBus = 0; // Use I2C bus 0 for Gen1
int err = displayMatrix->openHT16K33();

Recompile the example, and run. You should see the same demonstration as before if everything is wired correctly.

Other I2C Ports

There are two other I2C ports available through the J3 headers on the Jetson. They are referred to as PWR_I2C and CAM_I2C. PWR_I2C is on I2C bus 4 and CAM_I2C is on bus 2. Both are 1.8V signals.

Here’s a little more detail:

GEN2 I2C
I2C Bus: 1
GEN2_I2C_SCL_3.3V — J3A1 pin 18
GEN2_I2C_SDA_3.3V — J3A1 pin 20

The following are 1.8V signals

GEN1 I2C
I2C Bus: 0
GEN1_I2C_SCL — J3A1 pin 21
GEN1_I2C_SDA — J3A1 pin 23
or:
GEN1_I2C_SCL — J3A2 pin 56
GEN1_I2C_SDA — J3A2 pin 56

CAM I2C
I2C Bus: 2
CAM_I2C_SDA — J3A2 pin 8
CAM_I2C_SCL — J3A2 pin 11

PWR I2C
Note: Documentation states that PWR I2C is reserved for NVIDIA use only
I2C Bus: 4
PWR_I2C_SCL — J3A2 pin 50
PWR_I2C_SDA — J3A2 pin 50

Conclusion

So there you go. This is a good start on building a time machine. All that’s needed is the proper Flux Capacitor circuitry, Delorean and some other various bits and pieces. Oh, and of course 1.21 gigawatts*. The rest of the exercise is left for the reader, we’ve done the hard part here.

*Note: In “Back to the Future”, gigawatts is pronounced “jig-a-watts”. It turns out that this is an old fashioned pronunciation of what is now commonly referred to as gigawatts.

2 Comments

  1. Well made tutorial. I’m not sure, though, what I2C Gen1 and Gen2 are. Would you mind explaining what these ‘generations’ refer to?

    Thank you.

    • I2C originally came out in the 1980s, so there have been changes over the years. I’m sure a hardware guy would gleefully tell you all the differences, but In practical terms on the Jetson, the Gen1 I2C uses 1.8V logic levels (hence the need for a level shifter), where as the Gen 2 I2C uses the more common 3.3V logic levels.

Leave a Reply

Your email address will not be published.


*