The I2C pin of the Jetson nano is shown in the figure, and the I2C service needs to be enabled before use.
Firstly, install I2Ctool, and input the terminal as follows:
sudo apt-get update
sudo apt-get install -y i2c-tools
Check the installation status, terminal input:
xxxxxxxxxx
apt-cache policy i2c-tools
The following output indicates successful installation
xxxxxxxxxx
i2c-tools:
was installed:4.0-2
candidate: 4.0-2
Version List:
*** 4.0-2 500
500 http://ports.ubuntu.com/ubuntu-ports bionic/universe arm64 Packages
100 /var/lib/dpkg/status
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
xxxxxxxxxx
sudo i2cdetect -y -r -a 1
Smbus is a Python library. If smbus is not installed, the terminal input is:
xsudo apt-get update
sudo apt-get install -y python3-smbus
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)
Wiring:
Jetson Nano pin 3(SDA)→oled module SDA
Jetson Nano J pin 5(SCL)→oled module SCL
Jetson Nano J pin 2(5V)→oled module VCC
Jetson Nano J pin 6(GND)→oled module GND
Import Adafruit_ SSD1306 library This is the OLED library, and you need to download this library when using your own image
xxxxxxxxxx
pip install Adafruit_SSD1306
Initialize 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:
xxxxxxxxxx
sudo python3 yahboom_oled.py
Experimental phenomenon: