🛠 Allumer une LED depuis le connecteur GPIO
Objectives
Discover the 40-pin connector of the ODROID-M1 and light up an external LED with libgpiod, Linux's modern GPIO interface, without proprietary libraries. The RK3568B2 (quad Cortex-A55) exposes its pins via the character device /dev/gpiochipN.
Hardware
- ODROID-M1 running Armbian or DietPi, 12 V/2 A power supply (5.5×2.1 mm barrel jack)
- 1 LED + 330 Ω resistor, male-to-female jumper cables
- >
Complete code
# Installer libgpiod (paquet gpiod sur Armbian/Debian)
sudo apt-get install -y gpiod
# Lister les banques gpio0..gpio4 du RK3568B2 et trouver une broche libre
gpioinfo
# Impulsion 2 s sur une broche (exemple gpiochip1 ligne 22 : à adapter)
sudo gpioset -t 2s gpiochip1 22=1
Expected verification
The LED lights up for 2 seconds and then turns off cleanly. The two onboard LEDs (red led-power, blue led-work with heartbeat trigger) remain independent and visible in /sys/class/leds/.
Common errors
- Wrong bank: The RK3568B2 exposes gpiochip0 to gpiochip4; the line number does not refer to the same pin from one bank to another.
- Permission denied: Add the user to the gpio group or run with sudo.
- Forgetting the resistor: The LED burns out immediately.
- Confusing the onboard LED with the external LED: /sys/class/leds does not control the 40-pin connector.
- >
Other tutorials for this board
Code examples for this board
clignotante.pyPythonbouton-gpio.pyPythoncapteur-i2c.shBashsurveillance-temperature.shBashcapteur-dht11.pyPythonservo-pwm-sysfs.shBash