I2C communication

The I2C pin of the Jetson Orin NX is shown in the figure, and the I2C service needs to be enabled before use.

First, install I2Ctool and input the terminal:

Check installation status, terminal input:

The following output indicates successful installation

Scan all i2c devices on a certain bus and print out the device i2c bus address. For example, if a device with address 0x0f is mounted on the I2C pin, the corresponding device I2C address will be displayed

Smbus is a Python library. If smbus is not installed, the terminal input:

The Smbus protocol has many related library functions that can be used for I2C communication

 

The following is a program case of our store's OLED module. If testing is needed, the corresponding OLED module should be used (you can choose to change the OLED module in our store)

wire:

Jetson Orin NX pin 3(SDA)→oled SDA

Jetson Orin NX pin 5(SCL)→oled SCL

Jetson Orin NX pin 2(5V)→oled VCC

Jetson Orin NX pin 6(GND)→oled GND

Import Adafruit_ SSD1306 library This is the OLED library, and you need to download this library when using your own image

init oled:

 

Afterwards, if you are interested in reading some basic information functions of nano, you can go to this py file to learn more, which includes obtaining local IP, tf card space usage, memory usage, system time, and other information.

Terminal input:

If it is a self built image, you can find the test in the attachment of the data_ i2c_ Transfer oled.py to Jetson orin nx experimental phenomena: