🛠 Faire clignoter une LED via le GPIO avec libgpiod
Objectives
Discover the 40-pin connector on the Orange Pi 3B (Rockchip RK3566) and blink an LED using libgpiod, the modern Linux API based on character devices — without using the legacy gpio export sysfs mechanism.
Hardware
- Orange Pi 3B running Armbian (Debian/Ubuntu), powered via USB-C at 5 V / 3 A
- 1 LED + 330 Ω resistor, female-to-male Dupont cables
- Display or SSH session
Full Code
sudo apt install gpiod
gpiodetect # gpiochip0 = gpio0 ... gpiochip4 = gpio4 (RK3566)
gpioinfo gpiochip1
# Banques Rockchip exposées par libgpiod : PA=0-31, PB=32-63, PC=64-95, PD=96-127
# Exemple : gpio1_b3 = 32+3 = 35 sur gpiochip1 (vérifier une broche libre sur le plan officiel 40 broches)
sudo gpioset -c gpio1 --time=1 35=1 # niveau haut pendant 1 s
# Clignotage 10 fois
for i in $(seq 1 10); do sudo gpioset -c gpio1 --time=0.2 35=1; sleep 0.3; done
# Récupérer la LED heartbeat système (gpio0_C0 = ligne 64) si elle gêne :
echo none | sudo tee /sys/class/leds/green\:heartbeat/trigger
Expected Verification
gpiodetect displays gpiochip0 through gpiochip4. The LED lights up for approximately 1 second with gpioset --time=1, then blinks 10 times in the loop. The board's green heartbeat LED (gpio0_C0, defined in the mainline device tree) blinks under Linux; this is normal.
Common Errors
- Using old GPIO sysfs numbers inherited from Raspberry Pi tutorials: under Armbian/Rockchip, the pins are the gpio0…gpio4 banks exposed by libgpiod, not BCM numbers.
- Selecting the wrong gpiochip: gpio1_b3 is line 35 of gpiochip1, not gpiochip0.
- Reversing the LED (anode/cathode) or forgetting the 330 Ω resistor.
- Powering the board too weakly: >
Other tutorials for this board
- 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
- Interroger un capteur I2C sur les broches 3/5 du connecteur
- 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