🛠 Mastering Advanced I/O: GPIO, I2C, and Displays on Xerxes Nano
Objectifs
This tutorial aims to configure low-level interfaces (GPIO, I2C, SPI) on the Xerxes Nano carrier board. We will connect an I2C temperature sensor and a small OLED display to validate the data chain. These skills are essential for industrial IoT or embedded robotics projects using NVIDIA Jetson Orin Nano Super or Turing RK1 modules.
Matériel nécessaire
- Xerxes Nano carrier board with Jetson Orin Nano or Turing RK1 module.
- I2C temperature sensor (e.g., BME680 or TMP102).
- I2C OLED display (SSD1306, 0.96 inch).
- Dupont wires (Female-Male) for GPIO/I2C connections.
- Stable power supply (USB-C or PoE depending on configuration).
- Workstation with SSH access or connected screen/keyboard.
Étapes
Connect to your board via SSH. Update system packages to ensure library compatibility. ``bash sudo apt update && sudo apt upgrade -y ``
- System Access and Preparation
The Xerxes Nano exposes Jetson-compatible pins. Use the NVIDIA configuration tool to enable buses. Note that specific pins depend on the module (Orin vs RK1); consult the open-source KiCad schematic for exact mappings. ``bash sudo /opt/nvidia/jetson-io/jetson-io.py `` Select "Configure 40-pin expansion header" and enable I2C2 and SPI1 if available in your hardware configuration.
- Enabling I2C and SPI Interfaces
Install necessary libraries for GPIO and I2C interaction via pip. ``bash sudo apt install python3-pip python3-dev pip3 install smbus2 adafruit-circuitpython-ssd1306 adafruit-circuitpython-bme680 ``
- Installing Python Libraries
Verify that the sensor and display are recognized on the I2C bus. Common addresses are 0x3C for OLED and 0x77 for BME680. ``bash sudo i2cdetect -y -r 1 `` You should see the corresponding hexadecimal addresses displayed in the grid.
- Detecting I2C Devices
Create a Python script sensor_display.py to read temperature and display it. ```python import board import busio import adafruit_ssd1306 import adafruit_bme680 import time
- Reading and Display Script
# I2C Initialization (bus 1 default on Jetson) i2c = busio.I2C(board.SCL, board.SDA)
# Display Initialization display = adafruit_ssd1306.SSD1306_I2C(128, 64, i2c) display.fill(0) display.text('Xerxes Nano', 0, 0, 1) display.show()
# Sensor Initialization bme = adafruit_bme680.Adafruit_BME680_I2C(i2c)
while True: temp = bme.temperature display.fill(0) display.text(f'Temp: {temp:.2f} C', 0, 0, 1) display.show() time.sleep(2) ```
Launch the script with necessary permissions to access devices. ``bash sudo python3 sensor_display.py ``
- Running the Script
Vérification
The OLED display should show the ambient temperature updated every 2 seconds. If nothing displays, check physical connections (SCL/SDA) and file access permissions for /dev/i2c-1. Use dmesg | tail to check for kernel errors.
Pour aller plus loin
Explore using the OCuLink connector to offload AI computation to an external GPU, or configure active cooling via the PWM connector based on thermal load detected by the sensor.