🛠 Interroger un capteur I2C sur les broches 3/5 du connecteur
Objectives
Connect an I2C sensor or peripheral (OLED SSD1306, BME280, etc.) to the Orange Pi 3B and detect it using i2c-tools. Note: on the 40-pin connector, the only conflict-free I2C interface is I2C2_M1, pins 3 (SDA) and 5 (SCL); it is enabled in the mainline device tree only since the commit dated 2025-11-21 — a recent kernel is required, otherwise use the manufacturer's image or a custom overlay (kernels 6.11 to 6.17).
Hardware
- Orange Pi 3B running recent Armbian (or Orange Pi image) — check
uname -rand ensure&i2c2is enabled - 3.3 V I2C sensor (e.g., SSD1306 at 0x3c, BME280 at 0x76/0x77)
- 4 Dupont wires: 3.3 V, GND, pin 3 (SDA), pin 5 (SCL)
Complete code
sudo apt install i2c-tools
sudo modprobe i2c-dev
i2cdetect -l # lister les contrôleurs
# Trouver le bus du connecteur : le nom du device tree contient i2c2
for d in /sys/bus/i2c/devices/i2c-*; do echo "$d : $(cat $d/of_node/fullname 2>/dev/null)"; done
sudo i2cdetect -y N # N = numéro du bus i2c2 repéré ci-dessus
# Exemple de sortie attendue : un périphérique répond 3c (OLED SSD1306)
# Lecture rapide d'un registre :
sudo i2cget -y N 0x3c 0x00
Expected verification
i2cdetect -y N displays a grid; the sensor's address appears (3c, 76, 77…). No UU should appear if no kernel driver already claims the device.
Common errors
- Scanning the wrong i2c-N bus: the RK809-5 PMIC is on i2c0 at address 0x20, not on the connector.
- Kernel 6.11–6.17 without an overlay: the connector's controller does not exist,
i2cdetect -lshows nothing matching — update the kernel or write an overlay setting&i2c2 status="okay". - Powering the module with 5 V while the pins are 3.3 V: risk for modules without a level shifter.
- Addresses 0x00–0x06 displayed as "UC": these are reserved addresses, not devices.
- Two modules with the same address: plan for an I2C multiplexer (TCA9548A).
Other tutorials for this board
- Faire clignoter une LED via le GPIO avec libgpiod
- Lire un bouton poussoir et afficher l'état dans la console
- Premier script Python : bouton + LED avec python3-libgpiod
- Variation d'intensité d'une LED avec un signal PWM
- Configurer Ethernet gigabit et Wi-Fi puis se connecter en SSH
- Booter sur un SSD NVMe et récupérer une carte bloquée (MaskROM)
Code examples for this board
clignotante.pyPythonbouton-gpio.pyPythoncapteur-i2c.shBashsurveillance-temperature.shBashcapteur-dht11.pyPythonservo-pwm-sysfs.shBash