Tooling

Pi GPIO Libraries

gpiozero, libgpiod, pigpio, lgpio, Adafruit Blinka — Python and beyond on the 40-pin header.

The Pi 5 broke a lot of the old RPi.GPIO-era code. The kernel moved to the GPIO character device (/dev/gpiochipN) interface, and the Pi 5's south-bridge RP1 changed what "GPIO chip 0" even means. In 2026 the right starting point is gpiozero (high-level) backed by lgpio (low-level via the new chardev) for almost any Python project. For non-GPIO accessory hardware see HATs & Accessories; for cameras see Camera Modules; for the Pico (different beast entirely) see MCU Platforms.

What changed in 2024-2025

  • Linux GPIO sysfs (/sys/class/gpio) was deprecated in kernel 4.8 and removed in newer kernels — code that does echo > /sys/class/gpio/export is dead.
  • GPIO chardev (/dev/gpiochipN via libgpiod) is the supported path.
  • Pi 5's RP1 routes GPIO through chip 4 (varies by kernel), not chip 0 — code that hard-codes /dev/gpiochip0 breaks. Use libraries that abstract this.
  • RPi.GPIO is unmaintained for Pi 5; community fork rpi-lgpio provides a shim that re-exports the API on top of lgpio.

High-level Python (start here)

  • gpiozero — Pi-Foundation-blessed; classes for LED, Button, MotionSensor, Servo, DistanceSensor, etc. Auto-detects the best backend. The right default in 2026, especially for beginners and education. Free; BSD.
from gpiozero import LED, Button
led = LED(17); button = Button(3)
button.when_pressed = led.on
  • gpiozero pin factories — under the hood you can pick lgpio (default on Pi 5), pigpio (best timing), rpi-lgpio (RPi.GPIO shim), mock (testing).

Low-level libraries (when gpiozero is too high)

  • lgpio — modern userspace library on top of GPIO chardev; what gpiozero uses by default on Pi 5. Has Python, C, and other-language bindings. The right low-level pick in 2026.
  • libgpiod / gpiod (Python) — the canonical Linux GPIO chardev library; works on every modern Linux SBC, not just Pi. Also ships CLI tools: gpiodetect, gpioinfo, gpioget, gpioset, gpiomon, gpionotify. Use these to inspect/poke pins without writing code. Versions ≥2.0 have a more modern Python API; stick with v2 for new code.
  • pigpio — the timing/PWM specialist; runs as a daemon for hardware-quality timing. Pi 5 support is limited / experimental — the maintainer paused the project. For Pi 4 and earlier, pigpio is still the best for "I need real PWM with µs jitter."
  • RPi.GPIO — the original. Still works on Pi 4 and earlier; does not support Pi 5. New code should not start here.
  • rpi-lgpio — drop-in shim that exposes the RPi.GPIO API but uses lgpio underneath. The migration path for legacy RPi.GPIO codebases on Pi 5.
  • rpi5-gpio (community) — direct memory-mapped Pi 5 access; faster but bypasses the kernel and risky. Niche.

I2C / SPI / 1-Wire from Python

  • smbus2 — pure-Python I2C; the standard. Use with i2cdetect to find devices.
  • smbus (older) — built on python-smbus; still works, but smbus2 is the preferred fork.
  • spidev — Python wrapper around the kernel SPI driver. The standard for SPI from Python.
  • w1thermsensor — DS18B20 / DS18S20 1-Wire temperature sensors via the w1-gpio overlay.
  • i2c-tools (CLI: i2cdetect, i2cdump, i2cset, i2cget) — debug I2C bus issues from the shell.

CircuitPython on Pi (Adafruit Blinka)

  • Adafruit Blinka — runs the CircuitPython API (board.D17, busio.I2C) on Linux Pi/SBC. Lets you use Adafruit's massive CircuitPython driver library (1000+ I2C/SPI sensors / displays) on a Pi. The fastest path from "I want to talk to this Adafruit sensor" to working code. Works on Pi, Jetson, and many other SBCs.
  • adafruit-circuitpython- packages* — pip-installable drivers; pair with Blinka.

Non-Python languages

  • Rust: gpiocdev — modern Rust crate against the chardev; the right pick on Pi 5.
  • Rust: rppal — Pi-specific HAL; long-running; works on Pi 4 and Pi 5.
  • Rust: linux-embedded-halembedded-hal impl on top of Linux drivers, lets you reuse driver crates from the embedded world.
  • C / C++: libgpiod — the canonical chardev library; first-class C++ binding.
  • C / C++: WiringPi — historically the C library; was deprecated, then community-resurrected in 2023; works on Pi 5 with recent updates. Many old tutorials use it; new code should prefer libgpiod.
  • Node.js: onoff — chardev-based; works on Pi 5.
  • Node.js: rpi-gpio — older, sysfs-based; broken on Pi 5.
  • Node-RED's node-red-node-pi-gpio — Pi-Foundation-blessed Node-RED nodes; works fine on Pi 5.
  • Go: periph.io — comprehensive Pi/SBC peripheral library; chardev-aware.
  • Go: go-rpio — direct Pi memory-mapped GPIO; Pi 5 support is partial. Prefer periph.io for new Go code.

CLI tools (debugging without writing code)

  • pinout (gpiozero) — prints a colored ASCII pin diagram for the connected Pi. Run it once, end the "is this pin GPIO 17 or pin 11?" confusion.
  • gpiodetect / gpioinfo — list GPIO chips and lines.
  • gpioget / gpioset / gpiomon — poll, set, and watch lines from the shell. Indispensable for sensor bring-up.
  • raspi-gpio (raspi-gpio get) — Pi-specific tool that dumps register-level GPIO state including alt-functions and pull-up/down. Goes deeper than gpioinfo.
  • i2cdetect -y 1 — show which I2C addresses respond on bus 1.

Hardware breakouts / debugging gear

  • GPIO ribbon cable + breakout board ("Cobbler" by Adafruit) — the canonical "do not solder to your Pi" breadboard adapter.
  • Pi GPIO Reference Card — stick it in your case; saves looking up pinouts.
  • Logic analyzer (Saleae clone) — $15 8-channel "Saleae"-clones on AliExpress; pair with PulseView (sigrok) or Saleae Logic 2. Indispensable for SPI / I2C bring-up.
  • Bus Pirate / Glasgow Interface Explorer — go-anywhere protocol tools; hardware hacker favorites.

License / pricing

All libraries listed are FOSS (BSD / MIT / LGPL / Apache). Hardware tools are cheap ($10-30 except commercial logic analyzers).

Pick this if…

  • Default Python on Pi 5: gpiozero (with lgpio backend, automatic).
  • Beginner / classroom: gpiozero. No exceptions.
  • Need precise timing / PWM (Pi 4 and earlier): pigpio.
  • Need precise timing / PWM (Pi 5): lgpio + hardware PWM peripheral, or move the hard-real-time bit to a Pi Pico over USB.
  • Migrating legacy RPi.GPIO code to Pi 5: rpi-lgpio shim.
  • Talk to Adafruit sensors / displays: Adafruit Blinka + driver libraries.
  • Cross-SBC code (not Pi-specific): libgpiod / gpiod (C / Python) or periph.io (Go) or gpiocdev (Rust).
  • Just want to poke a pin from bash: gpioset / gpioget.
  • Don't know what pin you're on: pinout.